Genode Packages collection https://git.sr.ht/~ehmry/genodepkgs/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

workman.chargen.dhall 7.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. let Genode = env:DHALL_GENODE
  2. let Prelude = Genode.Prelude
  3. let XML = Prelude.XML
  4. let Key = < Ascii : Natural | Char : Text | Code : Natural > : Type
  5. let Map =
  6. { Type =
  7. { keys : Prelude.Map.Type Text Key
  8. , mod1 : Bool
  9. , mod2 : Bool
  10. , mod3 : Bool
  11. , mod4 : Bool
  12. }
  13. , default = { mod1 = False, mod2 = False, mod3 = False, mod4 = False }
  14. }
  15. let boolToAttr = λ(_ : Bool) → if _ then "yes" else "no"
  16. let keyToXML =
  17. λ(x : Prelude.Map.Entry Text Key) →
  18. XML.leaf
  19. { name = "key"
  20. , attributes =
  21. [ merge
  22. { Ascii =
  23. λ(_ : Natural) →
  24. { mapKey = "ascii", mapValue = Prelude.Natural.show _ }
  25. , Char = λ(_ : Text) → { mapKey = "char", mapValue = _ }
  26. , Code =
  27. λ(_ : Natural) →
  28. { mapKey = "code", mapValue = Prelude.Natural.show _ }
  29. }
  30. x.mapValue
  31. , { mapKey = "name", mapValue = x.mapKey }
  32. ]
  33. }
  34. let mapToXML =
  35. λ(map : Map.Type) →
  36. XML.element
  37. { name = "map"
  38. , attributes = toMap
  39. { mod1 = boolToAttr map.mod1
  40. , mod2 = boolToAttr map.mod2
  41. , mod3 = boolToAttr map.mod3
  42. , mod4 = boolToAttr map.mod4
  43. }
  44. , content =
  45. Prelude.List.map
  46. (Prelude.Map.Entry Text Key)
  47. XML.Type
  48. keyToXML
  49. map.keys
  50. }
  51. let workman =
  52. [ Map::{
  53. , keys = toMap
  54. { KEY_ESC = Key.Ascii 27
  55. , KEY_1 = Key.Char "1"
  56. , KEY_2 = Key.Char "2"
  57. , KEY_3 = Key.Char "3"
  58. , KEY_4 = Key.Char "4"
  59. , KEY_5 = Key.Char "5"
  60. , KEY_6 = Key.Char "6"
  61. , KEY_7 = Key.Char "7"
  62. , KEY_8 = Key.Char "8"
  63. , KEY_9 = Key.Char "9"
  64. , KEY_0 = Key.Char "0"
  65. , KEY_MINUS = Key.Char "-"
  66. , KEY_EQUAL = Key.Char "="
  67. , KEY_BACKSPACE = Key.Ascii 8
  68. , KEY_TAB = Key.Ascii 9
  69. , KEY_Q = Key.Char "q"
  70. , KEY_W = Key.Char "d"
  71. , KEY_E = Key.Char "r"
  72. , KEY_R = Key.Char "w"
  73. , KEY_T = Key.Char "b"
  74. , KEY_Y = Key.Char "j"
  75. , KEY_U = Key.Char "f"
  76. , KEY_I = Key.Char "u"
  77. , KEY_O = Key.Char "p"
  78. , KEY_P = Key.Char ";"
  79. , KEY_LEFTBRACE = Key.Char "["
  80. , KEY_RIGHTBRACE = Key.Char "]"
  81. , KEY_ENTER = Key.Ascii 10
  82. , KEY_A = Key.Char "a"
  83. , KEY_S = Key.Char "s"
  84. , KEY_D = Key.Char "h"
  85. , KEY_F = Key.Char "t"
  86. , KEY_G = Key.Char "g"
  87. , KEY_H = Key.Char "y"
  88. , KEY_J = Key.Char "n"
  89. , KEY_K = Key.Char "e"
  90. , KEY_L = Key.Char "o"
  91. , KEY_SEMICOLON = Key.Char "i"
  92. , KEY_APOSTROPHE = Key.Char "'"
  93. , KEY_GRAVE = Key.Char "`"
  94. , KEY_BACKSLASH = Key.Ascii 92
  95. , KEY_Z = Key.Char "z"
  96. , KEY_X = Key.Char "x"
  97. , KEY_C = Key.Char "m"
  98. , KEY_V = Key.Char "c"
  99. , KEY_B = Key.Char "v"
  100. , KEY_N = Key.Char "k"
  101. , KEY_M = Key.Char "l"
  102. , KEY_COMMA = Key.Char ","
  103. , KEY_DOT = Key.Char "."
  104. , KEY_SLASH = Key.Char "/"
  105. , KEY_SPACE = Key.Char " "
  106. , KEY_KP7 = Key.Char "7"
  107. , KEY_KP8 = Key.Char "8"
  108. , KEY_KP9 = Key.Char "9"
  109. , KEY_KPMINUS = Key.Char "-"
  110. , KEY_KP4 = Key.Char "4"
  111. , KEY_KP5 = Key.Char "5"
  112. , KEY_KP6 = Key.Char "6"
  113. , KEY_KPPLUS = Key.Char "+"
  114. , KEY_KP1 = Key.Char "1"
  115. , KEY_KP2 = Key.Char "2"
  116. , KEY_KP3 = Key.Char "3"
  117. , KEY_KP0 = Key.Char "0"
  118. , KEY_KPDOT = Key.Char "."
  119. , KEY_KPENTER = Key.Ascii 10
  120. , KEY_KPSLASH = Key.Char "/"
  121. }
  122. }
  123. , Map::{
  124. , mod1 = True
  125. , keys = toMap
  126. { KEY_1 = Key.Char "!"
  127. , KEY_2 = Key.Char "@"
  128. , KEY_3 = Key.Char "#"
  129. , KEY_4 = Key.Char "\$"
  130. , KEY_5 = Key.Char "%"
  131. , KEY_6 = Key.Char "^"
  132. , KEY_7 = Key.Ascii 38
  133. , KEY_8 = Key.Char "*"
  134. , KEY_9 = Key.Char "("
  135. , KEY_0 = Key.Char ")"
  136. , KEY_MINUS = Key.Char "_"
  137. , KEY_EQUAL = Key.Char "+"
  138. , KEY_Q = Key.Char "Q"
  139. , KEY_W = Key.Char "D"
  140. , KEY_E = Key.Char "R"
  141. , KEY_R = Key.Char "W"
  142. , KEY_T = Key.Char "B"
  143. , KEY_Y = Key.Char "J"
  144. , KEY_U = Key.Char "F"
  145. , KEY_I = Key.Char "U"
  146. , KEY_O = Key.Char "P"
  147. , KEY_P = Key.Char ":"
  148. , KEY_LEFTBRACE = Key.Char "{"
  149. , KEY_RIGHTBRACE = Key.Char "}"
  150. , KEY_A = Key.Char "A"
  151. , KEY_S = Key.Char "S"
  152. , KEY_D = Key.Char "H"
  153. , KEY_F = Key.Char "T"
  154. , KEY_G = Key.Char "G"
  155. , KEY_H = Key.Char "Y"
  156. , KEY_J = Key.Char "N"
  157. , KEY_K = Key.Char "E"
  158. , KEY_L = Key.Char "O"
  159. , KEY_SEMICOLON = Key.Char "I"
  160. , KEY_APOSTROPHE = Key.Ascii 34
  161. , KEY_GRAVE = Key.Char "~"
  162. , KEY_BACKSLASH = Key.Char "|"
  163. , KEY_Z = Key.Char "Z"
  164. , KEY_X = Key.Char "X"
  165. , KEY_C = Key.Char "M"
  166. , KEY_V = Key.Char "C"
  167. , KEY_B = Key.Char "V"
  168. , KEY_N = Key.Char "K"
  169. , KEY_M = Key.Char "L"
  170. , KEY_COMMA = Key.Ascii 60
  171. , KEY_DOT = Key.Ascii 62
  172. , KEY_SLASH = Key.Char "?"
  173. }
  174. }
  175. , Map::{
  176. , mod2 = True
  177. , keys = toMap
  178. { KEY_A = Key.Ascii 1
  179. , KEY_B = Key.Ascii 22
  180. , KEY_C = Key.Ascii 13
  181. , KEY_D = Key.Ascii 8
  182. , KEY_E = Key.Ascii 18
  183. , KEY_F = Key.Ascii 20
  184. , KEY_G = Key.Ascii 7
  185. , KEY_H = Key.Ascii 25
  186. , KEY_I = Key.Ascii 21
  187. , KEY_J = Key.Ascii 14
  188. , KEY_K = Key.Ascii 5
  189. , KEY_L = Key.Ascii 15
  190. , KEY_M = Key.Ascii 12
  191. , KEY_N = Key.Ascii 11
  192. , KEY_O = Key.Ascii 16
  193. , KEY_P = Key.Ascii 9
  194. , KEY_Q = Key.Ascii 17
  195. , KEY_R = Key.Ascii 23
  196. , KEY_S = Key.Ascii 19
  197. , KEY_T = Key.Ascii 2
  198. , KEY_U = Key.Ascii 6
  199. , KEY_V = Key.Ascii 3
  200. , KEY_W = Key.Ascii 4
  201. , KEY_X = Key.Ascii 24
  202. , KEY_Y = Key.Ascii 10
  203. , KEY_Z = Key.Ascii 26
  204. }
  205. }
  206. , Map::{
  207. , mod3 = True
  208. , keys = toMap
  209. { KEY_4 = Key.Code 8364
  210. , KEY_A = Key.Code 228
  211. , KEY_S = Key.Code 223
  212. , KEY_I = Key.Code 252
  213. , KEY_DOT = Key.Code 8230
  214. , KEY_K = Key.Code 235
  215. , KEY_C = Key.Code 181
  216. , KEY_L = Key.Code 246
  217. }
  218. }
  219. , Map::{
  220. , mod1 = True
  221. , mod3 = True
  222. , keys = toMap
  223. { KEY_0 = Key.Code 8320
  224. , KEY_1 = Key.Code 8321
  225. , KEY_2 = Key.Code 8322
  226. , KEY_3 = Key.Code 8323
  227. , KEY_4 = Key.Code 8324
  228. , KEY_5 = Key.Code 8325
  229. , KEY_6 = Key.Code 8326
  230. , KEY_7 = Key.Code 8327
  231. , KEY_8 = Key.Code 8328
  232. , KEY_9 = Key.Code 8329
  233. }
  234. }
  235. ]
  236. in Prelude.List.map Map.Type XML.Type mapToXML workman