Skip to content

Add keyboard showing/not showing constraints for key mappings#1879

Merged
sds100 merged 4 commits intodevelopfrom
copilot/add-key-map-constraint
Nov 15, 2025
Merged

Add keyboard showing/not showing constraints for key mappings#1879
sds100 merged 4 commits intodevelopfrom
copilot/add-key-map-constraint

Conversation

Copy link
Contributor

Copilot AI commented Nov 2, 2025

Adds constraints to trigger key mappings based on on-screen keyboard visibility. User requested ability to trigger actions like "select word at cursor" only when the keyboard is open.

Changes

Constraint Data & Persistence

  • Added KEYBOARD_SHOWING and KEYBOARD_NOT_SHOWING to ConstraintId enum
  • Added KeyboardShowing and KeyboardNotShowing data objects in ConstraintData
  • Added entity constants "keyboard_showing" and "keyboard_not_showing" with bidirectional mapping

UI Components

  • Icons: Icons.Outlined.Keyboard (showing) and Icons.Outlined.KeyboardHide (not showing)
  • Strings: "On-screen keyboard is visible" / "On-screen keyboard is hidden"
  • Added to constraint selection list after IME constraints with click handlers

Detection Infrastructure

  • Added KEYBOARD_STATE to ConstraintDependency enum for state change tracking
  • Added placeholder detection in DetectConstraintsUseCase and LazyConstraintSnapshot
  • Currently returns false - actual keyboard detection left for follow-up implementation

Testing

  • Added isKeyboardShowing parameter to TestConstraintSnapshot
  • Added 4 unit tests validating constraint satisfaction for both states

Implementation Note

The UI flow and data structures are complete. Actual keyboard state detection (via InputMethodManager or WindowInsets API) is intentionally left as TODO placeholders for separate implementation:

// DetectConstraintsUseCase.kt (line ~82)
ConstraintDependency.KEYBOARD_STATE -> 
    // TODO: Implement keyboard state detection
    flowOf(dependency)

// LazyConstraintSnapshot.kt (line ~61)
private val isKeyboardShowing: Boolean by lazy { false }  // TODO: Implement

Files modified: 12 (+96 lines)

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 --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 -Xmx2048M -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.11.1-bin/bpt9gzteqjrbo1mjrsomdt32c/gradle-8.11.1/lib/gradle-daemon-main-8.11.1.jar -javaagent:/home/REDACTED/.gradle/wrapper/dists/gradle-8.11.1-bin/bpt9gzteqjrbo1mjrsomdt32c/gradle-8.11.1/lib/agents/gradle-instrumentation-agent-8.11.1.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 8.11.1 (dns block)

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

Original prompt

This section details on the original issue you should resolve

<issue_title>Add Constraint - When keyboard is showing</issue_title>
<issue_description>Developer TODO (don't remove)

  • update documentation

Maybe there is a way already to do this? I want to use something like 'select word at cursor' but only when the on screen keyboard is open.</issue_description>

<agent_instructions>Add a new key map constraint for when the on-screen keyboard is showing (and one for not showing).

Don't create the actual logic to detect whether the keyboard is showing or not, I'll do that part. Just make the icon, list items etc for the constraints UI flow</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits November 2, 2025 14:41
Co-authored-by: jambl3r <54366245+jambl3r@users.noreply.github.com>
Co-authored-by: jambl3r <54366245+jambl3r@users.noreply.github.com>
Co-authored-by: jambl3r <54366245+jambl3r@users.noreply.github.com>
Copilot AI changed the title [WIP] Add key map constraint for on-screen keyboard Add keyboard showing/not showing constraints for key mappings Nov 2, 2025
Copilot AI requested a review from jambl3r November 2, 2025 14:50
@sds100 sds100 merged commit 606fce1 into develop Nov 15, 2025
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.

Add Constraint - When keyboard is showing

3 participants