-
Notifications
You must be signed in to change notification settings - Fork 95
Expand file tree
/
Copy pathtoggle-autostart.sh
More file actions
executable file
·54 lines (41 loc) · 1.32 KB
/
toggle-autostart.sh
File metadata and controls
executable file
·54 lines (41 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
# Atomikspace
# email: atomikspace.labs@gmail.com
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
AUTOSTART_DIR="$HOME/.config/autostart"
DESKTOP_FILE="$AUTOSTART_DIR/tars-ai.desktop"
LAUNCHER_SCRIPT="$SCRIPT_DIR/lp.sh"
mkdir -p "$AUTOSTART_DIR"
if [ -f "$DESKTOP_FILE" ]; then
rm "$DESKTOP_FILE"
rm -f "$LAUNCHER_SCRIPT"
echo " TARS-AI removed from autostart"
echo " The program will no longer start automatically on boot"
else
# Create the launcher script
cat > "$LAUNCHER_SCRIPT" << 'LAUNCHER_EOF'
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
sleep 8
if [ -f "$HOME/.bashrc" ]; then
source "$HOME/.bashrc"
fi
export DISPLAY=:0
lxterminal --working-directory="$SCRIPT_DIR" --command="bash -c 'python3 "$SCRIPT_DIR/App-Start.py"; exec bash'" &
echo "TARS-AI launched at $(date)" >> "$SCRIPT_DIR/autostart.log"
LAUNCHER_EOF
chmod +x "$LAUNCHER_SCRIPT"
cat > "$DESKTOP_FILE" << EOF
[Desktop Entry]
Type=Application
Name=TARS-AI
Comment=Start TARS-AI on boot with proper environment
Exec=$LAUNCHER_SCRIPT
Terminal=false
StartupNotify=false
X-GNOME-Autostart-enabled=true
EOF
echo " TARS-AI added to autostart"
echo " The program will start automatically on next boot"
echo " A terminal window will open showing the TARS-AI interface"
fi