Add a top-bar icon with a status menu, and a 2-hour off option

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
This commit is contained in:
agent 2026-10-26 13:37:35 +00:00
parent fdd43c389b
commit 1bcbbfd8be
8 changed files with 500 additions and 9 deletions

View file

@ -12,10 +12,12 @@ 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"
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
@ -26,7 +28,7 @@ if ! python3 -c 'import gi; gi.require_version("Gtk", "4.0"); gi.require_version
exit 1
fi
mkdir -p "$BIN" "$(dirname "$DESKTOP")" "$(dirname "$AUTOSTART")" "$(dirname "$ICON")"
mkdir -p "$BIN" "$(dirname "$DESKTOP")" "$(dirname "$AUTOSTART")" "$(dirname "$ICON")" "$SYMBOLIC"
cat > "$BIN/pause" <<EOF
#!/bin/sh
@ -37,11 +39,18 @@ 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" ;;