Skip to content

Caffeine button: claim the right-click so the window menu stays away - #570

Merged
ghackett merged 2 commits into
mainfrom
caffeine-right-click-claims-press
Sep 17, 2026
Merged

ghackett merged 2 commits into
mainfrom
caffeine-right-click-claims-press

Conversation

@ghackett

Copy link
Copy Markdown
Member

Right-clicking the header's Caffeine cup under GNOME on Wayland opened the compositor's window menu (Take Screenshot, Minimize, Maximize, Close) instead of the durations menu.

Cause. The button's Gtk.GestureClick(button=SECONDARY) popped the durations popover on pressed but never claimed the sequence, so the press kept bubbling up to the header bar's GtkWindowHandle. That handle's own gesture answers any secondary click with gdk_toplevel_show_window_menu, which mutter never refuses, so the window menu took the grab and the popover (which pops a turn later) never showed. GTK's window-handle code is identical between 4.16 and 4.22, so this is not a GTK change; it is a compositor that always serves the menu. Every other right-click menu in the app already claims its gesture.

Fix. The pressed handler now sets the sequence CLAIMED before showing the menu, in MainWindow._on_caffeine_secondary.

Docs. A release note under v0.1.4 UNRELEASED in docs/releases.md. The feature guide's description of the right-click menu is unchanged and was already accurate.

Testing. ruff and the unit suite pass. There is no automated check: nothing in the e2e harness synthesizes a pointer press on the headless compositor. Please right-click the cup on the affected machine to confirm.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RjbzS2d2W6G7TQJ33ugkiy

ghackett and others added 2 commits September 16, 2026 21:52
Under GNOME on Wayland a right-click on the header's cup brought up the
compositor's window menu (Take Screenshot, Minimize, Maximize, Close)
instead of the durations popover. The button's secondary-click gesture
popped the menu but never claimed the sequence, so the press bubbled on
to the header bar's GtkWindowHandle, whose own gesture answers any
secondary click with gdk_toplevel_show_window_menu; mutter never refuses
that, and the window menu took the grab before our popover could show.

The press is now claimed at the button, the way every other right-click
menu in the app claims its gesture.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RjbzS2d2W6G7TQJ33ugkiy
@ghackett

Copy link
Copy Markdown
Member Author

@claude review

@claude

claude Bot commented Sep 17, 2026

Copy link
Copy Markdown

Claude finished @ghackett's task in 1m 6s —— View job


Review: Caffeine button right-click fix

Summary: This is a small, correct, well-scoped fix. No changes requested.

collins/window.py

  • _on_caffeine_secondary (collins/window.py:3168-3175) calls gesture.set_state(Gtk.EventSequenceState.CLAIMED) before opening the popover — this matches the exact pattern used by every other secondary-click gesture in the codebase (copylabel.py:98, diffview.py:942, filetree.py:404, gitsidebar.py:1049, terminal.py:317, etc.), so it's consistent with the established idiom rather than a one-off workaround.
  • The handler signature (self, gesture: Gtk.GestureClick, *_args) correctly absorbs the pressed signal's (n_press, x, y) args.
  • The root cause and fix described in the PR body match the diff exactly — AdwHeaderBar's GtkWindowHandle answering unclaimed secondary presses with gdk_toplevel_show_window_menu is a real and previously-undocumented GTK trap.
  • GPL modification header bump on collins/window.py (2026-09-10 → 2026-09-16) is present and correctly required since this is a pre-fork file.

.agents/collins-gtk-sharp-edges/SKILL.md

  • New bullet accurately generalizes the trap (any header-bar child's right-click gesture, not just Caffeine) and references the fixing PR — good, this is exactly the kind of footgun this skill file exists to capture for future edits.

docs/releases.md

  • New UNRELEASED entry is clear, correctly targeted at end users (describes symptom and cause without internals), and matches the existing entries' voice/format.

Testing note: I wasn't able to run ruff or the unit suite myself in this session (Bash tool calls required interactive approval I don't have here), so I relied on manual inspection of the diff plus a grep across the codebase confirming the CLAIMED pattern is used consistently everywhere else. The change itself is small enough (2 lines of real logic) that this doesn't concern me, but flagging it per the instructions in case CI hasn't run yet — check that the e2e required check and lint/unit jobs are green on this PR before merging, since (as the PR body notes) there's no automated regression test for the Wayland compositor behavior itself.

@ghackett

Copy link
Copy Markdown
Member Author

🤖 Re the testing note in the review: CI has already run on the current head (65340c3). Lint, the unit suite, all five e2e shards and the fanned-in e2e check, packaging, both PPA source builds, the RPM build, version verification and the docs build all passed. Nothing else in the review asked for a change, so no code was pushed.

@ghackett
ghackett marked this pull request as ready for review September 17, 2026 02:02
@ghackett
ghackett merged commit f2d1cb1 into main Sep 17, 2026
15 checks passed
@ghackett
ghackett deleted the caffeine-right-click-claims-press branch September 17, 2026 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant