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

@ -21,12 +21,32 @@ pause &
`install.sh` doesn't need root. It adds:
- `~/.local/bin/pause`, a launcher that runs from the checkout, so `git pull` updates it
- an app-grid entry (open it to see the time left; right-click for *Take a Break Now* / *Turn Off for an Hour*)
- an app-grid entry (open it to see the time left; right-click for *Take a Break Now* / *Turn Off for an Hour* / *for 2 Hours*)
- top-bar icons (see below)
- an autostart entry, so Pause starts when you log in
If it complains about missing modules: `sudo dnf install python3-gobject gtk4 libadwaita`.
Remove it with `./install.sh --uninstall` (your notes are kept).
### Top-bar icon
Pause puts an eye in the top bar: open while breaks are on, closed while
they're off. Click it for the time to the next break and *Take a Break Now*,
*Turn Off for an Hour*, *Turn Off for 2 Hours*, *Turn Breaks Back On* and
*Quit Pause*.
GNOME has no tray of its own, so this needs the AppIndicator extension, which
Fedora packages:
```sh
sudo dnf install gnome-shell-extension-appindicator
```
Log out and back in (Wayland can't reload the Shell in place), then turn on
*AppIndicator and KStatusNotifierItem Support* in the Extensions app. Pause
picks it up on its own; no restart needed. Without the extension there's no
icon, and everything else works the same.
## The break
1. A notification a minute before (**Snooze** / **Take it now**).
@ -73,9 +93,10 @@ pulls itself back to the front, and sounds. Restart Pause after editing it.
## Development
```sh
python3 -m unittest # scheduler, notes and exercise-plan tests
python3 -m unittest # scheduler, notes, exercise-plan and tray tests
python3 -m pause # run from the checkout
```
The timing logic lives in `pause/scheduler.py` and has no GTK dependency, so
it can be tested with a fake clock. The break screen is in `pause/overlay.py`.
it can be tested with a fake clock. The break screen is in `pause/overlay.py`, the top-bar icon
(StatusNotifierItem + dbusmenu over D-Bus) in `pause/tray.py`.