Desktop entry + Wayland app id so the taskbar shows the app icon
This commit is contained in:
parent
4d9489b5ac
commit
cbbe779faa
3 changed files with 50 additions and 0 deletions
42
frontend/scripts/install-desktop-entry.sh
Executable file
42
frontend/scripts/install-desktop-entry.sh
Executable file
|
|
@ -0,0 +1,42 @@
|
|||
#!/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."
|
||||
Loading…
Add table
Add a link
Reference in a new issue