Pause now shows an eye in the GNOME top bar (open while breaks are on, closed while they're off). Its menu shows the time to the next break and offers Take a Break Now, Turn Off for an Hour / for 2 Hours, Turn Breaks Back On and Quit. It speaks StatusNotifierItem + dbusmenu over the app's own D-Bus connection, so it needs the AppIndicator Shell extension (packaged in Fedora) but no extra Python dependencies; libayatana-appindicator is GTK 3 only and can't share a process with GTK 4. Without the extension the icon just doesn't appear. Pause re-registers whenever the watcher appears, so enabling the extension later or restarting the Shell works. "Turn Off for 2 Hours" is also added to the app-grid right-click menu and the status notification. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F7w6vnQked3XNiTdTZDP8r
57 lines
2.2 KiB
Bash
Executable file
57 lines
2.2 KiB
Bash
Executable file
#!/bin/sh
|
|
# Install Pause for the current user, running straight from this checkout
|
|
# (so `git pull` updates it). Use --uninstall to remove it again.
|
|
set -eu
|
|
|
|
REPO=$(cd "$(dirname "$0")" && pwd)
|
|
BIN=${XDG_BIN_HOME:-$HOME/.local/bin}
|
|
DATA=${XDG_DATA_HOME:-$HOME/.local/share}
|
|
CONFIG=${XDG_CONFIG_HOME:-$HOME/.config}
|
|
APP_ID=net.reudy.Pause
|
|
|
|
DESKTOP=$DATA/applications/$APP_ID.desktop
|
|
AUTOSTART=$CONFIG/autostart/$APP_ID.desktop
|
|
ICON=$DATA/icons/hicolor/scalable/apps/$APP_ID.svg
|
|
SYMBOLIC=$DATA/icons/hicolor/symbolic/apps
|
|
|
|
if [ "${1:-}" = "--uninstall" ]; then
|
|
"$BIN/pause" quit 2>/dev/null || true
|
|
rm -f "$BIN/pause" "$DESKTOP" "$AUTOSTART" "$ICON" \
|
|
"$SYMBOLIC/$APP_ID-symbolic.svg" "$SYMBOLIC/$APP_ID-off-symbolic.svg"
|
|
echo "Pause removed. Your notes are still in $DATA/pause/."
|
|
exit 0
|
|
fi
|
|
|
|
if ! python3 -c 'import gi; gi.require_version("Gtk", "4.0"); gi.require_version("Adw", "1")' 2>/dev/null; then
|
|
echo "GTK 4 / libadwaita for Python are missing. On Fedora:" >&2
|
|
echo " sudo dnf install python3-gobject gtk4 libadwaita" >&2
|
|
exit 1
|
|
fi
|
|
|
|
mkdir -p "$BIN" "$(dirname "$DESKTOP")" "$(dirname "$AUTOSTART")" "$(dirname "$ICON")" "$SYMBOLIC"
|
|
|
|
cat > "$BIN/pause" <<EOF
|
|
#!/bin/sh
|
|
PYTHONPATH="$REPO\${PYTHONPATH:+:\$PYTHONPATH}" exec python3 -m pause "\$@"
|
|
EOF
|
|
chmod +x "$BIN/pause"
|
|
|
|
sed "s|@BIN@|$BIN|g" "$REPO/data/$APP_ID.desktop" > "$DESKTOP"
|
|
sed "s|@BIN@|$BIN|g" "$REPO/data/$APP_ID.autostart.desktop" > "$AUTOSTART"
|
|
cp "$REPO/data/$APP_ID.svg" "$ICON"
|
|
# Top-bar icons. Pause also points the tray at the checkout, but installing
|
|
# them into the theme means any tray host can find them.
|
|
cp "$REPO/data/icons/hicolor/symbolic/apps/"*.svg "$SYMBOLIC/"
|
|
update-desktop-database "$DATA/applications" 2>/dev/null || true
|
|
gtk-update-icon-cache -q "$DATA/icons/hicolor" 2>/dev/null || true
|
|
|
|
echo "Installed. Pause starts automatically when you log in."
|
|
echo "Start it now with: pause &"
|
|
if ! gnome-extensions info appindicatorsupport@rgcjonas.gmail.com >/dev/null 2>&1; then
|
|
echo "For the top-bar icon, install the AppIndicator extension (see README):"
|
|
echo " sudo dnf install gnome-shell-extension-appindicator"
|
|
fi
|
|
case ":$PATH:" in
|
|
*":$BIN:"*) ;;
|
|
*) echo "Note: $BIN is not in your PATH; use $BIN/pause" ;;
|
|
esac
|