Skip to content

Instantly share code, notes, and snippets.

@x7c1
Last active March 11, 2019 08:04
Show Gist options
  • Select an option

  • Save x7c1/7a8b80d03508663905fbd81fa6a2ee69 to your computer and use it in GitHub Desktop.

Select an option

Save x7c1/7a8b80d03508663905fbd81fa6a2ee69 to your computer and use it in GitHub Desktop.
xkb settings
$ tree ~/.xkb | sed -e '1d'
├── keymap
│   └── my_keymap
└── symbols
    └── my_symbols

2 directories, 2 files

replace keys by ~/.xkb/symbols:

$ cat ~/.xkb/symbols/my_symbols 
partial modifier_keys
xkb_symbols "space_sides" {
  replace key <LALT> { [ Super_L ] };
  replace key <MUHE> { [ Alt_L ] };
  replace key <HENK> { [ Escape ] };
};

set keymap by ~/.xkb/keymap:

$ cat ~/.xkb/keymap/my_keymap 
xkb_keymap {
	xkb_keycodes  { include "evdev+aliases(qwerty)"	};
	xkb_types     { include "complete"	};
	xkb_compat    { include "complete"	};
	xkb_symbols   { include "pc+jp+us:2+inet(evdev)+my_symbols(space_sides)"	};
	xkb_geometry  { include "pc(pc105)"	};
};

create a shell script to load keymap:

$ cat ~/scripts/setup_my_keymap.sh 
xkbcomp -I/home/haco/.xkb ~/.xkb/keymap/my_keymap :1 2> /dev/null

run:

$ ~/scripts/setup_my_keymap.sh

add the script as a startup application:

Screenshot from 2019-03-11 16-46-56

rf. to know other keycodes:

$ cat -n /usr/share/X11/xkb/keycodes/evdev | grep -C5 MUHE
   149		//<HZTG> =  93;	// Hankaku/Zenkakau toggle - not actually used
   150		alias <HZTG> = <TLDE>;
   151		<HKTG> = 101;	// Hiragana/Katakana toggle
   152		<AB11> = 97;	// backslash/underscore
   153		<HENK> = 100;	// Henkan
   154		<MUHE> = 102;	// Muhenkan
   155		<AE13> = 132;	// Yen
   156		<KATA> =  98;	// Katakana
   157		<HIRA> =  99;	// Hiragana
   158		<JPCM> = 103;	// KPJPComma
   159		//<RO>   =  97;	// Romaji

$ cat -n /usr/share/X11/xkb/keycodes/evdev | grep -C5 LALT
    63		<AB08> = 59;
    64		<AB09> = 60;
    65		<AB10> = 61;
    66		<RTSH> = 62;
    67	
    68		<LALT> = 64;
    69		<LCTL> = 37;
    70		<SPCE> = 65;
    71		<RCTL> = 105;
    72		<RALT> = 108;
    73		// Microsoft keyboard extra keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment