When doing the to share keyboard/mouse between my and my notebook on the Librem5 still the on-screen keyboard () keeps popping up and takes away part of the small screen.

This can be disabled through gsettings but doing so each time when I place the phone beside my notebook is tiresome.

So I recovered some old proof of concept I had made, tested it and packaged it:

switch-keyboard installs an rule that triggers when an external keyboard is connected and disables the osk. On disconnect it re-enables the osk and there is an entry for the menu included to just toggle the keyboard on and off just in case you're left without after disconnecting an external keyboard.