• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1default partial xkb_types "pc" {
2    type "KEYPAD" {
3	modifiers = Shift+NumLock;
4	map[None] = Level1;
5	map[Shift] = Level2;
6	map[NumLock] = Level2;
7	map[Shift+NumLock] = Level1;
8	level_name[Level1] = "Base";
9	level_name[Level2] = "Number";
10    };
11    include "extra(keypad)"
12};
13
14// On Mac keypads, level 1 and 2 are swapped.
15partial xkb_types "mac" {
16    type "KEYPAD" {
17	modifiers = None;
18	map[None] = Level2;
19	level_name[Level2] = "Number";
20    };
21    include "extra(keypad)"
22};
23
24partial xkb_types "microsoft" {
25    type "KEYPAD" {
26        modifiers = Shift+NumLock;
27        map[None] = Level1;
28        preserve[Shift] = Shift;
29        map[NumLock] = Level2;
30        level_name[Level1] = "Base";
31        level_name[Level2] = "Number";
32    };
33    include "extra(keypad)"
34};
35
36// Swiss-German style numeric keypad: Shift and NumLock operate as
37// two independent modifiers; however, since we want shift state for
38// the cursor keys, only three levels are used from the key mappings.
39// Closest type is actually FOUR_LEVEL_X, but most numpad layouts use
40// FOUR_LEVEL_MIXED_KEYPAD, so that's the one we are going to override.
41partial xkb_types "shift3" {
42    type "FOUR_LEVEL_MIXED_KEYPAD" {
43        modifiers = Shift+NumLock+Control+Alt;
44
45        // NumLock Off => navigate using cursor keys
46        map[None] = Level1;
47
48        // NumLock Off + Shift pressed => select using cursor keys
49        preserve[Shift] = Shift;
50
51        // NumLock On => decimal digits
52        map[NumLock] = Level2;
53
54        // NumLock On + Shift pressed => auxiliary symbols,
55        // e.g. hexadecimal digits
56        map[Shift+NumLock] = Level3;
57
58        // Ctrl + Alt, regardless of NumLock and Shift => command keys
59        map[Control+Alt] = Level4;
60
61        // reverse map from levels to modifiers
62        level_name[Level1] = "Base";
63        level_name[Level2] = "NumLock";
64        level_name[Level3] = "Shift+NumLock";
65        level_name[Level4] = "Ctrl+Alt";
66    };
67};
68