Skip to content

A quick-settings toggle for the on-screen keyboard that only shows while a physical keyboard is connected #756

Open

Description

@Somnius

When a Bluetooth or USB keyboard is connected, the on-screen keyboard still pops up when a text field takes focus. I'd like a quick-settings toggle that shows or hides it, available only while a physical keyboard is connected. I read the code first and found most pieces, so here is what I found and what I'd build, before I write it.

What is there:

  • A keyboard tile already exists (TilesModel.js and QuickSettings.qml, around lines 1253 to 1287). It calls sm.puri.OSK0 SetVisible through busctl, and it is available whenever squeekboard answers on the bus.
  • SetVisible false only folds the keyboard: squeekboard shows it again when a text field takes focus. A lasting off needs the gsettings key screen-keyboard-enabled set to false, and omamobile-osk-guard turns it back on, and hypr/phone.lua sets it true at start.
  • Squeekboard doesn't detect hardware keyboards itself. Its "physical keyboard present" state is just the inverse of that gsettings key (server-context-service.c in 1.43.1), so detecting the keyboard is the shell's job.
  • Nothing in omamobile-shell looks for a hardware keyboard: no udev, libinput or hyprctl devices use (omamobile-doubletap reads the sysfs capabilities, but only to find the touchscreen). And BoundTile only dims a tile that is unavailable, it can't hide one.

What I'd build, as two small PRs:

  1. An omamobile-hwkbd-watch helper that prints keyboard true or keyboard false on connect and disconnect, wired the way omamobile-osk-watch is. A device counts as a keyboard when its capabilities include the letter keys and it is on a USB or Bluetooth bus, which should leave out the volume and power keys, the touchscreen, the haptics input and the AVRCP device (kernel config: Bluetooth LE mice and keyboards, and headphone buttons #304). A fake-sysfs test for it. The lasting off would be the gsettings key set to false, and SetVisible true still shows the keyboard when someone asks for it.
  2. The tile shown only while the helper says true, a filter in TilesModel for that, and a "user chose off" marker that omamobile-osk-guard respects.

One thing I want to get right: if the keyboard is hidden and the physical keyboard then disconnects, the phone would have no way to type. So the marker has to be cleared, and the keyboard shown again, whenever the physical keyboard goes away.

What I don't know and need the phone for: what the real devices report as capabilities and bus, how squeekboard behaves with a hardware keyboard under Hyprland, whether the layout reflows when it hides, and whether a Bluetooth keyboard works on the 8 Pro at all (Bluetooth there is new: derekross/linux-omarchy-mobile#199 is merged, and #752 is still open). @derekross, @greenbrettmichael, would you want this at all, and if so is this how you'd want it split?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions