Skip to content

Capture system shortcuts only while the shown session is connected - #142

Open
Unayung wants to merge 1 commit into
omacom:mainfrom
Unayung:fix/capture-only-when-connected
Open

Unayung wants to merge 1 commit into
omacom:mainfrom
Unayung:fix/capture-only-when-connected

Conversation

@Unayung

@Unayung Unayung commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Fixes #121.

Problem

Clicking the picture with nothing connected gave it focus, and focus alone inhibited the compositor's shortcuts. Super+W, Super+Q and workspace keys then did nothing, and the window looked hung. The hover and address-bar paths only checked that a session exists, so a session still reconnecting to an unreachable host captured the same way, which is the fullscreen case in the issue's comment. A connection that dropped while captured also kept the capture.

Fix

The inhibit moves out of the focus-enter handler into sync_capture(). It inhibits while the picture has the keyboard and the shown session is connected, and restores otherwise. It runs when the picture gains focus, on connect, on disconnect, and when another tab or no session is shown. The picture still takes focus as before, so a connection started from the address bar captures as soon as it connects, with no extra click.

  • Focus is tracked in App::video_focused, set by the focus controller. During the enter handler the window still reports the old focus widget, so GtkWindowExt::focus cannot be used there.
  • The capture hint is built once into App::capture_hint and shown on the first real capture, not on the first focus.
  • GTK skips a repeated inhibit_system_shortcuts / restore_system_shortcuts on a seat that is already in that state, so calling it again is safe.

Not in this PR

Testing

scripts/check.sh passes. In a nested Hyprland (same setup as e2e case 12), with --connect to a port nothing listens on and the picture focused from the keyboard (Esc out of the address bar, then Tab):

client video focused inhibited=true
gliff 0.4.3 1 1
this branch 1 0

Connected to a gliff-server --listen --headless, this branch inhibits on every focus (6 of 6). I could not get the picture focused again after connecting in the nested session, so the disconnect-while-captured path is not verified live. The "video focused" log line that e2e case 12 counts is unchanged.

The change was written with Claude Opus 5.5.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UCs6nfZCNssaXtUYR7cpHg

Clicking the picture with nothing connected gave it focus and inhibited
the compositor's shortcuts, so Super+W and workspace keys did nothing and
the window looked hung. A session that was still reconnecting captured on
hover the same way, and a dropped connection kept the capture.

Inhibit while the picture has the keyboard and the shown session is
connected, and check again on focus changes, on connect and disconnect,
and when another tab is shown.

Fixes omacom#121.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UCs6nfZCNssaXtUYR7cpHg
@greptile-apps

greptile-apps Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The change stays within Gliff’s remote-view keyboard workflow.

The change appears safe to merge, with a non-blocking gap in tests for disconnecting and reconnecting while focused.

Findings

  1. P2 Disconnect behavior lacks a test ▶

Summary

Captures system shortcuts only when the picture has keyboard focus and the shown session is connected.

  • Gliff captures local shortcuts only while its picture is focused on a connected session.

Reviews (1) · Last reviewed commit: "Capture system shortcuts only while the ..." · Reviewed by Greptile

Comment thread crates/gliff/src/main.rs Resolved
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.

Gliff appears unresponsive after a click with nothing connected: Super+W and other shortcuts stop working

1 participant