Skip to content

fix: map Cmd/Meta to Ctrl on non-macOS platforms#171

Closed
kogasura wants to merge 1 commit intoarto-app:mainfrom
kogasura:fix/windows-shortcut-mapping
Closed

fix: map Cmd/Meta to Ctrl on non-macOS platforms#171
kogasura wants to merge 1 commit intoarto-app:mainfrom
kogasura:fix/windows-shortcut-mapping

Conversation

@kogasura
Copy link
Copy Markdown

@kogasura kogasura commented Apr 6, 2026

Summary

Preset keybindings use Cmd+x notation which maps to the META key on macOS. On Windows/Linux there is no Meta key equivalent, so keyboard shortcuts like Cmd+n (New Window) and Cmd+o (Open Directory) do not work.

This PR maps Cmd/Meta/Command modifiers to CONTROL on non-macOS platforms, so Cmd+n behaves as Ctrl+n on Windows/Linux.

Changes

  • desktop/src/shortcut.rs: Add #[cfg(target_os = "macos")] / #[cfg(not(target_os = "macos"))] conditional compilation for modifier mapping

Test plan

  • cargo check passes on Windows (0 errors)
  • Keyboard shortcuts (Ctrl+N, Ctrl+T, Ctrl+O, etc.) work correctly on Windows
  • No behavior change on macOS (Cmd key still maps to META)

@kogasura
Copy link
Copy Markdown
Author

kogasura commented Apr 6, 2026

Screenshots (Windows 11)

Before (main branch)

Ctrl+O does not open a file because Cmd is mapped to META (Windows key), not CONTROL:

Before: Cmd mapped to META

After (this PR)

Ctrl+O, Ctrl+N, Ctrl+T and all other Cmd+x shortcuts work correctly because Cmd is now mapped to CONTROL on Windows:

After: Cmd mapped to CONTROL

@kogasura kogasura mentioned this pull request Apr 6, 2026
9 tasks
@kogasura kogasura marked this pull request as draft April 6, 2026 00:55
Preset keybindings use "Cmd+x" notation which maps to the Meta key
on macOS. On Windows/Linux there is no Meta key, so map these to
Ctrl instead so that "Cmd+n" behaves as "Ctrl+n".

Tests use cfg!(target_os) to expect the correct modifier per platform.
@kogasura kogasura force-pushed the fix/windows-shortcut-mapping branch from 6d61da9 to 57a061b Compare April 6, 2026 10:17
@kogasura
Copy link
Copy Markdown
Author

kogasura commented Apr 6, 2026

Closing in favor of addressing the root cause first (asset loading on Windows).

@kogasura kogasura closed this Apr 6, 2026
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