forked from CLOUDWERX-DEV/ghostkey
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·57 lines (47 loc) · 2.08 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·57 lines (47 loc) · 2.08 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
#!/usr/bin/env bash
set -euo pipefail
# Install GhostKey for the current user so it can be launched anywhere with `ghostkey`
# and add a desktop launcher with icons.
# Requirements (system packages): python3-gi, gir1.2-gtk-3.0, gir1.2-appindicator3-0.1 (and optionally gir1.2-xapp-1.0 on Cinnamon)
PROJECT_DIR="$(cd "$(dirname "$0")" && pwd)"
export PIPX_BIN="${PIPX_BIN:-$HOME/.local/bin/pipx}"
have_cmd() { command -v "$1" >/dev/null 2>&1; }
# Ensure pipx is available
if ! have_cmd pipx && [[ ! -x "$PIPX_BIN" ]]; then
echo "Installing pipx for the current user..."
python3 -m pip install --user pipx >/dev/null
python3 -m pipx ensurepath || true
fi
# Pick a pipx executable
if have_cmd pipx; then
PIPX="pipx"
elif [[ -x "$PIPX_BIN" ]]; then
PIPX="$PIPX_BIN"
else
echo "Error: pipx not found and installation failed. Please install pipx and re-run." >&2
exit 1
fi
echo "Installing GhostKey via pipx with system site packages (for GTK gi)..."
# Re-install to pick up latest local changes
$PIPX uninstall ghostkey >/dev/null 2>&1 || true
$PIPX install --system-site-packages "$PROJECT_DIR"
echo "Installing desktop entry and icons..."
if have_cmd ghostkey-install-desktop; then
ghostkey-install-desktop || true
else
# Fallback to running module directly from local venv if pipx shim isn't in PATH yet
if [[ -x "$PROJECT_DIR/.venv/bin/python" ]]; then
PYTHONPATH="$PROJECT_DIR/src" "$PROJECT_DIR/.venv/bin/python" -m ghostkey.desktop_install || true
else
echo "Warning: Could not find ghostkey-install-desktop command; ensure ~/.local/bin is in PATH or run it manually later." >&2
fi
fi
# Proactively refresh desktop/menu caches for Cinnamon
if command -v xdg-desktop-menu >/dev/null 2>&1; then
xdg-desktop-menu forceupdate || true
fi
if command -v update-desktop-database >/dev/null 2>&1; then
update-desktop-database "$HOME/.local/share/applications" || true
fi
echo "Done. You can now run: ghostkey"
echo "If the icon doesn't appear immediately in the panel/menu, try restarting Cinnamon (Alt+F2, type 'r' on GNOME; on Cinnamon, log out/in) or run: xdg-desktop-menu forceupdate"