1// Eliminate CapsLock, making it another Ctrl.
2partial modifier_keys
3xkb_symbols "nocaps" {
4    replace key <CAPS> { [ Control_L, Control_L ] };
5    modifier_map  Control { <CAPS>, <LCTL> };
6};
7
8// Make the left Ctrl key a left Meta.
9xkb_symbols "lctrl_meta" {
10    replace key <LCTL> { [ Meta_L ] };
11    modifier_map  Mod4 { <LCTL> };
12};
13
14// Swap the functions of the CapsLock key and the left Ctrl key.
15partial modifier_keys
16xkb_symbols "swapcaps" {
17    replace key <CAPS> { [ Control_L ] };
18    replace key <LCTL> { [ Caps_Lock ] };
19    modifier_map Control { <CAPS> };
20    modifier_map  Lock { <LCTL> };
21};
22
23// Swap the functions of the CapsLock key and the left Ctrl key,
24// but make the Ctrl key a 'Hyper' modifier
25partial modifier_keys
26xkb_symbols "swapcaps_hyper" {
27    replace key <CAPS> { [ Control_L ] };
28    replace key <LCTL> { [ Hyper_L ] };
29    modifier_map Control { <CAPS> };
30    modifier_map Mod3 { <LCTL> };
31};
32
33// Set CapsLock to left Ctrl and left Ctrl to switch layout.
34partial modifier_keys
35xkb_symbols "swapcaps_and_switch_layout" {
36    replace key <CAPS> { [ Control_L ] };
37    replace key <LCTL> { [ ISO_Next_Group ] };
38    modifier_map Control { <CAPS> };
39    modifier_map  Lock { <LCTL> };
40};
41
42// Move Ctrl to the leftmost key on the middle row and CapsLock to the
43// leftmost key on the bottom row.  Only works if the geometry or keycodes
44// file has defined appropriate aliases for the keys in question.
45partial modifier_keys
46xkb_symbols "ac_ctrl" {
47    replace key <AC00> { [ Control_L ] };
48    replace key <AA00> { [ Caps_Lock ] };
49    modifier_map  Control { <AC00> };
50    modifier_map  Lock    { <AA00> };
51};
52
53// Move Ctrl to the leftmost key on the bottom row and CapsLock to the
54// leftmost key on the middle row.  Only works if the geometry or keycodes
55// file has defined appropriate aliases for the keys in question.
56partial modifier_keys
57xkb_symbols "aa_ctrl" {
58    replace key <AA00> { [ Control_L ] };
59    replace key <AC00> { [ Caps_Lock ] };
60    modifier_map  Control { <AA00> };
61    modifier_map  Lock    { <AC00> };
62};
63
64// Right Ctrl functions as another right Alt.
65partial modifier_keys
66xkb_symbols "rctrl_ralt" {
67    key <RCTL> { symbols[Group1]= [ Alt_R ] };
68    modifier_map Mod1{ <RCTL> };
69};
70
71// Menu key functions as another right Ctrl.
72partial modifier_keys
73xkb_symbols "menu_rctrl" {
74    replace key <MENU> { [ Control_R, Control_R ] };
75    modifier_map Control { Control_L, <MENU> };
76};
77
78// Right Alt key functions as another right Ctrl.
79partial modifier_keys
80xkb_symbols "ralt_rctrl" {
81    replace key <RALT> { type[Group1] = "TWO_LEVEL",
82                         symbols[Group1] = [ Control_R, Control_R ] };
83    modifier_map Control { <RALT> };
84};
85
86// Swap the functions of the left Alt key and the left Ctrl key.
87partial modifier_keys
88xkb_symbols "swap_lalt_lctl" {
89    replace key <LALT> { [ Control_L, Control_L ] };
90    replace key <LCTL> { [ Alt_L, Meta_L ] };
91    modifier_map Mod1    { <LCTL> };
92    modifier_map Control { <LALT> };
93};
94
95// Swap the functions of the left Win key and the left Ctrl key.
96partial modifier_keys
97xkb_symbols "swap_lwin_lctl" {
98    replace key <LWIN> { [ Control_L ] };
99    replace key <LCTL> { [ Super_L ] };
100    modifier_map Mod4    { <LCTL> };
101    modifier_map Control { <LWIN> };
102};
103
104// Swap the functions of the right Win key and the right Ctrl key.
105partial modifier_keys
106xkb_symbols "swap_rwin_rctl" {
107    replace key <RWIN> { [ Control_R ] };
108    replace key <RCTL> { [ Super_R ] };
109    modifier_map Mod4    { <RCTL> };
110    modifier_map Control { <RWIN> };
111};
112
113// Map Ctrl to the left Alt key, Alt to the left Win key,
114// and Super to the left Ctrl key.
115partial modifier_keys
116xkb_symbols "swap_lalt_lctl_lwin" {
117    replace key <LALT> { [ Control_L, Control_L ] };
118    replace key <LWIN> { [ Alt_L, Meta_L ] };
119    replace key <LCTL> { [ Super_L ] };
120    modifier_map Mod1    { <LWIN> };
121    modifier_map Mod4    { <LCTL> };
122    modifier_map Control { <LALT> };
123};
124