multiple_actions 5.5 KB

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