Skip to content

feat(android,ios): add custom shortcuts and a shortcut panel on the keyboard - #97

Merged
sqlpxc merged 8 commits into
sqlpxc:mainfrom
Dlouxgit:feature/mobile-shortcut-editor
Dec 3, 2026
Merged

sqlpxc merged 8 commits into
sqlpxc:mainfrom
Dlouxgit:feature/mobile-shortcut-editor

Conversation

@Dlouxgit

@Dlouxgit Dlouxgit commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

What changes

When controlling a computer (Windows / macOS / Linux) from the Android or iOS app:

  • Your own shortcuts. The shortcuts in the menu (Keyboard & input → Shortcuts) can be edited: add your own key combinations, rename a shortcut or change its keys, move shortcuts up and down, and delete the ones you added (built-in ones can be edited but not deleted).
    • Up to 4 keys, keyboard keys only (no mouse, wheel or gamepad buttons). Modifiers are pressed first however they were picked, so picking C and then Ctrl still gives Ctrl+C. When the name is empty, picking keys fills it in.
    • Saved on the controller, separately for each remote OS (⌘C copies on a Mac, Ctrl+C on Windows / Linux). Built-in names follow the app language until you rename them. Built-in shortcuts added in later versions are appended to a list you've already saved.
  • Keyboard and shortcuts in one place. A Shortcuts key at the right end of the extra keys row swaps the system keyboard for a panel of shortcut buttons at the same height, with the same Add / Edit. The key then reads Keyboard and switches back. The extra keys row stays visible in both modes, and the menu and the panel share one list.
  • Linux built-ins are now the Windows list without the Win-key and Task Manager entries; before, Linux got the full Windows list.
  • Android: when controlling a computer, the extra keys row now shows whenever the keyboard is open, even with a hardware keyboard and no soft keyboard. Game keys and nav keys no longer disappear in that case.
  • Game key picker: Win, right Win and PrintScreen can now be bound as well.

The host, relay and protocol are unchanged. Shortcuts are sent as ordinary key presses (Input.chord).

Implementation

  • Data: shortcuts.json on the controller, { "<os>": [{ id, title, codes }] }. Only OSes you've changed are stored. Built-in ids are their string keys, and custom ids start with custom:.
    • Android: data/Shortcuts.kt, where ShortcutStore exposes a StateFlow.
    • iOS: Session/Shortcuts.swift, where ShortcutStore.shared is an @Observable.
  • UI:
    • Android: KeysBar gets the toggle key and the panel underneath. Shortcuts is the one composable for both the menu list and the panel, and ShortcutDialog is the editor.
    • iOS: KeyBar gets the toggle key. The panel (ShortcutInputPanel) becomes the text field's inputView, with the extra keys row inside it so there's no gap, sized to the last system keyboard. ShortcutsPage is the menu list.
  • The existing game KeyPicker gains a keyboard-only mode (keyboardOnly, maxKeys).

Testing

  • Android, merged with current main: compileDebugKotlin builds without warnings, and testDebugUnitTest passes (190 tests, including the new ShortcutsTest).
    • On an emulator, using a temporary preview screen that isn't committed, I checked:
      • the panel toggle
      • edit mode (readable text, up/down, delete only for custom items)
      • adding a shortcut (keys get reordered, the name is filled in)
      • picker groups (no mouse or gamepad)
      • ⌘ / ⌥ labels for a Mac
      • the key events a shortcut sends
    • Not checked: switching between the soft keyboard and the panel in a live session.
  • iOS:
    • The first version of this PR, with tabs and swipe gestures, was built and tried on an iPhone 15 Pro by @Dlouxgit.
    • The rework was only checked with Swift 5.10 on Linux: all changed files parse, and the shortcut model and test logic compile and pass. The reworked SwiftUI / UIKit code hasn't been built with Xcode yet. Please build it and try it on a device before the next release.

中文说明

控制电脑时(Android / iOS):

  • 自定义快捷键:菜单 → 键盘与输入 → 快捷键 里可以添加自己的组合键,改名字和按键,上下移动顺序,删掉自己加的(内置的可以改,不能删)。
    • 最多 4 个键,只能选键盘上的键。修饰键会自动放在前面。名字空着时,选完键会自动填上。
    • 列表存在控制端,按被控端的系统分开存。内置快捷键的名字跟着语言变;以后版本新加的内置快捷键会追加到已保存列表的最后。
  • 键盘和快捷键合在一处:特殊键那一排最右边多了“快捷键”键,点一下把系统键盘换成一样高的快捷键面板(也能添加、编辑);这时它变成“键盘”,点了换回来。特殊键一直在,菜单和面板看的是同一份列表。
  • Linux 内置快捷键:现在是 Windows 那份去掉 Win 系列和任务管理器(以前 Linux 用的是整份 Windows 列表)。
  • Android:控制电脑时,键盘一打开就显示特殊键那一排,接着实体键盘、没弹出系统键盘时也一样。这时游戏按键和导航键不会再消失后回不来。
  • 游戏按键的选键器:也可以选 Win、右 Win 和 PrintScreen。

被控端、中继和协议都没改,快捷键还是用现有的按键协议发出去。测试情况见上面的 Testing。iOS 改版后的界面代码还没有用 Xcode 编译过,发版前需要编译一次、在真机上试一下。

@Dlouxgit Dlouxgit changed the title 移动端快捷键支持自定义、编辑与排序 / Editable mobile shortcuts Draft: 移动端快捷键支持自定义、编辑与排序 / Editable mobile shortcuts Nov 30, 2026
@Dlouxgit Dlouxgit changed the title Draft: 移动端快捷键支持自定义、编辑与排序 / Editable mobile shortcuts 移动端快捷键支持自定义、编辑与排序 / Editable mobile shortcuts Nov 30, 2026
@Dlouxgit Dlouxgit changed the title 移动端快捷键支持自定义、编辑与排序 / Editable mobile shortcuts feat: 移动端快捷键支持自定义、编辑与排序 / Editable mobile shortcuts Dec 1, 2026
@Dlouxgit Dlouxgit changed the title feat: 移动端快捷键支持自定义、编辑与排序 / Editable mobile shortcuts feat(client): 移动端快捷键支持自定义、编辑与排序 / Editable mobile shortcuts Dec 1, 2026
@sqlpxc sqlpxc changed the title feat(client): 移动端快捷键支持自定义、编辑与排序 / Editable mobile shortcuts feat(android,ios): add custom shortcuts and a shortcut panel on the keyboard Dec 3, 2026
@sqlpxc
sqlpxc merged commit 48a4e43 into sqlpxc:main Dec 3, 2026
2 checks passed
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.

2 participants