Can a command be set to run when switching to a specific virtual desktop (or an activity) in KDE environment?
I want to run a command for a desktop (e.g. desktop2) so that when I switch to that desktop, the keyboard language layout will change to English US automatically.
You can change to virtual desktop two using the following command line argument:
Thus executing
should switch your to desktop 2 and change your language to english as suggested in your example.
You can use a keybinding program like autokey, or KDE custom shortcuts to set a keybinding for the above command. Alternatively, you can save the above command to a text file ending in .sh, and then make the file executable to have a clickable script that will switch desktops and change languages for you.
should switch your to desktop 2 and change your language to english as suggested in your example.
Switching activities is a bit more lengthy command.
Going to go to the next activity is simple enough using:
However to switch to a specific activity, you must fist know it's ID which can be obtained by:
Once you know the activity id you can switch to that activity via:
then couple that with the '&& setxkbmap en' command as shown above when switching virtual desktops to have activity switching coupled with a language change.
Also of note:
will change the system language to english
Thanks to virtualxtc's answer above and don_crissti's answer. To change layout download this zip file linked in this page. Extract it to a folder in home folder. Then run terminal inside the folder and run these commands:
(you may need to install make and cmake)
then run this command to switch to English:
and a combination can be
which one can assign a hotkey to it to switch to desktop2 and English.