Skip to content

feat(desktop-gpui): reliable shortcuts with after-capture choices - #2559

Merged
richiemcilroy merged 9 commits into
mainfrom
feat/gpui-shortcuts-after-capture
Oct 14, 2026
Merged

richiemcilroy merged 9 commits into
mainfrom
feat/gpui-shortcuts-after-capture

Conversation

@richiemcilroy

@richiemcilroy richiemcilroy commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Global shortcuts in the GPUI app had two bugs. A screenshot shortcut pressed from another app opened the editor behind that app, and the Start Studio/Instant shortcuts failed with target_display_crop: Display not found. This PR fixes both and rebuilds the Shortcuts page, so each shortcut says what it will do and you choose what happens after a capture.

Bugs

  • Screenshot editor opened behind the frontmost app. A global shortcut fires while another app is active, and open_screenshot_editor never activated Cap. The window opened, but stayed hidden until you clicked into Cap. bring_screenshot_editor_forward (apps/desktop-gpui/src/app_windows.rs:6647) activates the app and the window on both the new-window and refocus paths.
  • Start shortcuts recorded a stale target. They read recording_settings.target from the shared store, which this app never wrote, so it still held whatever the Tauri app recorded last. On the reporting machine that was a window that no longer existed. Starts now pick a target that exists, and every recording start saves its target (apps/desktop-gpui/src/main_window.rs:2138).
flowchart LR
    A[Start shortcut] --> B{Main window selection exists?}
    B -- yes --> R[Record it]
    B -- no --> C{Last recorded target exists?<br/>camera-only skipped}
    C -- yes --> R
    C -- no --> D[Display under the pointer] --> R
Loading

pick_hotkey_target (apps/desktop-gpui/src/hotkeys.rs:887) is pure, with liveness and the fallback injected, so the stale-window case is covered by a test. target_is_live (hotkeys.rs:903) treats a window as recordable only when it still has a display, which is the lookup that failed. Both run on the background executor because they enumerate windows.

After a capture

New postScreenshotBehaviour setting (apps/desktop-gpui/src/store.rs:670), and a doNothing value for postStudioRecordingBehaviour:

Setting Options
After a screenshot Open editor (default), Copy, Copy and edit, Do nothing
After a Studio recording Open editor (default), Show Cap, Do nothing
After an Instant recording Open link (default), Copy link only (the existing disableAutoOpenLinks)
  • screenshot_finished (app_windows.rs:6490) copies the PNG to the clipboard and/or opens the editor. For copy or do nothing, the main window comes back only if it was on screen before the picker hid it, so a shortcut pressed from another app leaves that app in front.
  • Studio "Do nothing" keeps the recording in the library and leaves Cap hidden. Failed recordings and Instant recordings still bring the main window back.

Shortcuts page

Before After
One flat list of 11 actions with NONE pills, no description of what each does, and the post-capture settings elsewhere or missing Shortcuts settings
  • Grouped into Screenshots, Recording and While recording. Start Studio and Start Instant recording were always bindable but were not listed before.
  • Live descriptions: each row describes what pressing it does, built from the current settings and mode (shortcut_effect, apps/desktop-gpui/src/settings_pages.rs:1080). After a save, the row confirms with "Saved. Press ⌘⇧4 in any app to ...".
  • After-capture panel: the choices sit in a panel at the foot of each group, with every option visible as a card (render_outcome_panel, settings_pages.rs:1579).
  • No layout shift: descriptions that quote a choice reserve two lines (description_follows_outcome, settings_pages.rs:1118), so picking an option never moves the panel.
  • Recording a combo:
    • Global hotkeys are paused while a combo is recorded (hotkeys::pause / resume, hotkeys.rs:202), so an existing binding is captured instead of firing. Every exit path resumes them: Escape, a click elsewhere, a page change, the window losing focus or closing.
    • A combo needs ⌘, ⌃ or ⌥ unless it is an F-key.
    • Taking a combo another action uses moves it and says where it came from.
    • Combos the OS refuses are flagged on their row (hotkeys::unavailable_actions, hotkeys.rs:229).
fn shortcut_needs_modifier(hotkey: &Hotkey) -> bool {
    !(hotkey.meta || hotkey.ctrl || hotkey.alt) && !is_function_key(&hotkey.code)
}

Settings controls

  • Off toggles were a white knob on a near-white track on a white card. The settings toggle track is now a neutral gray (apps/desktop-gpui/src/ui/toggle.rs:84).
  • Unchecked radio dots get a visible outline.

postScreenshotBehaviour and postStudioRecordingBehaviour: "doNothing" are written only by this app. The Tauri app no longer ships.

RetriggerConfidence Score: 5/5

The latest changes appear safe to merge.

Summary

This PR fixes screenshot editor focus and stale recording targets. It also rebuilds the Shortcuts page and adds after-capture choices.

  • The Shortcuts page explains and lets people change all 13 global shortcuts.
  • Start shortcuts choose a recording target that still exists.
  • People choose what Cap does after a screenshot or recording.
  • Off toggles and unchecked radio buttons are easier to see.

Reviews (3) · Last reviewed commit: "fix(desktop-gpui): clear the blocked sho..." · Reviewed by Greptile

@vercel

vercel Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cap-status Ready Ready Preview Oct 14, 2026 6:48am UTC

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capy found no issues.

View 3 other findings in Capy.

Open in Capy

Comment thread apps/desktop-gpui/src/hotkeys.rs
Comment thread apps/desktop-gpui/src/hotkeys.rs Outdated
Comment thread apps/desktop-gpui/src/settings_pages.rs Outdated
@richiemcilroy

Copy link
Copy Markdown
Member Author

hey @greptileai, please re-review the PR

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capy found no issues.

View 3 other findings in Capy.

Open in Capy

Comment thread apps/desktop-gpui/src/settings_pages.rs Outdated
@richiemcilroy

Copy link
Copy Markdown
Member Author

hey @greptileai, please re-review the PR

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capy found no issues.

View 1 other finding in Capy.

Open in Capy

This branch was successfully deployed

2 active deployments
Preview – cap-web — c8a1d13b Deployed Oct 14, 2026 by vercel[bot]
Preview – cap-status — c8a1d13b Deployed Oct 14, 2026 by vercel[bot]
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