36 lines
1.4 KiB
Bash
Executable File
36 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Installs Kadence's launcher entry and icon for the current user.
|
|
#
|
|
# The app itself runs straight from the checkout (`python3 -m kadence_desktop`)
|
|
# or from a pip install; this just makes it appear in the application menu with
|
|
# a proper icon and the right-click actions.
|
|
set -euo pipefail
|
|
|
|
HERE="$(dirname "$(readlink -f "$0")")"
|
|
APPS="${XDG_DATA_HOME:-$HOME/.local/share}/applications"
|
|
ICONS="${XDG_DATA_HOME:-$HOME/.local/share}/icons/hicolor/scalable/apps"
|
|
BIN="${HOME}/.local/bin"
|
|
|
|
mkdir -p "$APPS" "$ICONS" "$BIN"
|
|
|
|
# A launcher that works whether or not the package is pip-installed.
|
|
cat > "$BIN/kadence-desktop" <<LAUNCHER
|
|
#!/usr/bin/env bash
|
|
exec python3 -m kadence_desktop "\$@"
|
|
LAUNCHER
|
|
chmod +x "$BIN/kadence-desktop"
|
|
|
|
# Make the package importable from wherever this checkout lives.
|
|
SITE_PTH="$(python3 -c 'import site; print(site.getusersitepackages())')"
|
|
mkdir -p "$SITE_PTH"
|
|
echo "$(dirname "$HERE")" > "$SITE_PTH/kadence-desktop.pth"
|
|
|
|
install -m 0644 "$HERE/kadence.desktop" "$APPS/kadence.desktop"
|
|
install -m 0644 "$HERE/kadence.svg" "$ICONS/kadence.svg"
|
|
|
|
command -v update-desktop-database >/dev/null && update-desktop-database "$APPS" || true
|
|
command -v gtk-update-icon-cache >/dev/null && gtk-update-icon-cache -f -t "${XDG_DATA_HOME:-$HOME/.local/share}/icons/hicolor" 2>/dev/null || true
|
|
|
|
echo "Installed. Launch it from the menu, or run: kadence-desktop"
|
|
echo "Make sure ~/.local/bin is on your PATH."
|