Skip to content

Add shortcut recording to keyboard shortcut inhibitors - #8

Open
kevinard wants to merge 1 commit into
canopa/keyboard-shortcuts-inhibitfrom
canopa/shortcut-recording
Open

kevinard wants to merge 1 commit into
canopa/keyboard-shortcuts-inhibitfrom
canopa/shortcut-recording

Conversation

@kevinard

Copy link
Copy Markdown
Owner

Canopa fork tracking PR. Its diff against canopa/keyboard-shortcuts-inhibit (keyboard shortcut inhibition, itself on canopa/base = upstream 0.14 at 595af03) 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::recording: Recording exposes its state (Preparing, WaitingForRelease, Ready, Collecting, then a terminal Recorded(trigger), Cancelled(reason) or Closed), a bounded changes() stream, and cancel(), which revokes the attempt even while other clones or the stream are alive.
  • Inhibitor::record(), with a default Driver::record that returns None.
  • iced_winit::keyboard_shortcuts: maps the recording onto winit's Wayland KeyboardShortcutsInhibitor::record.
  • The winit pin moves from the inhibition topic to kevinard/winit canopa/wayland-shortcut-recording (9af67a54292d…), with Cargo.lock updated to match. canopa/main pins winit's canopa/main.

Why

The GlobalShortcuts editor needs a trigger that the compositor resolves in the current layout. It must be captured before ordinary dispatch, so that text inputs, repeats and dialog Escape do not react to it. See Canopa ADR 0069.

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 two Recording tests.
  • In Canopa: 87 native recording groups pass (ADR 0069).

Upstream

Nothing upstream. Canopa keeps this locally.

🤖 Generated with Claude Code

A shortcut editor cannot record a trigger from ordinary keyboard events:
they lack effective native modifiers and Num Lock, and they arrive after
text inputs and other widgets have reacted to the keys.

Add `Inhibitor::record`, which arms one source-owned `Recording` while
inhibition is actually active. The recording exposes its state
(`Preparing`, `WaitingForRelease`, `Ready`, `Collecting`, then a
terminal `Recorded(trigger)`, `Cancelled(reason)` or `Closed`), a
change stream and an explicit `cancel` that revokes it even while
other clones are alive. The `winit` shell maps it onto winit's Wayland
`KeyboardShortcutsInhibitor::record`.

Requires winit's shortcut recording; `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