Files
kadence/desktop/packaging/install-desktop.sh
T
timka123 77b26757bf refactor: enhance TimerPage layout and functionality; update theme and tokens for improved design consistency
- Refactored TimerPage component to improve layout and user experience.
- Updated theme configuration to utilize design tokens for better maintainability.
- Introduced new tokens for colors and typography to align with design principles.
- Simplified state management and improved timer functionality.
- Enhanced accessibility and responsiveness of UI elements.
2026-10-18 23:57:36 +03:00

62 lines
2.7 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. The
# desktop entry points at this absolute path, so nothing depends on PATH.
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"
# Exec/TryExec are written as absolute paths on purpose.
#
# Application launchers (KDE's Kickoff, rofi -show drun, GNOME's overview) run
# with the *session* PATH, which on most setups does not include ~/.local/bin —
# and an entry whose TryExec cannot be resolved is silently hidden. An absolute
# path cannot be hidden by a PATH that differs from your shell's.
sed -e "s|^Exec=kadence-desktop|Exec=$BIN/kadence-desktop|" \
-e "s|^TryExec=kadence-desktop|TryExec=$BIN/kadence-desktop|" \
-e "s|^Exec=kadence-desktop |Exec=$BIN/kadence-desktop |" \
"$HERE/kadence.desktop" > "$APPS/kadence.desktop"
chmod 0644 "$APPS/kadence.desktop"
install -m 0644 "$HERE/kadence.svg" "$ICONS/kadence.svg"
# Each launcher keeps its own cache; refresh all of the ones that are present.
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
command -v kbuildsycoca6 >/dev/null && kbuildsycoca6 --noincremental >/dev/null 2>&1 || true
# rofi rebuilds its drun cache when the directory changes; nudge the timestamp.
touch "$APPS" 2>/dev/null || true
if command -v desktop-file-validate >/dev/null; then
desktop-file-validate "$APPS/kadence.desktop" && echo "Desktop entry validates."
fi
echo
echo "Installed:"
echo " launcher $BIN/kadence-desktop"
echo " menu entry $APPS/kadence.desktop"
echo " icon $ICONS/kadence.svg"
echo
echo "It should now appear in the application menu and in \`rofi -show drun\`"
echo "as \"Kadence\" (search: pomodoro, timer, focus)."