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
|
|
@ -563,6 +563,13 @@ function createWindow(): void {
|
|||
});
|
||||
}
|
||||
|
||||
// Wayland has no per-window icons: the taskbar resolves the running app's id
|
||||
// through an installed .desktop file instead (see
|
||||
// scripts/install-desktop-entry.sh). Pin the identity before `ready`.
|
||||
if (process.platform === 'linux') {
|
||||
app.setDesktopName('keynectr.desktop');
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
protocol.handle('app', (request) => {
|
||||
const { pathname } = new URL(request.url);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
"format:check": "prettier --check .",
|
||||
"electron:build": "tsc -p tsconfig.electron.json",
|
||||
"start": "npm run electron:build && electron .",
|
||||
"desktop:install": "bash scripts/install-desktop-entry.sh",
|
||||
"dist": "npm run build && npm run electron:build && electron-builder --linux dir"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
|||
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