feat: add --shortcut-key option to customize shortcut key bindings - #6872
Open
muxueqz wants to merge 3 commits into
Open
feat: add --shortcut-key option to customize shortcut key bindings#6872muxueqz wants to merge 3 commits into
muxueqz wants to merge 3 commits into
Conversation
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
|
done |
|
done |
aalmanasir
approved these changes
May 29, 2026
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduce a new CLI option
--shortcut-key=action=keythat allows usersto override individual shortcut keys (e.g.,
--shortcut-key=paste=d,--shortcut-key=home=j). This also solves the issue where shortcut keysconflict 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:
struct sc_shortcut_key_bindingsin options.h with per-action key fieldsif (sdl_keycode == keys->xxx)blocks viasc_shortcut_key_bindingsreturn;so unrecognized shortcut keys pass throughto the device
--shortcut-keyparsing in cli.c with conflict detection