1// These partial variants assign ISO_Level3_Shift to various XKB keycodes
2// so that the third shift level can be reached.
3
4// The default behaviour:
5// the right Alt key (AltGr) chooses the third symbol engraved on a key.
6default partial modifier_keys
7xkb_symbols "ralt_switch" {
8  key <RALT> {
9    type[Group1]="ONE_LEVEL",
10    symbols[Group1] = [ ISO_Level3_Shift ]
11  };
12};
13
14// The right Alt key never chooses the third level.
15// This option attempts to undo the effect of a layout's inclusion of
16// 'ralt_switch'.  You may want to also select another level3 option
17// to map the level3 shift to some other key.
18partial modifier_keys
19xkb_symbols "ralt_alt" {
20  key <RALT> {
21    type[Group1]="TWO_LEVEL",
22    symbols[Group1] = [ Alt_R, Meta_R ]
23  };
24  modifier_map Mod1 { <RALT> };
25};
26
27// The right Alt key (while pressed) chooses the third shift level,
28// and Compose is mapped to its second level.
29partial modifier_keys
30xkb_symbols "ralt_switch_multikey" {
31  key <RALT> {
32    type[Group1]="TWO_LEVEL",
33    symbols[Group1] = [ ISO_Level3_Shift, Multi_key ]
34  };
35};
36
37// Either Alt key (while pressed) chooses the third shift level.
38// (To be used mostly to imitate Mac OS functionality.)
39partial modifier_keys
40xkb_symbols "alt_switch" {
41  include "level3(lalt_switch)"
42  include "level3(ralt_switch)"
43};
44
45// The left Alt key (while pressed) chooses the third shift level.
46partial modifier_keys
47xkb_symbols "lalt_switch" {
48  key <LALT> {
49    type[Group1]="ONE_LEVEL",
50    symbols[Group1] = [ ISO_Level3_Shift ]
51  };
52};
53
54// The right Ctrl key (while pressed) chooses the third shift level.
55partial modifier_keys
56xkb_symbols "switch" {
57  key <RCTL> {
58    type[Group1]="ONE_LEVEL",
59    symbols[Group1] = [ ISO_Level3_Shift ]
60  };
61};
62
63// The Menu key (while pressed) chooses the third shift level.
64partial modifier_keys
65xkb_symbols "menu_switch" {
66  key <MENU> {
67    type[Group1]="ONE_LEVEL",
68    symbols[Group1] = [ ISO_Level3_Shift ]
69  };
70};
71
72// Either Win key (while pressed) chooses the third shift level.
73partial modifier_keys
74xkb_symbols "win_switch" {
75  include "level3(lwin_switch)"
76  include "level3(rwin_switch)"
77};
78
79// The left Win key (while pressed) chooses the third shift level.
80partial modifier_keys
81xkb_symbols "lwin_switch" {
82  key <LWIN> {
83    type[Group1]="ONE_LEVEL",
84    symbols[Group1] = [ ISO_Level3_Shift ]
85  };
86};
87
88// The right Win key (while pressed) chooses the third shift level.
89partial modifier_keys
90xkb_symbols "rwin_switch" {
91  key <RWIN> {
92    type[Group1]="ONE_LEVEL",
93    symbols[Group1] = [ ISO_Level3_Shift ]
94  };
95};
96
97// The Enter key on the kepypad (while pressed) chooses the third shift level.
98// (This is especially useful for Mac laptops which miss the right Alt key.)
99partial modifier_keys
100xkb_symbols "enter_switch" {
101  key <KPEN> {
102    type[Group1]="ONE_LEVEL",
103    symbols[Group1] = [ ISO_Level3_Shift ]
104  };
105};
106
107// The CapsLock key (while pressed) chooses the third shift level.
108partial modifier_keys
109xkb_symbols "caps_switch" {
110  key <CAPS> {
111    type[Group1]="ONE_LEVEL",
112    symbols[Group1] = [ ISO_Level3_Shift ]
113  };
114};
115
116// The Backslash key (while pressed) chooses the third shift level.
117partial modifier_keys
118xkb_symbols "bksl_switch" {
119  key <BKSL> {
120    type[Group1]="ONE_LEVEL",
121    symbols[Group1] = [ ISO_Level3_Shift ]
122  };
123};
124
125// The Less/Greater key (while pressed) chooses the third shift level.
126partial modifier_keys
127xkb_symbols "lsgt_switch" {
128  key <LSGT> {
129    type[Group1]="ONE_LEVEL",
130    symbols[Group1] = [ ISO_Level3_Shift ]
131  };
132};
133
134// The CapsLock key (while pressed) chooses the third shift level,
135// and latches when pressed together with another third-level chooser.
136partial modifier_keys
137xkb_symbols "caps_switch_latch" {
138  key <CAPS> {
139    type[Group1]="THREE_LEVEL",
140    symbols[Group1] = [ ISO_Level3_Shift, ISO_Level3_Shift, ISO_Level3_Latch ]
141  };
142};
143
144// The Backslash key (while pressed) chooses the third shift level,
145// and latches when pressed together with another third-level chooser.
146partial modifier_keys
147xkb_symbols "bksl_switch_latch" {
148  key <BKSL> {
149    type[Group1]="THREE_LEVEL",
150    symbols[Group1] = [ ISO_Level3_Shift, ISO_Level3_Shift, ISO_Level3_Latch ]
151  };
152};
153
154// The Less/Greater key (while pressed) chooses the third shift level,
155// and latches when pressed together with another third-level chooser.
156partial modifier_keys
157xkb_symbols "lsgt_switch_latch" {
158  key <LSGT> {
159    type[Group1]="THREE_LEVEL",
160    symbols[Group1] = [ ISO_Level3_Shift, ISO_Level3_Shift, ISO_Level3_Latch ]
161  };
162};
163
164// Number key 4 chooses third shift level when pressed in isolation.
165partial modifier_keys
166xkb_symbols "4_switch_isolated" {
167  override key <AE04> {
168    symbols[Group1] = [ ISO_Level3_Shift ]
169  };
170};
171
172// Number key 9 chooses third shift level when pressed in isolation.
173partial modifier_keys
174xkb_symbols "9_switch_isolated" {
175  override key <AE09> {
176    symbols[Group1] = [ ISO_Level3_Shift ]
177  };
178};
179