Score:0

Configure separate shortcut keys to switch keyboard layout of current window

in flag

Using Ubuntu 22.04 with Cinnamon.

I want to configure separate shortcut-keys (for each keyboard layout) to switch the keyboard layout of the current window.

I use the gsettings or system-settings to configure my keyboard layouts.

  • switch keyboard layout for each window separately
  • and cycle with shortcut key ctrl_left+ctrl_right.
gsettings set org.gnome.libgnomekbd.keyboard layouts "['us', 'il', 'br', 'gr']"
gsettings set org.gnome.libgnomekbd.keyboard options "['grp\tgrp:ctrls_toggle']"
gsettings set org.gnome.libgnomekbd.desktop group-per-window true

But there isn't an option to configure a separate shortcut key for each layout, instead of cycling (still changing only the current window).

e.g.

Super+Shift+1 == switch current window to 'en' 
Super+Shift+2 == switch current window to 'il' 
Super+Shift+3 == switch current window to 'br' 
Super+Shift+4 == switch current window to 'gr' 

Is there any available settings/program/script to set such custom shortcut-keys?

I do not need to be able to switch all windows together. I only wish to be able to switch the current window.

Please note that questions/answers like the following does not solve my problem, becuase it only works to change the layout for all windows. I want to change only current window. Separate keyboard shortcuts for switching between keyboard layouts

vanadium avatar
cn flag
You mean "keyboard layout of current window" instead of "layout of current window"? Your title is currently very misleading. You may want to edit it. Anyway, I do not think you can have different keyboard layouts associated with individual windows. You can have shortcut keys that allow quick switching, though.
in flag
@vanadium, omg, I wasn't thinking about that, thanks.
in flag
@vanadium, however, you can have different keyboard layouts associtated with each window. There's an option for that which I use (org.gnome.libgnomekbd.desktop group-per-window true). The keyboard shortcut cycles between my 4 layouts for the current window. I want to have 4 keyboard shortcuts, one for each layout.
vanadium avatar
cn flag
Answer to do that here: https://askubuntu.com/questions/1176703/switch-between-keyboard-languages-by-cli-in-gnome, however I have the impression that that does not work anymore in Gnome 43
in flag
@vanadium, does it fail only because of the safety changes or other reasons? https://askubuntu.com/questions/1412130/dbus-calls-to-gnome-shell-dont-work-under-ubuntu-22-04
vanadium avatar
cn flag
Yes, I did not think of it, but that very likely will be why it does not anymore work.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.