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.

qwerty.chargen.dhall 9.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  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 qwerty =
  52. [ Map::{
  53. , mod1 = False
  54. , mod2 = False
  55. , mod3 = False
  56. , mod4 = False
  57. , keys = toMap
  58. { KEY_1 = Key.Code 49
  59. , KEY_2 = Key.Code 50
  60. , KEY_3 = Key.Code 51
  61. , KEY_4 = Key.Code 52
  62. , KEY_5 = Key.Code 53
  63. , KEY_6 = Key.Code 54
  64. , KEY_7 = Key.Code 55
  65. , KEY_8 = Key.Code 56
  66. , KEY_9 = Key.Code 57
  67. , KEY_0 = Key.Code 48
  68. , KEY_MINUS = Key.Code 45
  69. , KEY_EQUAL = Key.Code 61
  70. , KEY_Q = Key.Code 113
  71. , KEY_W = Key.Code 119
  72. , KEY_E = Key.Code 101
  73. , KEY_R = Key.Code 114
  74. , KEY_T = Key.Code 116
  75. , KEY_Y = Key.Code 121
  76. , KEY_U = Key.Code 117
  77. , KEY_I = Key.Code 105
  78. , KEY_O = Key.Code 111
  79. , KEY_P = Key.Code 112
  80. , KEY_LEFTBRACE = Key.Code 91
  81. , KEY_RIGHTBRACE = Key.Code 93
  82. , KEY_A = Key.Code 97
  83. , KEY_S = Key.Code 115
  84. , KEY_D = Key.Code 100
  85. , KEY_F = Key.Code 102
  86. , KEY_G = Key.Code 103
  87. , KEY_H = Key.Code 104
  88. , KEY_J = Key.Code 106
  89. , KEY_K = Key.Code 107
  90. , KEY_L = Key.Code 108
  91. , KEY_SEMICOLON = Key.Code 59
  92. , KEY_APOSTROPHE = Key.Code 39
  93. , KEY_GRAVE = Key.Code 96
  94. , KEY_BACKSLASH = Key.Code 92
  95. , KEY_Z = Key.Code 122
  96. , KEY_X = Key.Code 120
  97. , KEY_C = Key.Code 99
  98. , KEY_V = Key.Code 118
  99. , KEY_B = Key.Code 98
  100. , KEY_N = Key.Code 110
  101. , KEY_M = Key.Code 109
  102. , KEY_COMMA = Key.Code 44
  103. , KEY_DOT = Key.Code 46
  104. , KEY_SLASH = Key.Code 47
  105. , KEY_KPASTERISK = Key.Code 42
  106. , KEY_SPACE = Key.Code 32
  107. , KEY_KP7 = Key.Code 55
  108. , KEY_KP8 = Key.Code 56
  109. , KEY_KP9 = Key.Code 57
  110. , KEY_KPMINUS = Key.Code 45
  111. , KEY_KP4 = Key.Code 52
  112. , KEY_KP5 = Key.Code 53
  113. , KEY_KP6 = Key.Code 54
  114. , KEY_KPPLUS = Key.Code 43
  115. , KEY_KP1 = Key.Code 49
  116. , KEY_KP2 = Key.Code 50
  117. , KEY_KP3 = Key.Code 51
  118. , KEY_KP0 = Key.Code 48
  119. , KEY_KPDOT = Key.Code 46
  120. , KEY_102ND = Key.Code 60
  121. , KEY_KPSLASH = Key.Code 47
  122. , KEY_ESC = Key.Ascii 27
  123. , KEY_BACKSPACE = Key.Ascii 8
  124. , KEY_TAB = Key.Ascii 9
  125. , KEY_ENTER = Key.Ascii 10
  126. , KEY_KPENTER = Key.Ascii 10
  127. , KEY_DELETE = Key.Ascii 127
  128. }
  129. }
  130. , Map::{
  131. , mod1 = True
  132. , mod2 = False
  133. , mod3 = False
  134. , mod4 = False
  135. , keys = toMap
  136. { KEY_1 = Key.Code 33
  137. , KEY_2 = Key.Code 64
  138. , KEY_3 = Key.Code 35
  139. , KEY_4 = Key.Code 36
  140. , KEY_5 = Key.Code 37
  141. , KEY_6 = Key.Code 94
  142. , KEY_7 = Key.Code 38
  143. , KEY_8 = Key.Code 42
  144. , KEY_9 = Key.Code 40
  145. , KEY_0 = Key.Code 41
  146. , KEY_MINUS = Key.Code 95
  147. , KEY_EQUAL = Key.Code 43
  148. , KEY_Q = Key.Code 81
  149. , KEY_W = Key.Code 87
  150. , KEY_E = Key.Code 69
  151. , KEY_R = Key.Code 82
  152. , KEY_T = Key.Code 84
  153. , KEY_Y = Key.Code 89
  154. , KEY_U = Key.Code 85
  155. , KEY_I = Key.Code 73
  156. , KEY_O = Key.Code 79
  157. , KEY_P = Key.Code 80
  158. , KEY_LEFTBRACE = Key.Code 123
  159. , KEY_RIGHTBRACE = Key.Code 125
  160. , KEY_A = Key.Code 65
  161. , KEY_S = Key.Code 83
  162. , KEY_D = Key.Code 68
  163. , KEY_F = Key.Code 70
  164. , KEY_G = Key.Code 71
  165. , KEY_H = Key.Code 72
  166. , KEY_J = Key.Code 74
  167. , KEY_K = Key.Code 75
  168. , KEY_L = Key.Code 76
  169. , KEY_SEMICOLON = Key.Code 58
  170. , KEY_APOSTROPHE = Key.Code 34
  171. , KEY_GRAVE = Key.Code 126
  172. , KEY_BACKSLASH = Key.Code 124
  173. , KEY_Z = Key.Code 90
  174. , KEY_X = Key.Code 88
  175. , KEY_C = Key.Code 67
  176. , KEY_V = Key.Code 86
  177. , KEY_B = Key.Code 66
  178. , KEY_N = Key.Code 78
  179. , KEY_M = Key.Code 77
  180. , KEY_COMMA = Key.Code 60
  181. , KEY_DOT = Key.Code 62
  182. , KEY_SLASH = Key.Code 63
  183. , KEY_KPASTERISK = Key.Code 42
  184. , KEY_KPMINUS = Key.Code 45
  185. , KEY_KPPLUS = Key.Code 43
  186. , KEY_102ND = Key.Code 62
  187. , KEY_KPSLASH = Key.Code 47
  188. }
  189. }
  190. , Map::{
  191. , mod1 = False
  192. , mod2 = False
  193. , mod3 = True
  194. , mod4 = False
  195. , keys = toMap { KEY_5 = Key.Code 8364, KEY_102ND = Key.Code 124 }
  196. }
  197. , Map::{
  198. , mod1 = False
  199. , mod2 = False
  200. , mod3 = False
  201. , mod4 = True
  202. , keys = toMap
  203. { KEY_Q = Key.Code 81
  204. , KEY_W = Key.Code 87
  205. , KEY_E = Key.Code 69
  206. , KEY_R = Key.Code 82
  207. , KEY_T = Key.Code 84
  208. , KEY_Y = Key.Code 89
  209. , KEY_U = Key.Code 85
  210. , KEY_I = Key.Code 73
  211. , KEY_O = Key.Code 79
  212. , KEY_P = Key.Code 80
  213. , KEY_A = Key.Code 65
  214. , KEY_S = Key.Code 83
  215. , KEY_D = Key.Code 68
  216. , KEY_F = Key.Code 70
  217. , KEY_G = Key.Code 71
  218. , KEY_H = Key.Code 72
  219. , KEY_J = Key.Code 74
  220. , KEY_K = Key.Code 75
  221. , KEY_L = Key.Code 76
  222. , KEY_Z = Key.Code 90
  223. , KEY_X = Key.Code 88
  224. , KEY_C = Key.Code 67
  225. , KEY_V = Key.Code 86
  226. , KEY_B = Key.Code 66
  227. , KEY_N = Key.Code 78
  228. , KEY_M = Key.Code 77
  229. }
  230. }
  231. , Map::{
  232. , mod1 = True
  233. , mod2 = False
  234. , mod3 = False
  235. , mod4 = True
  236. , keys = toMap
  237. { KEY_1 = Key.Code 33
  238. , KEY_2 = Key.Code 64
  239. , KEY_3 = Key.Code 35
  240. , KEY_4 = Key.Code 36
  241. , KEY_5 = Key.Code 37
  242. , KEY_6 = Key.Code 94
  243. , KEY_7 = Key.Code 38
  244. , KEY_8 = Key.Code 42
  245. , KEY_9 = Key.Code 40
  246. , KEY_0 = Key.Code 41
  247. , KEY_MINUS = Key.Code 95
  248. , KEY_EQUAL = Key.Code 43
  249. , KEY_Q = Key.Code 113
  250. , KEY_W = Key.Code 119
  251. , KEY_E = Key.Code 101
  252. , KEY_R = Key.Code 114
  253. , KEY_T = Key.Code 116
  254. , KEY_Y = Key.Code 121
  255. , KEY_U = Key.Code 117
  256. , KEY_I = Key.Code 105
  257. , KEY_O = Key.Code 111
  258. , KEY_P = Key.Code 112
  259. , KEY_LEFTBRACE = Key.Code 123
  260. , KEY_RIGHTBRACE = Key.Code 125
  261. , KEY_A = Key.Code 97
  262. , KEY_S = Key.Code 115
  263. , KEY_D = Key.Code 100
  264. , KEY_F = Key.Code 102
  265. , KEY_G = Key.Code 103
  266. , KEY_H = Key.Code 104
  267. , KEY_J = Key.Code 106
  268. , KEY_K = Key.Code 107
  269. , KEY_L = Key.Code 108
  270. , KEY_SEMICOLON = Key.Code 58
  271. , KEY_APOSTROPHE = Key.Code 34
  272. , KEY_GRAVE = Key.Code 126
  273. , KEY_BACKSLASH = Key.Code 124
  274. , KEY_Z = Key.Code 122
  275. , KEY_X = Key.Code 120
  276. , KEY_C = Key.Code 99
  277. , KEY_V = Key.Code 118
  278. , KEY_B = Key.Code 98
  279. , KEY_N = Key.Code 110
  280. , KEY_M = Key.Code 109
  281. , KEY_COMMA = Key.Code 60
  282. , KEY_DOT = Key.Code 62
  283. , KEY_SLASH = Key.Code 63
  284. , KEY_102ND = Key.Code 62
  285. }
  286. }
  287. ]
  288. in Prelude.List.map Map.Type XML.Type mapToXML qwerty