Skip to content

feat: add --shortcut-key option to customize shortcut key bindings - #6872

Open
muxueqz wants to merge 3 commits into
Genymobile:masterfrom
muxueqz:master
Open

feat: add --shortcut-key option to customize shortcut key bindings#6872
muxueqz wants to merge 3 commits into
Genymobile:masterfrom
muxueqz:master

Conversation

@muxueqz

@muxueqz muxueqz commented May 28, 2026

Copy link
Copy Markdown

Introduce a new CLI option --shortcut-key=action=key that allows users
to override individual shortcut keys (e.g., --shortcut-key=paste=d,
--shortcut-key=home=j). This also solves the issue where shortcut keys
conflict with app shortcuts like Gboard's Alt+V — since an unmatched key
now falls through to the device instead of being swallowed by the catch-all
return.

Changes:

  • Add struct sc_shortcut_key_bindings in options.h with per-action key fields
  • Set default bindings in options.c matching the original hardcoded values
  • Convert the large switch statement in input_manager.c to a chain of
    if (sdl_keycode == keys->xxx) blocks via sc_shortcut_key_bindings
  • Remove the catch-all return; so unrecognized shortcut keys pass through
    to the device
  • Add --shortcut-key parsing in cli.c with conflict detection
  • Add tests in test_cli.c for the new option
  • Update documentation in shortcuts.md and shell completions

muxueqz and others added 2 commits May 28, 2026 20:05
Introduce a new CLI option `--shortcut-key=action=key` that allows users
to override individual shortcut keys (e.g., `--shortcut-key=paste=d`,
`--shortcut-key=home=j`). This also solves the issue where shortcut keys
conflict with app shortcuts like Gboard's Alt+V — since an unmatched key
now falls through to the device instead of being swallowed by the catch-all
return.

Changes:
- Add `struct sc_shortcut_key_bindings` in options.h with per-action key fields
- Set default bindings in options.c matching the original hardcoded values
- Convert the large switch statement in input_manager.c to a chain of
  `if (sdl_keycode == keys->xxx)` blocks via `sc_shortcut_key_bindings`
- Remove the catch-all `return;` so unrecognized shortcut keys pass through
  to the device
- Add `--shortcut-key` parsing in cli.c with conflict detection
- Add tests in test_cli.c for the new option
- Update documentation in shortcuts.md and shell completions

Co-Authored-By: AtomCode (deepseek-v4-flash) <noreply@atomgit.com>
Remove three static camera functions (camera_set_torch, camera_zoom_in,
camera_zoom_out) that were defined but never called, eliminating
-Wunused-function warnings.

Cast sdl_keycode to int32_t and add cast when comparing with
im->last_keycode to fix -Wsign-compare warnings (SDL_Keycode is
uint32_t, shortcut key codes are int32_t).

Co-Authored-By: AtomCode (deepseek-v4-flash) <noreply@atomgit.com
@aalmanasir

Copy link
Copy Markdown

done

@aalmanasir aalmanasir 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.

done

@aalmanasir

Copy link
Copy Markdown

done

…to device

When a shortcut modifier key (Win/Alt/Ctrl, configured in shortcut_mods)
is pressed alone, it was forwarded to the Android device, triggering
unwanted system actions (e.g. Win key opens the overview/recent apps
screen on some Android devices).

Fix: at the end of the `if (is_shortcut)` block, check if the key itself
is a shortcut modifier key; if so, consume it (return) rather than
letting it fall through to the key forwarding path.

Co-Authored-By: AtomCode (deepseek-v4-flash) <noreply@atomgit.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants