Skip to content

Add Cmd-W close shortcut on macOS#24

Open
dimifontaine wants to merge 1 commit into
HazAT:mainfrom
dimifontaine:add-cmd-w-close
Open

Add Cmd-W close shortcut on macOS#24
dimifontaine wants to merge 1 commit into
HazAT:mainfrom
dimifontaine:add-cmd-w-close

Conversation

@dimifontaine

Copy link
Copy Markdown

Summary

Adds native macOS ⌘W handling to close Glimpse windows.

Why

I use Glimpse mostly as a lightweight viewer from a full-screen CLI workflow. It lets me preview web/content without feeling like I am switching environments, but closing the window currently requires reaching for the mouse because ⌘W does not close the Glimpse window.

On macOS, ⌘W is the expected keyboard shortcut for closing the current window, so supporting it makes Glimpse feel more natural for keyboard-driven workflows.

Implementation

The change is intentionally minimal:

  • keeps the existing key-equivalent guard unchanged;
  • adds a ⌘W branch in GlimpsePanel.performKeyEquivalent;
  • calls close(), reusing the existing close/window lifecycle.

Existing ⌘C, ⌘V, ⌘A, ⌘Z, and ⇧⌘Z behavior is unchanged.

Tests

  • npm run build:macos
  • npm test
  • npm run test:keyboard

Also manually tested opening a Glimpse window on macOS and closing it with ⌘W.

Handle the standard macOS Cmd-W window-close shortcut in GlimpsePanel while preserving the existing key-equivalent behavior for editing shortcuts.

Add an opt-in macOS keyboard integration test that sends Cmd-W through System Events and waits for the closed event.
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