-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_context_menu.sh
More file actions
106 lines (101 loc) · 3.74 KB
/
Copy pathinstall_context_menu.sh
File metadata and controls
106 lines (101 loc) · 3.74 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/bash
# Antigravity - Right-Click Context Menu Manager (Linux - Nautilus/GNOME)
show_menu() {
clear
echo "==================================================="
echo " Antigravity - Right-Click Context Menu Manager"
echo "==================================================="
echo ""
echo "This tool manages 'Open with Antigravity (Debug)' in your"
echo "Nautilus/GNOME file manager Right-Click menu."
echo ""
echo "WHAT IT DOES:"
echo " - Adds/Removes a script in ~/.local/share/nautilus/scripts/"
echo " - Adds a new option when you right-click a folder"
echo " - Clicking it will run: antigravity . --remote-debugging-port=9000"
echo ""
echo "REQUIREMENTS:"
echo " - Nautilus file manager (GNOME)"
echo " - Antigravity CLI must be installed and in your PATH"
echo ""
echo "NOTE: This only works on Linux with Nautilus."
echo " For macOS, see README.md for Automator Quick Action setup."
echo ""
echo "==================================================="
echo ""
echo "Choose an option:"
echo " [1] Install - Add Right-Click menu"
echo " [2] Remove - Remove Right-Click menu"
echo " [3] Restart - Restart Nautilus (to apply changes)"
echo " [4] Backup - Copy existing script before changes"
echo " [5] Exit"
echo ""
}
NAUTILUS_PATH="$HOME/.local/share/nautilus/scripts"
SCRIPT_FILE="$NAUTILUS_PATH/Open with Antigravity (Debug)"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BACKUP_DIR="$SCRIPT_DIR/registry"
while true; do
show_menu
read -p "Enter choice (1-5): " choice
case $choice in
1)
echo ""
echo "[INSTALL] Creating Nautilus script..."
if [ ! -d "$NAUTILUS_PATH" ]; then
mkdir -p "$NAUTILUS_PATH"
fi
echo "#!/bin/bash" > "$SCRIPT_FILE"
echo "# Antigravity context menu script" >> "$SCRIPT_FILE"
echo "cd \"\$NAUTILUS_SCRIPT_CURRENT_URI\" 2>/dev/null || cd \"\$(pwd)\"" >> "$SCRIPT_FILE"
echo "antigravity . --remote-debugging-port=9000" >> "$SCRIPT_FILE"
chmod +x "$SCRIPT_FILE"
echo ""
echo "[SUCCESS] Context menu installed!"
read -p "Press Enter to return to menu..."
;;
2)
echo ""
echo "[REMOVE] Deleting Nautilus script..."
if [ -f "$SCRIPT_FILE" ]; then
rm "$SCRIPT_FILE"
echo ""
echo "[SUCCESS] Context menu removed!"
else
echo ""
echo "[INFO] No Antigravity context menu script found."
fi
read -p "Press Enter to return to menu..."
;;
3)
echo ""
echo "[RESTART] Restarting Nautilus..."
nautilus -q
echo "[SUCCESS] Nautilus signaled to quit. It will restart on next open."
read -p "Press Enter to return to menu..."
;;
4)
echo ""
echo "[BACKUP] Backing up existing script..."
if [ -f "$SCRIPT_FILE" ]; then
mkdir -p "$BACKUP_DIR"
BACKUP_FILE="$BACKUP_DIR/antigravity_backup_$(date +%Y%m%d_%H%M%S).sh"
cp "$SCRIPT_FILE" "$BACKUP_FILE"
echo ""
echo "[SUCCESS] Backup saved to: $BACKUP_FILE"
else
echo ""
echo "[INFO] No existing Antigravity context menu script found to backup."
fi
read -p "Press Enter to return to menu..."
;;
5)
echo "[EXIT] Exiting..."
exit 0
;;
*)
echo "[ERROR] Invalid choice."
sleep 1
;;
esac
done