- Updated xkb files to include multiple levels to enable delete key support on Ctrl/Cmd + Backspace

This commit is contained in:
Ben Reaves
2019-08-04 13:40:13 -05:00
parent 7d2841e87f
commit 4697c75848
5 changed files with 35 additions and 20 deletions

View File

@@ -1,4 +1,4 @@
default partial xkb_symbols "mac_onelvlsym" {
default partial xkb_symbols "mac_levelssym" {
// LEFT to Begin Line
replace key <LEFT> {
type[Group1]= "ONE_LEVEL_CTRL",
@@ -14,13 +14,19 @@ default partial xkb_symbols "mac_onelvlsym" {
// Up to Mac Home
replace key <UP> {
type[Group1]= "ONE_LEVEL_CTRL",
symbols[Group1]= [ Up, NoSymbol ],
symbols[Group1]= [ Up, Up, NoSymbol ],
actions[Group1]= [ NoAction(), NoAction(), RedirectKey(key=<HOME>)]
};
// Down to Mac End
replace key <DOWN> {
type[Group1]= "ONE_LEVEL_CTRL",
symbols[Group1]= [ Down, NoSymbol ],
symbols[Group1]= [ Down, Down, NoSymbol ],
actions[Group1]= [ NoAction(), NoAction(), RedirectKey(key=<END>)]
};
// CTRL BKSP to DELETE
replace key <BKSP> {
type[Group1]= "TWO_LEVEL_CTRL",
symbols[Group1]= [ BackSpace, BackSpace, NoSymbol ],
actions[Group1]= [ NoAction(), NoAction(), RedirectKey(key=<DELE>,clearmods=Control)]
};
};

20
.xkb/types/mac_levels Normal file
View File

@@ -0,0 +1,20 @@
default partial xkb_types "addmac_levels" {
type "ONE_LEVEL_CTRL" {
modifiers= Shift+Control;
map[Shift]= Level2;
map[Control]= Level3;
map[Shift+Control]= Level3;
level_name[Level1]= "Base";
level_name[Level2]= "Caps";
level_name[Level3]= "With Control";
};
type "TWO_LEVEL_CTRL" {
modifiers= Shift+Control;
map[Shift]= Level2;
map[Control]= Level3;
map[Shift+Control]= Level3;
level_name[Level1]= "Base";
level_name[Level2]= "Caps";
level_name[Level3]= "With Control";
};
};

View File

@@ -1,11 +0,0 @@
default partial xkb_types "addmac_onelvl" {
type "ONE_LEVEL_CTRL" {
modifiers= Shift+Control;
map[Shift]= Level2;
map[Control]= Level3;
map[Shift+Control]= Level3;
level_name[Level1]= "Base";
level_name[Level2]= "Caps";
level_name[Level3]= "With Control";
};
};

View File

@@ -1,8 +1,8 @@
#!/bin/bash
mkdir -p ~/.xkb/{keymap,symbols,types}
cp ./.xkb/symbols/mac_onelvl ~/.xkb/symbols/mac_onelvl
cp ./.xkb/types/mac_onelvl ~/.xkb/types/mac_onelvl
cp ./.xkb/symbols/mac_levels ~/.xkb/symbols/mac_levels
cp ./.xkb/types/mac_levels ~/.xkb/types/mac_levels
setxkbmap -option
setxkbmap -print > ~/.xkb/keymap/kbd.mac.onelvl
line=$(cat ~/.xkb/keymap/kbd.mac.onelvl | grep -n 'xkb_symbols' | cut -f1 -d:)
sed -ie "${line}s/)\"/)+altwin(ctrl_alt_win)+mac_onelvl(mac_onelvlsym)\"/g" ~/.xkb/keymap/kbd.mac.onelvl
setxkbmap -print > ~/.xkb/keymap/kbd.mac.gui
line=$(cat ~/.xkb/keymap/kbd.mac.gui | grep -n 'xkb_symbols' | cut -f1 -d:)
sed -ie "${line}s/)\"/)+altwin(ctrl_alt_win)+mac_levels(mac_levelssym)\"/g" ~/.xkb/keymap/kbd.mac.gui

View File

@@ -15,7 +15,7 @@ swapbehavior=$4
swapcmd_term="setxkbmap -option;setxkbmap -option altwin:swap_alt_win"
fallbackcmd_gui=""
if [[ "$systemtype" == "windows" || "$systemtype" == "mac" ]]; then
swapcmd_gui="setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.onelvl $DISPLAY"
swapcmd_gui="setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.gui $DISPLAY"
check_gt="setxkbmap -query | grep -v 'swap_alt_win' 1>/dev/null"
check_tg="setxkbmap -query | grep -q 'swap_alt_win'"
elif [[ "$swapbehavior" == "both_mac" ]]; then