Skip to content

Add opt-in keyboard swipe shortcuts#5

Merged
AsafMah merged 12 commits into
mainfrom
copilot/implement-keyboard-shortcuts
May 26, 2026
Merged

Add opt-in keyboard swipe shortcuts#5
AsafMah merged 12 commits into
mainfrom
copilot/implement-keyboard-shortcuts

Conversation

Copilot AI commented May 22, 2026

Copy link
Copy Markdown

The shortcut-layer concept is reduced to direct, opt-in swipe actions because top/bottom edge swipes only expose one row of usable targets. This adds undo/redo and emoji shortcuts without introducing temporary keyboard layers.

  • Settings

    • Added opt-in controls for:
      • Backspace up/down swipe
      • Top-row swipe-up action
      • Emoji-key swipe
    • Defaults remain off.
  • Swipe actions

    • Backspace swipe up triggers undo.
    • Backspace swipe down triggers redo.
    • Emoji-key swipe up opens the emoji palette.
    • Top-row swipe up supports configurable direct actions: none, undo, redo, or emoji.
  • Gesture handling

    • Reuses existing key-code dispatch paths for undo/redo/emoji.
    • Preserves existing horizontal backspace delete swipe and spacebar swipe behavior.
    • Caches top-row eligibility from touch-down to avoid scanning keys on every move.

Copilot AI and others added 3 commits May 22, 2026 03:23
Agent-Logs-Url: https://github.com/AsafMah/LeanType/sessions/361e11ed-94d0-447f-b61f-f6ce16ce71ad

Co-authored-by: AsafMah <6424271+AsafMah@users.noreply.github.com>
Agent-Logs-Url: https://github.com/AsafMah/LeanType/sessions/361e11ed-94d0-447f-b61f-f6ce16ce71ad

Co-authored-by: AsafMah <6424271+AsafMah@users.noreply.github.com>

Copilot AI 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.

Pull request overview

Adds opt-in swipe-based “shortcut” actions (undo/redo/emoji) to the keyboard without introducing a dedicated shortcut layer, configured via new gesture-typing settings.

Changes:

  • Added new gesture settings for backspace up/down swipe, emoji-key swipe, and configurable top-row swipe-up action (defaults off / none).
  • Wired new preferences into settings storage (Defaults, Settings, SettingsValues) including mapping top-row action strings to key codes.
  • Extended PointerTracker swipe handling to dispatch undo/redo/emoji codes and to recognize top-row swipe-up shortcuts.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
app/src/main/res/values/strings.xml Adds user-facing titles/summaries for the new swipe shortcut settings.
app/src/main/java/helium314/keyboard/settings/screens/GestureTypingScreen.kt Exposes the new preferences in the Gesture settings screen (switches + list preference).
app/src/main/java/helium314/keyboard/latin/settings/SettingsValues.java Adds stored runtime settings values for the new swipe shortcut toggles and top-row action key code.
app/src/main/java/helium314/keyboard/latin/settings/Settings.java Defines new preference keys and adds a reader to map top-row action selection to a KeyCode.
app/src/main/java/helium314/keyboard/latin/settings/Defaults.kt Adds defaults for the new swipe shortcut preferences (off/none).
app/src/main/java/helium314/keyboard/keyboard/PointerTracker.java Implements the new swipe gesture behaviors (backspace up/down, emoji swipe up, top-row swipe up shortcut).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1347 to +1356
private boolean isTopVisibleRowKey(final Key key) {
if (key == null || mKeyboard == null || key.isSpacer() || !key.isEnabled()) {
return false;
}
int top = Integer.MAX_VALUE;
for (final Key candidate : mKeyboard.getSortedKeys()) {
if (!candidate.isSpacer() && candidate.isEnabled() && candidate.getHeight() > 0) {
top = Math.min(top, candidate.getY());
}
}
Comment on lines +1360 to +1365
private boolean tryHandleTopRowSwipe(final Key key, final int x, final int y) {
if (mShortcutSwipeConsumed) {
return true;
}
final int actionCode = Settings.getValues().mTopRowSwipeUpKeyCode;
if (actionCode == KeyCode.UNSPECIFIED || !mStartedOnTopRow || sInGesture) {
- isTopVisibleRowKey: skip computation when setting disabled; use first
  eligible key from sorted list (O(1) instead of O(n) scan)
- tryHandleTopRowSwipe: exclude modifier keys so SHIFT/SYMBOL/ALPHA/NUMPAD
  always complete their normal press/release flow

Agent-Logs-Url: https://github.com/AsafMah/LeanType/sessions/4a8fd5b5-0a68-45de-affc-8699d4563ec3

Co-authored-by: AsafMah <6424271+AsafMah@users.noreply.github.com>

Copilot AI commented May 22, 2026

Copy link
Copy Markdown
Author

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl.google.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -XX:MaxMetaspaceSize=384m -XX:&#43;UseParallelGC -Xmx1536m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from AsafMah May 22, 2026 03:51
lurebat and others added 8 commits May 22, 2026 20:48
Remove the direct-action top-row/backspace/emoji swipe shortcut implementation because it does not match the agreed direction for shortcut rows/layers.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Implement opt-in top and bottom shortcut rows using existing layout parsing and popup-key slide-to-select behavior instead of hardcoded direct actions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Anchor bottom shortcut row popups below the source key while preserving the normal above-key placement for top rows and long-press popups.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove duplicate ToolbarUtils imports introduced by the main merge and record the shortcuts branch install validation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@AsafMah
AsafMah marked this pull request as ready for review May 26, 2026 06:05
@AsafMah
AsafMah merged commit 0b6d3ca into main May 26, 2026
1 check 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.

4 participants