42 lines
1.4 KiB
Bash
Executable file
42 lines
1.4 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Install the Keynectr .desktop entry and icon for the current user.
|
|
#
|
|
# On Linux (especially Wayland) the taskbar icon does not come from the
|
|
# BrowserWindow icon: the desktop environment resolves the running app's id
|
|
# against an installed .desktop file and its Icon= key. This script installs
|
|
# both so the hummingbird-key icon shows up in launchers and taskbars.
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
ICON_SRC="$ROOT/build/icon.png"
|
|
ICON_DIR="$HOME/.local/share/icons/hicolor/512x512/apps"
|
|
DESKTOP_DIR="$HOME/.local/share/applications"
|
|
|
|
if [[ ! -f "$ICON_SRC" ]]; then
|
|
echo "Icon not found at $ICON_SRC" >&2
|
|
exit 1
|
|
fi
|
|
|
|
mkdir -p "$ICON_DIR" "$DESKTOP_DIR"
|
|
cp "$ICON_SRC" "$ICON_DIR/keynectr.png"
|
|
|
|
cat > "$DESKTOP_DIR/keynectr.desktop" <<EOF
|
|
[Desktop Entry]
|
|
Type=Application
|
|
Name=Keynectr
|
|
Comment=Manage Nostr profiles and publish notes
|
|
Exec=bash -lc "cd '$ROOT' && npm start"
|
|
Icon=keynectr
|
|
Terminal=false
|
|
Categories=Network;Utility;
|
|
StartupWMClass=keynectr
|
|
EOF
|
|
|
|
# Refresh the desktop database so the new entry is picked up without a logout.
|
|
update-desktop-database "$DESKTOP_DIR" 2>/dev/null || true
|
|
command -v kbuildsycoca6 >/dev/null 2>&1 && kbuildsycoca6 --noincremental >/dev/null 2>&1 || true
|
|
|
|
echo "Installed:"
|
|
echo " $ICON_DIR/keynectr.png"
|
|
echo " $DESKTOP_DIR/keynectr.desktop"
|
|
echo "Restart Keynectr to see the icon in the taskbar."
|