I use some key (e.g. CapsLock) to switch keyboard layouts in KDE Plasma. But for some applications from the list (e.g., remote desktop or virtual machines) I want this key just pass the keypress event to the application (without switching layout in KDE). Is it possible?
You can press Shift + Caps Lock for Caps Lock.
There’s also an option for “Caps lock (while pressed), Alt + Caps Lock for original Caps Lock action”. I assume you already know where it is, but just in case:
System Settings → Input devices → Keyboard → Advanced → Switching to another layout
Thanks, but that is not what I need.
I need to disable layout switching with key combination for some applications only.
It can’t be turned off for only some applications, it’s either all or none.
This script will toggle the option, save it as ~/.local/bin/grp_toggle
(or whatever you want) and create a shortcut.
#!/usr/bin/bash
# DESC: Enable/disable grp:caps_toggle
# set your options here
# you can find a list of what's configured using
# setxkbmap -verbose 10
# copy them and put them in the options variable, like so:
# eg. options="terminate:ctrl_alt_bksp,lv3:ralt_switch"
# don't include grp:caps_toggle
options=""
if [[ -n $(setxkbmap -verbose 10 | grep "group(caps_toggle)") ]]; then
setxkbmap -option -option $options
else
setxkbmap -option grp:caps_toggle
fi
Just in case:
System Settings → Shortcuts → Custom Shortcuts → Edit → New → Global Shortcut → Command/URL
- Set a name.
- In the Trigger tab set your combo.
- In the Action tab type
~/.local/bin/grp_toggle
into the “Command/URL” entry box. - Click apply.
EDIT:
Pretty sure this thread had an X11 tag, but now it definitely doesn’t…so this will only work in X11. Not sure how to do this in wayland…presumably through a command that changes the GUI keyboard settings, should one exist (maybe localectl
).