Virtual keyboard changes system keyboard layout under sway - why?

Dorota Czaplejewicz dorota.czaplejewicz at
Mon Apr 6 14:22:28 UTC 2020

Hello Justus,

On Mon, 06 Apr 2020 14:36:03 +0200
Justus-dev at wrote:

> Hello,
> In my quest for an on-screen keyboard (OSK) for sway, the closest I've
> found are Purism's squeekboard and virtboard.  They both use the Wayland
> virtual keyboard protocol.  Surprisingly (to me), they affect my
> installed keyboard layout:
> 1. They install a session-wide keyboard layout and leave it behind, at
>    least if terminated improperly.
> 2. Afterwards, I cannot reset my keyboard layout using 'swaymsg input
>    ... xkb_layout de'; it silently runs without taking effect.
>    Running 'swaymsg reload' does restore it though.
> The second phenomenon is surely a defect? In sway, wlroots, or
> {virt|squeek}board? Or is it just that I am trying to abuse Purism's
> OSKs outside their purpose of serving as the only keyboard present on a
> system?
The OSKs are meant to be universal as much as possible, and not tied to any particular system (just Wayland).

> How about the first point? In my naive world view, the OSK should use
> any layout I tell it to use, but it should leave intact the layout of
> any other keyboard I happen to have on my system.  I can attach an
> external keyboard with en_US layout to my laptop with de layout.  Why
> can't I additionally run a French azerty OSK? And yet another Greek
> OSK at the same time?
My understanding of how layouts work on Linux is a bit different than what you present here. I've observed that there is a global layout switch, and with multiple physical keyboards, I found that switching the layout affects all of them. Therefore, to make the on-screen keyboard work "as expected", I decided to make it follow that central authority (gnome input method setting).

Following the central authority only works well when it's done consistently, so I tied the keyboard language switch back to the system layout. This is simpler than having a different global layout and a different layout for a single keyboard, and hopefully spares users confusion (e.g. "I selected de in the system settings but my keyboard is still ru").

Frankly, what you're saying sounds sensible, but I don't know how to solve it on the application level without making things overly complicated. If you do, then the best channel to discuss that would be the Squeekboard issue tracker:

> I clearly lack understanding of how Wayland input protocols work, and
> hope someone over here will enlighten me.  In particular, is the
> behavior I describe above intentional or accidental?
> My motivation is that I am trying to understand what it minimally takes
> to inject characters into applications under Wayland (specifically
> sway).  For example, for my touchscreen I would like to have an OSK and
> dasher [1].  For my scripted password manager, formerly based on
> xdotool, I wrote uinputchars [2], which works perfectly for me but is
> only a crutch until I have a proper Wayland solution.
The solutions are the virtual-keyboard protocol
and the input-method protocol
which depends on the text-input protocol


> Thanks,
> Justus
> [1]
> [2]
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the wayland-devel mailing list