Skip to content

feat: hide the key bar while a physical keyboard is connected - #8

Closed
andreas-byfut wants to merge 1 commit into
LordOfPolls:masterfrom
andreas-byfut:feat/hide-key-bar-with-hardware-keyboard
Closed

andreas-byfut wants to merge 1 commit into
LordOfPolls:masterfrom
andreas-byfut:feat/hide-key-bar-with-hardware-keyboard

Conversation

@andreas-byfut

Copy link
Copy Markdown
Contributor

With a physical keyboard attached, the on-screen Ctrl, Alt, Esc and arrow keys only take up
terminal rows. The key bar now hides itself while a keyboard is connected.

  • Detection: a keyboard counts if Configuration.keyboard reports one, or if there is any
    enabled, non-virtual, alphabetic InputDevice. An InputDeviceListener keeps this live as
    devices come and go.
    • An external keyboard counts regardless of hardKeyboardHidden. With "Show on-screen keyboard
      while physical keyboard is active" on, the window manager reports HARDKEYBOARDHIDDEN_YES
      for it.
    • That veto still applies to the configuration and to built-in keyboards, which covers a closed
      lid or slider.
  • Setting: hideKeyBarWithHardwareKeyboard, a switch under the key bar settings that also
    shows whether a keyboard is currently detected. It is included in config export and import.
  • Session menu: a Hide/Show key bar entry in the ⋮ menu, shown while a keyboard is detected.
  • Latches: a latched Ctrl or Alt is cleared when the bar hides.
  • Default: on, so it works without setup. The ⋮ menu entry is the escape hatch for devices
    that wrongly report a keyboard. If you prefer it off by default, that is a one-word change in
    getHideKeyBarWithHardwareKeyboard.

Tested on a tablet with a keyboard on a USB-C hub. Tests: PhysicalKeyboardTest,
ConfigImportTest.

With a physical keyboard attached the on-screen Ctrl, Alt, Esc and arrow keys
only take up terminal rows. The key bar now hides itself then, on by default,
with a switch under the key bar settings and a Hide/Show key bar entry in the
session menu for devices that falsely report a keyboard. The setting is part of
config export and import, and the settings switch says whether a keyboard is
detected.

Detection counts `Configuration.keyboard` as well as any enabled, non-virtual,
alphabetic `InputDevice`, kept live with an `InputDeviceListener`, since tablet
keyboard covers, some Bluetooth keyboards and OEM skins never set the
configuration. An external keyboard counts regardless of `hardKeyboardHidden`:
with "Show on-screen keyboard while physical keyboard is active" on, the window
manager reports `HARDKEYBOARDHIDDEN_YES` for it. That veto still applies to the
configuration and to built-in keyboards, which covers a closed lid or slider.

A Ctrl or Alt latch is cleared when the bar hides, so it cannot linger unseen.
@LordOfPolls

Copy link
Copy Markdown
Owner

Believe this is superseded by dev branch 5bc4a6f

ref. #3

I do, however, like your use of InputDevice over my impl, so i will port that over into that branch.

additional. your change is failing on CI - however given the above, i wont be merging this in.

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