StarLabsLtd / firmware

78 stars 5 forks source link

[StarLite Mk V] Detaching the Keyboard doesn't enter Tablet Mode #198

Closed bR3iN closed 4 months ago

bR3iN commented 4 months ago

I'm not 100% sure if this is a firmware issue, so I hope this is the right place for this.

I'd like to react in Sway to the removal of the detachable keyboard (e.g. to launch an on-screen keyboard), for which Sway conveniently has bindswitch tablet:(on|off) ... commands. However, Sway doesn't seem to recognize the keyboard removal as entering tablet mode.

Some surface-level digging led me to libinput debug-events; on my Thinkpad Yoga 370, for which entering tablet mode is properly recognized by Sway (which here means folding the keyboard onto the screen's back), this yields the following two events for entering and leaving tablet mode:

-event9   SWITCH_TOGGLE           +1.217s   switch tablet-mode state 1
-event9   SWITCH_TOGGLE           +3.427s   switch tablet-mode state 0

On my Starlite 5, these events are missing when detaching and reattaching the keyboard, which sounds like a possible explaination for why Sway doesn't recognize this as entering and leaving the tablet mode, respectively. I guess I could achieve the desired behaviour also with udev rules, but it would be nice to be able to use the builtin functionality of Sway for this.

The underlying OS is OpenSUSE Tumbleweed. On a possibly related note, I also tried a Pop!_OS 22.04 live OS I had laying around and interestingly enough, there the removal of the keyboard enables the on-screen keyboard (without tablet mode events in libinput debug-events).

Edit: greping briefly through the sway and wlroots source code, Sway's tablet:(on|off) bindings do really nothing else than listening for LIBINPUT_SWITCH_TABLET_MODE events.

Sean-StarLabs commented 4 months ago

Fixed with 1f96cdd3316c7283c38771c71768c80d433ebd83