Debian Codegraph @

test/data/symbols/multiple_actions

raw
1 default alphanumeric_keys modifier_keys
2 xkb_symbols "basic" {
3 name[1] = "Multiple actions";
4
5 virtual_modifiers Alt, Super, LevelThree;
6
7 // Multiple keysyms but no actions: OK
8 key <LCTL> {
9 symbols[1] = [ { Control_L, ISO_Group_Shift } ]
10 };
11 // Multiple actions but no keysyms: OK, but will use NoSymbol
12 key <RCTL> {
13 actions[1] = [ { SetMods(modifiers=Control), SetGroup(group=+1) } ]
14 };
15 // Multiple keysyms and matching actions
16 key <LVL3> {
17 virtualModifiers = LevelThree,
18 symbols[1] = [ { ISO_Level3_Shift, ISO_Group_Shift } ],
19 actions[1] = [ { SetMods(modifiers=LevelThree), SetGroup(group=+1) } ]
20 };
21 // Multiple actions and matching keysyms
22 key <MDSW> {
23 virtualModifiers = LevelThree,
24 actions[1] = [ { SetMods(modifiers=LevelThree), SetGroup(group=+1) } ],
25 symbols[1] = [ { ISO_Level3_Shift, ISO_Group_Shift } ]
26 };
27
28 // Different actions and keysyms count
29 key <LALT> {
30 symbols[1] = [ Alt_L ],
31 actions[1] = [ { SetMods(modifiers=Alt), SetGroup(group=+1) } ]
32 };
33 key <RALT> {
34 symbols[1] = [ { Alt_R, ISO_Group_Shift } ],
35 actions[1] = [ SetMods(modifiers=Alt) ]
36 };
37 key <LWIN> {
38 symbols[1] = [ { Super_L, ISO_Group_Shift } ],
39 actions[1] = [ { SetMods(modifiers=Super), SetGroup(group=+1), NoAction() } ]
40 };
41 key <RWIN> {
42 symbols[1] = [ { Super_R, ISO_Group_Shift , NoSymbol } ],
43 actions[1] = [ { SetMods(modifiers=Super), SetGroup(group=+1) } ]
44 };
45
46 // Incompatible categories
47 key <AB11> {
48 symbols[1] = [ { Control_L, Shift_L } ]
49 };
50 modifier_map Control { <AB11> };
51 key <AE13> {
52 symbols[1] = [ { Control_L, Shift_L } ],
53 actions[1] = [ { SetMods(modifiers=Control), SetMods(modifiers=Shift) } ]
54 };
55
56 // Various overrides, different keysyms, no explicit actions
57 key <AB01> { [ x ] };
58 key <AB01> { [ { Control_L, ISO_Group_Shift } ] };
59
60 key <AB02> { [ { Control_L, ISO_Group_Shift } ] };
61 key <AB02> { [ x ] };
62
63 // Various overrides, no keysyms, explicit actions
64 key <AB03> { actions[1] = [ SetMods(modifiers=LevelThree) ] };
65 key <AB03> { actions[1] = [ { SetMods(modifiers=LevelThree), SetGroup(group=+1) } ] };
66
67 key <AB04> { actions[1] = [ { SetMods(modifiers=LevelThree), SetGroup(group=+1) } ] };
68 key <AB04> { actions[1] = [ SetMods(modifiers=LevelThree) ] };
69
70 // Various overrides, different keysyms & actions
71 key <AB05> {
72 virtualModifiers = LevelThree,
73 symbols[1] = [ Control_L ],
74 actions[1] = [ SetMods(modifiers=Control) ]
75 };
76 key <AB05> {
77 symbols[1] = [ { ISO_Level3_Shift, ISO_Group_Shift } ],
78 actions[1] = [ { SetMods(modifiers=LevelThree), SetGroup(group=+1) } ]
79 };
80
81 key <AB06> {
82 virtualModifiers = LevelThree,
83 symbols[1] = [ { ISO_Level3_Shift, ISO_Group_Shift } ],
84 actions[1] = [ { SetMods(modifiers=LevelThree), SetGroup(group=+1) } ]
85 };
86 key <AB06> {
87 symbols[1] = [ Control_L ],
88 actions[1] = [ SetMods(modifiers=Control) ]
89 };
90
91 // Various overrides, same keysyms but different actions
92 key <AB07> {
93 virtualModifiers = LevelThree,
94 symbols[1] = [ { ISO_Level3_Shift, ISO_Group_Shift } ],
95 actions[1] = [ { SetMods(modifiers=Control), Private(type=254, data="foo") } ]
96 };
97 key <AB07> {
98 symbols[1] = [ { ISO_Level3_Shift, ISO_Group_Shift } ],
99 actions[1] = [ { SetMods(modifiers=LevelThree), SetGroup(group=+1) } ]
100 };
101
102 // Mix various number of keysyms/actions
103 key <AC01> {
104 symbols[1] = [ ISO_Level3_Shift , { ISO_Level3_Shift, ISO_Group_Shift } ]
105 };
106 key <AC02> {
107 actions[1] = [ SetMods(modifiers=LevelThree), { SetMods(modifiers=LevelThree), SetGroup(group=+1) } ]
108 };
109 key <AC03> {
110 symbols[1] = [ ISO_Level3_Shift , { ISO_Level3_Shift, ISO_Group_Shift } ],
111 actions[1] = [ SetMods(modifiers=LevelThree), { SetMods(modifiers=LevelThree), SetGroup(group=+1) } ]
112 };
113 key <AC04> {
114 symbols[1] = [ { ISO_Level3_Shift, ISO_Group_Shift }, ISO_Level3_Shift ]
115 };
116 key <AC05> {
117 actions[1] = [ { SetMods(modifiers=LevelThree), SetGroup(group=+1) }, SetMods(modifiers=LevelThree) ]
118 };
119 key <AC06> {
120 symbols[1] = [ { ISO_Level3_Shift, ISO_Group_Shift }, ISO_Level3_Shift ],
121 actions[1] = [ { SetMods(modifiers=LevelThree), SetGroup(group=+1) }, SetMods(modifiers=LevelThree) ]
122 };
123 key <AC07> {
124 symbols[1] = [ ISO_Level3_Shift , { ISO_Level3_Shift, ISO_Group_Shift }, { ISO_Level3_Shift, ISO_Group_Shift } ]
125 };
126 key <AC08> {
127 actions[1] = [ SetMods(modifiers=LevelThree), { SetMods(modifiers=LevelThree), SetGroup(group=+1) }, { SetMods(modifiers=LevelThree), SetGroup(group=+1) } ]
128 };
129 key <AC09> {
130 symbols[1] = [ ISO_Level3_Shift , { ISO_Level3_Shift, ISO_Group_Shift }, { ISO_Level3_Shift, ISO_Group_Shift } ],
131 actions[1] = [ SetMods(modifiers=LevelThree), { SetMods(modifiers=LevelThree), SetGroup(group=+1) }, { SetMods(modifiers=LevelThree), SetGroup(group=+1) } ]
132 };
133
134 // Using modifier_map (may trigger multiple interprets)
135 key <AD01> { symbols[1] = [ { a, b } ] };
136 modifier_map Shift { <AD01> };
137
138 // Our only alphanum key ✨
139 key <AE02> { [ 2, at ] };
140 };