Files
routine/scripts/install-desktop.sh
T

37 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# Put Routine in the app grid so it can be pinned to the dash. Re-run after moving the repo.
# (Runs this checkout as it is: for a copy of its own, updated by re-running, see install-linux.sh.)
set -euo pipefail
REPO="$(cd "$(dirname "$0")/.." && pwd)"
APPS=~/.local/share/applications
HICOLOR=~/.local/share/icons/hicolor
ICON="$HICOLOR/scalable/apps/me.teafry.routine.svg"
mkdir -p "$APPS" "$HICOLOR/scalable/apps"
cp "$REPO/shared/icon.svg" "$ICON"
# fixed sizes too, for whatever doesn't read SVG (rendered with Qt, which the app needs anyway)
for n in 48 64 128 256; do
mkdir -p "$HICOLOR/${n}x${n}/apps"
QT_QPA_PLATFORM=offscreen PYTHONPATH="$REPO" python3 -c "
import sys
from routine.qt.QtGui import QGuiApplication, QIcon
a = QGuiApplication(sys.argv)
QIcon(sys.argv[1]).pixmap(int(sys.argv[2]), int(sys.argv[2])).save(sys.argv[3])" \
"$REPO/shared/icon.svg" "$n" "$HICOLOR/${n}x${n}/apps/me.teafry.routine.png" 2>/dev/null
done
cat > "$APPS/me.teafry.routine.desktop" <<DESKTOP
[Desktop Entry]
Type=Application
Name=Routine
Comment=The day's routine, ticked off as you go
Exec=python3 -m routine
Path=$REPO
Icon=$ICON
Terminal=false
Categories=Utility;
StartupWMClass=me.teafry.routine
StartupNotify=true
DESKTOP
update-desktop-database "$APPS" 2>/dev/null || true
gtk-update-icon-cache -q -t -f "$HICOLOR" 2>/dev/null || true
echo "Installed: search for Routine in Activities, then right-click → Pin to Dash."