jordansissel / xdotool

fake keyboard/mouse input, window management, and more
Other
3.18k stars 316 forks source link

Can't use xdotool to send ISO_Next_Layout #308

Closed NightH4nter closed 3 years ago

NightH4nter commented 3 years ago

Hello. I'm trying to use xdotool to switch to the desired layot. To do so, I use the command xdotool key ISO_Next_Group But it only changes the layout for a matter of second, and then the layout goes back to what it was previously. I don't know if I should report it here, but anyways.

maxnikulin commented 3 years ago

This bug looks like a variant of #123. xdotool restores Xkb group (keyboard layout) after sending a key event https://github.com/jordansissel/xdotool/blob/master/xdo.c#L1548

I think, a tool that directly calls XkbLockGroup is actually required. Notice that Xkb methods to change layout do not work in gnome due to the commit https://gitlab.gnome.org/GNOME/mutter/-/commit/2857fdbdb8 (and later one that moved the code to other file) so gnome shell methods must be called through dbus to change keyboard layout.

Do not you mean ISO_Next_Group, not ISO_Next_Layout?

P.S. xvkbd -text ... with keys assigned to change layout (not ISO_...) works so such command could be used as a quick workaround.

NightH4nter commented 3 years ago

Do not you mean ISO_Next_Group, not ISO_Next_Layout?

Yeah, of course, it was my mistake. Actually I've found a solution to bind switching the layout with a keyboard shortcut - xkb-switch. So, thanks for reply, and I guess, this is no longer an issue. Closing.