0.99
[platform/upstream/kbd.git] / data / keymaps / i386 / qwerty / hypermap.m4
1 #
2 # hypermap.map 1994/11/11
3 # Michael Shields <shields@tembel.org>
4 #
5 # A keymap redesigned for sanity.
6 #
7
8 #
9 # This keymap is a ground-up reimplementation of the keyboard map,
10 # intended to be consistent and rational.  It uses an m4 metalanguage to
11 # declare the key mappings.  Usage is `m4 hypermap.map | loadkeys'.
12 #
13 # The modifier flags used are `shift' (1), `control' (4), and `alt' (8).
14 # Left and right modifiers are not distinguished.
15 #
16 # In general, Meta is always distinguished, and M-S-KEY is distinct from
17 # M-KEY.  This is good news for Emacs users.  C-S-KEY is consistently
18 # folded into C-KEY.
19 #
20 # Shift is more loosely interpreted than the other modifiers; usually if
21 # S-KEY has no special meaning, the action will be the same as KEY.
22 # However, if M-KEY or H-KEY is undefined, nothing happens.
23 #
24 # Because Caps Lock's position is so out of proportion to its utility,
25 # it's been totally redefined to a new sort of modifier, which I've
26 # arbitrarily named `Hyper'.  Shift is ignored with Hyper.  Hyper
27 # provides dead keys:
28 #       H-`     dead accent grave
29 #       H-'     dead acute accent
30 #       H-^     dead circumflex
31 #       H-t     dead tilde
32 #       H-d     dead diaeresis
33 # and ISO-8859-1 symbols (some more mnemonic than others):
34 #       H-SPC   nobreakspace
35 #       H-!     inverted bang
36 #       H-h     cents (`hundredths')
37 #       H-#     pounds sterling
38 #       H-$     currency
39 #       H-y     yen
40 #       H-|     broken bar
41 #       H-s     section (the galaxy symbol)
42 #       H-c     copyright
43 #       H-a     feminine ordinal
44 #       H-<     left guillemot
45 #       H-]     not sign (it's angular)
46 #       H--     soft hyphen
47 #       H-r     registered trademark symbol
48 #       H-=     macron
49 #       H-0     degrees
50 #       H-[     plus/minus (near + and -)
51 #       H-k     superior 2 (jkl form a series)
52 #       H-l     superior 3
53 #       H-u     mu
54 #       H-p     pilcrow
55 #       H-:     centered dot
56 #       H-j     superior 1
57 #       H-o     masculine ordinal
58 #       H->     right guillemot
59 #       H-q     1/4 fraction (qwe form a series)
60 #       H-w     1/2 fraction
61 #       H-e     3/4 fraction
62 #       H-?     inverted question mark
63 #       H-x     multiplication symbol
64 #       H-%     division symbol
65 # You can also use Hyper plus Alt to type characters by decimal code on
66 # the keypad, as with Alt alone, or in hex on the main keyboard.  And
67 # H-TAB is a Caps Lock.
68 #
69 # Function keys work as marked, unless with Alt, in which case they
70 # switch to the console with the same number.  Shift adds 12 and Hyper
71 # adds 24 to the numbers (i.e., they logically switch to other banks).
72 # Thus you can easily address up to 48.  Control is ignored, for
73 # consistency with X.
74 #
75 # Finally, you can change the behavior of the Caps Lock and Controls
76 # with m4 command-line options.  The default values are equivalent to
77 # `-DCAPSLOCK_K=Hyper -DLEFTCTRL_K=Control -DRIGHTCTRL_K=Control'.  You
78 # can remove the Hyper code entirely with `-DCAPSLOCK_K=Caps_Lock'.
79 #
80 # This file is arranged vaguely by key position on the classic PC layout.
81 #
82
83
84 dnl Set default values.
85 ifdef(`CAPSLOCK_K', , `define(`CAPSLOCK_K', `Hyper')')
86 ifdef(`LEFTCTRL_K', , `define(`LEFTCTRL_K', `Control')')
87 ifdef(`RIGHTCTRL_K', , `define(`RIGHTCTRL_K', `Control')')
88
89 dnl Figure out if any key is a Hyper key.  If so, define `hyper', both
90 dnl for usefulness and `ifdef' testability.
91 ifelse(CAPSLOCK_K, `Hyper', `define(`hyper', `ctrlr')',
92        LEFTCTRL_K, `Hyper', `define(`hyper', `ctrlr')',
93        RIGHTCTRL_K, `Hyper', `define(`hyper', `ctrlr')')
94
95 define(`Hyper', `CtrlR')
96
97
98 keymaps 0,1,4,5,8,9,12,13`'ifdef(`hyper', `,128,129,132,133,136,137,140,141')
99
100
101 dnl General usage of these macros is MACRO(KEYCODE, UNSHIFTED, SHIFTED).
102
103 dnl We first undefine `shift', which only causes problems.
104 undefine(`shift')
105
106 define(`SIMPLE', `keycode $1 = $2 $2')
107
108 define(`KEY',
109 `                       keycode $1 = $2 VoidSymbol
110 shift                   keycode $1 = $3
111                 alt     keycode $1 = Meta_$2
112 shift           alt     keycode $1 = Meta_$3')
113
114 dnl This macro adds Control variations to a key.
115 define(`CONTROL',
116 `       control         keycode $1 = $2
117 shift   control         keycode $1 = $2
118         control alt     keycode $1 = Meta_$2
119 shift   control alt     keycode $1 = Meta_$2')
120
121 dnl Add Hyper variations to a key.
122 define(`HYPER', ifdef(`hyper',
123 `                       hyper   keycode $1 = $2
124 shift                   hyper   keycode $1 = $2'))
125 define(`CONTROLHYPER', ifdef(`hyper',
126 `       control         hyper   keycode $1 = $2
127 shift   control         hyper   keycode $1 = $2'))
128 define(`METAHYPER', ifdef(`hyper',
129 `               alt     hyper   keycode $1 = $2
130 shift           alt     hyper   keycode $1 = $2'))
131 define(`CONTROLMETAHYPER', ifdef(`hyper', dnl Ludicrous.
132 `       control alt     hyper   keycode $1 = $2
133 shift   control alt     hyper   keycode $1 = $2'))
134
135 dnl Special case for letters.  Best to be explicit.
136 define(`LETTER',
137 `                       keycode $1 = `+'$2 VoidSymbol
138 shift                   keycode $1 = `+'translit($2, `a-z', `A-Z')
139                 alt     keycode $1 = `Meta_'$2
140 shift           alt     keycode $1 = `Meta_'translit($2, `a-z', `A-Z')
141 CONTROL($1, Control_$2)')
142
143 dnl For function keys.  Call here is FUNCTION(KEYCODE, FKEYNUM).
144 define(`BANKSIZE', 12)
145 define(`FUNCTION',
146 `                       keycode $1 = `F'$2 VoidSymbol
147 shift                   keycode $1 = `F'eval($2 + BANKSIZE)
148         hyper           keycode $1 = `F'eval($2 + BANKSIZE * 2)
149 shift   hyper           keycode $1 = `F'eval($2 + BANKSIZE * 3)
150                 alt     keycode $1 = `Console_'$2
151 shift           alt     keycode $1 = `Console_'eval($2 + BANKSIZE)
152         hyper   alt     keycode $1 = `Console_'eval($2 + BANKSIZE * 2)
153 shift   hyper   alt     keycode $1 = `Console_'eval($2 + BANKSIZE * 3)')
154
155 dnl For the keypad digits.  KPDIGIT(KEYCODE, DIGIT).
156 define(`KPDIGIT',
157 `                       keycode $1 = KP_$2 VoidSymbol
158 shift                   keycode $1 = KP_$2
159                 alt     keycode $1 = Ascii_$2
160 shift           alt     keycode $1 = Ascii_$2
161 METAHYPER($1, Ascii_$2)')
162
163 dnl And a special approximation:
164 define(`Meta_Return', `Meta_Control_m')
165
166
167 KEY(1, Escape, Escape)
168
169 FUNCTION(59, 1)
170 FUNCTION(60, 2)
171 FUNCTION(61, 3)
172 FUNCTION(62, 4)
173 FUNCTION(63, 5)
174 FUNCTION(64, 6)
175 FUNCTION(65, 7)
176 FUNCTION(66, 8)
177 FUNCTION(67, 9)
178 FUNCTION(68, 10)
179 FUNCTION(87, 11)
180 FUNCTION(88, 12)
181
182 KEY(2, one, exclam)
183     HYPER(2, exclamdown)
184     METAHYPER(2, Hex_1)
185 KEY(3, two, at)
186     CONTROL(3, nul)
187     METAHYPER(3, Hex_2)
188 KEY(4, three, numbersign)
189     HYPER(4, pound)
190     METAHYPER(4, Hex_3)
191 KEY(5, four, dollar)
192     HYPER(5, currency)
193     METAHYPER(5, Hex_4)
194 KEY(6, five, percent)
195     HYPER(6, division)
196     METAHYPER(6, Hex_5)
197 KEY(7, six, asciicircum)
198     CONTROL(7, Control_asciicircum)
199     HYPER(7, dead_circumflex)
200     METAHYPER(7, Hex_6)
201 KEY(8, seven, ampersand)
202     METAHYPER(8, Hex_7)
203 KEY(9, eight, asterisk)
204     METAHYPER(9, Hex_8)
205 KEY(10, nine, parenleft)
206     METAHYPER(10, Hex_9)
207 KEY(11, zero, parenright)
208     HYPER(11, degree)
209     METAHYPER(11, Hex_0)
210 KEY(12, minus, underscore)
211     CONTROL(12, Control_underscore)
212     HYPER(12, hyphen)
213 KEY(13, equal, plus)
214     HYPER(13, macron)
215 KEY(14, Delete, Delete)
216     CONTROL(14, BackSpace)
217
218 KEY(15, Tab, Tab)
219     HYPER(15, Caps_Lock)
220 LETTER(16, q)
221     HYPER(16, onequarter)
222 LETTER(17, w)
223     HYPER(17, onehalf)
224 LETTER(18, e)
225     HYPER(18, threequarters)
226     METAHYPER(18, Hex_E)
227 LETTER(19, r)
228     HYPER(19, registered)
229 LETTER(20, t)
230     HYPER(20, dead_tilde)
231 LETTER(21, y)
232     HYPER(21, yen)
233 LETTER(22, u)
234     HYPER(22, mu)
235 LETTER(23, i)
236 LETTER(24, o)
237     HYPER(24, masculine)
238 LETTER(25, p)
239     HYPER(25, 182) # pilcrow
240 KEY(26, bracketleft, braceleft)
241     CONTROL(26, Escape)
242     HYPER(26, plusminus)
243 KEY(27, bracketright, braceright)
244     CONTROL(27, Control_bracketright)
245     HYPER(27, notsign)
246
247 KEY(28, Return, Return)
248
249 LETTER(30, a)
250     HYPER(30, ordfeminine)
251     METAHYPER(30, Hex_A)
252 LETTER(31, s)
253     HYPER(31, section)
254 LETTER(32, d)
255     HYPER(32, dead_diaeresis)
256     METAHYPER(32, Hex_D)
257 LETTER(33, f)
258     METAHYPER(33, Hex_F)
259 LETTER(34, g)
260 LETTER(35, h)
261     HYPER(35, cent)
262 LETTER(36, j)
263     HYPER(36, onesuperior)
264 LETTER(37, k)
265     HYPER(37, twosuperior)
266 LETTER(38, l)
267     HYPER(38, threesuperior)
268 KEY(39, semicolon, colon)
269     HYPER(39, periodcentered)
270 KEY(40, apostrophe, quotedbl)
271     HYPER(40, dead_acute)
272 KEY(41, grave, asciitilde)
273     HYPER(41, dead_grave)
274
275 KEY(43, backslash, bar)
276     CONTROL(43, Control_backslash)
277     HYPER(43, brokenbar)
278 LETTER(44, z)
279 LETTER(45, x)
280     HYPER(45, multiplication)
281 LETTER(46, c)
282     HYPER(46, copyright)
283     METAHYPER(46, Hex_C)
284 LETTER(47, v)
285 LETTER(48, b)
286     METAHYPER(48, Hex_B)
287 LETTER(49, n)
288 LETTER(50, m)
289 KEY(51, comma, less)
290     HYPER(51, guillemotleft)
291 KEY(52, period, greater)
292     HYPER(52, guillemotright)
293 KEY(53, slash, question)
294     HYPER(53, questiondown)
295
296 KEY(57, space, space)
297     CONTROL(57, nul)
298     HYPER(57, nobreakspace)
299
300 KPDIGIT(71, 7)
301 KPDIGIT(72, 8)
302 KPDIGIT(73, 9)
303 SIMPLE(74, KP_Subtract)
304 KPDIGIT(75, 4)
305 KPDIGIT(76, 5)
306 KPDIGIT(77, 6)
307 SIMPLE(78, KP_Add)
308 KPDIGIT(79, 1)
309 KPDIGIT(80, 2)
310 KPDIGIT(81, 3)
311 KPDIGIT(82, 0)
312 SIMPLE(83, KP_Period)
313 SIMPLE(96, KP_Enter)
314 SIMPLE(98, KP_Divide)
315 SIMPLE(55, KP_Multiply)
316 SIMPLE(118, KP_MinPlus)
317
318 # Modifiers.
319 keycode  42 = Shift
320 keycode  54 = Shift
321 keycode  56 = Alt
322 keycode 100 = Alt
323 keycode  58 = CAPSLOCK_K
324 keycode  29 = LEFTCTRL_K
325 keycode  97 = RIGHTCTRL_K
326
327 # Everyone needs a compose key.  This is C-..
328 control keycode  52 = Compose
329
330 SIMPLE(69, Num_Lock)
331
332 keycode  70 = Scroll_Lock
333         shift   keycode  70 = Show_Memory
334         control keycode  70 = Show_State
335         alt     keycode  70 = Show_Registers
336
337 # SysRq.  I suppose there's some reason it's ^\.
338 SIMPLE(99, Control_backslash)
339
340 SIMPLE(119, Pause)
341 # Ctrl-Break seems to have low-level hardware behind it.
342 SIMPLE(101, Break)
343
344 SIMPLE(110, Insert)
345 SIMPLE(102, Find)
346 keycode 104 = Prior Scroll_Backward
347 SIMPLE(111, Remove)
348 SIMPLE(107, Select)
349 keycode 109 = Next Scroll_Forward
350
351 SIMPLE(103, Up)
352 SIMPLE(105, Left)
353 alt keycode 105 = Decr_Console
354 SIMPLE(106, Right)
355 alt keycode 106 = Incr_Console
356 SIMPLE(108, Down)
357
358 control alt keycode 83 = Boot
359 control alt keycode 111 = Boot
360
361
362 # Stock VT102 string definitions.
363 string F1 = "\033[[A"
364 string F2 = "\033[[B"
365 string F3 = "\033[[C"
366 string F4 = "\033[[D"
367 string F5 = "\033[[E"
368 string F6 = "\033[17~"
369 string F7 = "\033[18~"
370 string F8 = "\033[19~"
371 string F9 = "\033[20~"
372 string F10 = "\033[21~"
373 string F11 = "\033[23~"
374 string F12 = "\033[24~"
375 string F13 = "\033[25~"
376 string F14 = "\033[26~"
377 string F15 = "\033[28~"
378 string F16 = "\033[29~"
379 string F17 = "\033[31~"
380 string F18 = "\033[32~"
381 string F19 = "\033[33~"
382 string F20 = "\033[34~"
383 string Find = "\033[1~"
384 string Insert = "\033[2~"
385 string Remove = "\033[3~"
386 string Select = "\033[4~"
387 string Prior = "\033[5~"
388 string Next = "\033[6~"
389 string Macro = "\033[M"
390 string Pause = "\033[P"
391
392 # Stock ISO-8859-1 compositions.
393 changequote()dnl
394 compose '`' 'A' to 'À'
395 compose '`' 'a' to 'à'
396 compose '\'' 'A' to 'Á'
397 compose '\'' 'a' to 'á'
398 compose '^' 'A' to 'Â'
399 compose '^' 'a' to 'â'
400 compose '~' 'A' to 'Ã'
401 compose '~' 'a' to 'ã'
402 compose '"' 'A' to 'Ä'
403 compose '"' 'a' to 'ä'
404 compose 'O' 'A' to 'Å'
405 compose 'o' 'a' to 'å'
406 compose '0' 'A' to 'Å'
407 compose '0' 'a' to 'å'
408 compose 'A' 'A' to 'Å'
409 compose 'a' 'a' to 'å'
410 compose 'A' 'E' to 'Æ'
411 compose 'a' 'e' to 'æ'
412 compose ',' 'C' to 'Ç'
413 compose ',' 'c' to 'ç'
414 compose '`' 'E' to 'È'
415 compose '`' 'e' to 'è'
416 compose '\'' 'E' to 'É'
417 compose '\'' 'e' to 'é'
418 compose '^' 'E' to 'Ê'
419 compose '^' 'e' to 'ê'
420 compose '"' 'E' to 'Ë'
421 compose '"' 'e' to 'ë'
422 compose '`' 'I' to 'Ì'
423 compose '`' 'i' to 'ì'
424 compose '\'' 'I' to 'Í'
425 compose '\'' 'i' to 'í'
426 compose '^' 'I' to 'Î'
427 compose '^' 'i' to 'î'
428 compose '"' 'I' to 'Ï'
429 compose '"' 'i' to 'ï'
430 compose '-' 'D' to 'Ð'
431 compose '-' 'd' to 'ð'
432 compose '~' 'N' to 'Ñ'
433 compose '~' 'n' to 'ñ'
434 compose '`' 'O' to 'Ò'
435 compose '`' 'o' to 'ò'
436 compose '\'' 'O' to 'Ó'
437 compose '\'' 'o' to 'ó'
438 compose '^' 'O' to 'Ô'
439 compose '^' 'o' to 'ô'
440 compose '~' 'O' to 'Õ'
441 compose '~' 'o' to 'õ'
442 compose '"' 'O' to 'Ö'
443 compose '"' 'o' to 'ö'
444 compose '/' 'O' to 'Ø'
445 compose '/' 'o' to 'ø'
446 compose '`' 'U' to 'Ù'
447 compose '`' 'u' to 'ù'
448 compose '\'' 'U' to 'Ú'
449 compose '\'' 'u' to 'ú'
450 compose '^' 'U' to 'Û'
451 compose '^' 'u' to 'û'
452 compose '"' 'U' to 'Ü'
453 compose '"' 'u' to 'ü'
454 compose '\'' 'Y' to 'Ý'
455 compose '\'' 'y' to 'ý'
456 compose 'T' 'H' to 'Þ'
457 compose 't' 'h' to 'þ'
458 compose 's' 's' to 'ß'
459 compose '"' 'y' to 'ÿ'
460 compose 's' 'z' to 'ß'
461 compose 'i' 'j' to 'ÿ'
462
463 # ISO-8859-3 compositions for Esperanto.
464 compose 'C' 'x' to 'Æ' #198
465 compose 'G' 'x' to 'Ø' #216
466 compose 'H' 'x' to '¦' #166
467 compose 'J' 'x' to '¬' #172
468 compose 'S' 'x' to 'Þ' #222
469 compose 'U' 'x' to 'Ý' #221
470 compose 'c' 'x' to 'æ' #230
471 compose 'g' 'x' to 'ø' #248
472 compose 'h' 'x' to '¶' #182
473 compose 'j' 'x' to '¼' #188
474 compose 's' 'x' to 'þ' #254
475 compose 'u' 'x' to 'ý' #253