Setup custom keyboard layout where Caps activates a second layer
by halfpower from LinuxQuestions.org on (#6NPRV)
I'm using a custom keyboard layout to make the keyboard work better for things like navigation. For example, I'm using Caps Lock as a modifier to access arrow keys. In other words:
Code:Caps + i => left
Caps + j => down
Caps + k => up
Caps + l => rightI also have the following:
Code:Caps + a => Alt
Caps + s => Shift
Caps + d => CtrlHowever, I want to be able to use these keys in combination with each other. For example:
Code:Caps + a + i => Alt + left
Caps + d + l => Ctrl + rightThe combinations don't work. Is there any way to make it work?
Here is a command I use to create the keyboard layout:
Code:DATA=$(cat <<-EOM
default partial alphanumeric_keys modifier_keys
xkb_symbols "custom_1" {
include "us(basic)"
name[Group1]= "English (US)";
key <AC01> {[a, A, Alt_L, Alt_L]};
key <AC02> {[s, S, Shift_L, Shift_L]};
key <AC03> {[d, D, Control_L, Control_L]};
key <AC06> {[h, H, Left, Left]};
key <AC07> {[j, J, Down, Down]};
key <AC08> {[k, K, Up, Up]};
key <AC09> {[l, L, Right, Right]};
include "level3(caps_switch)"
};
EOM
)
fn=/usr/share/X11/xkb/symbols/custom
echo "DATA" | sudo tee ${fn} > /dev/null
Code:Caps + i => left
Caps + j => down
Caps + k => up
Caps + l => rightI also have the following:
Code:Caps + a => Alt
Caps + s => Shift
Caps + d => CtrlHowever, I want to be able to use these keys in combination with each other. For example:
Code:Caps + a + i => Alt + left
Caps + d + l => Ctrl + rightThe combinations don't work. Is there any way to make it work?
Here is a command I use to create the keyboard layout:
Code:DATA=$(cat <<-EOM
default partial alphanumeric_keys modifier_keys
xkb_symbols "custom_1" {
include "us(basic)"
name[Group1]= "English (US)";
key <AC01> {[a, A, Alt_L, Alt_L]};
key <AC02> {[s, S, Shift_L, Shift_L]};
key <AC03> {[d, D, Control_L, Control_L]};
key <AC06> {[h, H, Left, Left]};
key <AC07> {[j, J, Down, Down]};
key <AC08> {[k, K, Up, Up]};
key <AC09> {[l, L, Right, Right]};
include "level3(caps_switch)"
};
EOM
)
fn=/usr/share/X11/xkb/symbols/custom
echo "DATA" | sudo tee ${fn} > /dev/null