Skip to content

Add window::inhibit_keyboard_shortcuts - #7

Open
kevinard wants to merge 1 commit into
canopa/basefrom
canopa/keyboard-shortcuts-inhibit
Open

kevinard wants to merge 1 commit into
canopa/basefrom
canopa/keyboard-shortcuts-inhibit

Conversation

@kevinard

Copy link
Copy Markdown
Owner

Canopa fork tracking PR. Its diff against canopa/base (595af03, the tip of upstream's 0.14 branch when iced_widget 0.14.2 was released. iced_winit and iced_runtime there are identical to the 0.14.0 release, 3997291) is exactly the change Canopa carries in iced_winit/iced_runtime. It is merged into canopa/main, which Canopa builds. This PR stays open until the change is upstreamed or dropped.

What

  • iced_runtime::window::keyboard_shortcuts: Inhibitor reports the actual Status (Unfocused, Pending, Active, Inactive, Closed) and has one coalesced changes() stream. A Driver trait is provided for adapters. Window closure revokes retained clones.
  • window::inhibit_keyboard_shortcuts(id) -> Task<Option<Inhibitor>> and Action::InhibitKeyboardShortcuts.
  • iced_winit::keyboard_shortcuts: an adapter onto winit's Wayland inhibit_keyboard_shortcuts. Other backends return None.

winit pin: the root Cargo.toml adds [patch.crates-io] winit = { git = "https://github.com/kevinard/winit", rev = "7a606df981b5…" }, pointing at kevinard/winit canopa/wayland-keyboard-shortcuts-inhibit (focus-scoped keyboard shortcut inhibition). Cargo.lock is updated to match. canopa/main pins winit's canopa/main instead.

Why

Canopa's GlobalShortcuts configuration editor must receive the keys it configures while existing registrations stay reserved. See Canopa ADR 0068.

Verification

  • cargo check --locked --all-targets -p iced_winit -p iced_runtime -p iced_test (default features) and cargo check --locked -p iced --no-default-features --features advanced,wgpu,crisp,web-colors,thread-pool,wayland,image (Canopa's selection) pass at this branch. The only warning is the pre-existing f32::INFINITY deprecation in iced_widget.
  • cargo test --locked -p iced_winit -p iced_runtime --lib passes, including the coalesced-change test for Inhibitor.
  • In Canopa: 22 public-frontend native groups pass (ADR 0068).

Upstream

Inventory verdict: upstream the inhibitor alone, which is this PR, and keep recording local. It depends on winit gaining the protocol (issue rust-windowing/winit#2776, open). The [patch.crates-io] pin is fork-only and goes away once winit provides the API.

🤖 Generated with Claude Code

An editor for keyboard shortcuts (or a remote desktop viewer) needs the
key combinations that the compositor would otherwise consume, while the
editor window has focus.

Add `window::inhibit_keyboard_shortcuts(id)`, which resolves to an
`Inhibitor` handle or `None` on unsupported backends and closed
windows, and `Action::InhibitKeyboardShortcuts`. The handle reports
the actual focus and compositor permission (`Unfocused`, `Pending`,
`Active`, `Inactive`, `Closed`) and offers one coalesced change
stream; closing the window revokes retained clones. The `winit` shell
implements it with winit's Wayland `inhibit_keyboard_shortcuts`.

Requires winit's `WindowExtWayland::inhibit_keyboard_shortcuts`;
`Cargo.toml` patches winit to the fork commit that provides it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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