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.
 
 
 
 
 

297 lines
9.3 KiB

let Genode = env:DHALL_GENODE
let Prelude = Genode.Prelude
let XML = Prelude.XML
let Key = < Ascii : Natural | Char : Text | Code : Natural > : Type
let Map =
{ Type =
{ keys : Prelude.Map.Type Text Key
, mod1 : Bool
, mod2 : Bool
, mod3 : Bool
, mod4 : Bool
}
, default = { mod1 = False, mod2 = False, mod3 = False, mod4 = False }
}
let boolToAttr = λ(_ : Bool) → if _ then "yes" else "no"
let keyToXML =
λ(x : Prelude.Map.Entry Text Key) →
XML.leaf
{ name = "key"
, attributes =
[ merge
{ Ascii =
λ(_ : Natural) →
{ mapKey = "ascii", mapValue = Prelude.Natural.show _ }
, Char = λ(_ : Text) → { mapKey = "char", mapValue = _ }
, Code =
λ(_ : Natural) →
{ mapKey = "code", mapValue = Prelude.Natural.show _ }
}
x.mapValue
, { mapKey = "name", mapValue = x.mapKey }
]
}
let mapToXML =
λ(map : Map.Type) →
XML.element
{ name = "map"
, attributes = toMap
{ mod1 = boolToAttr map.mod1
, mod2 = boolToAttr map.mod2
, mod3 = boolToAttr map.mod3
, mod4 = boolToAttr map.mod4
}
, content =
Prelude.List.map
(Prelude.Map.Entry Text Key)
XML.Type
keyToXML
map.keys
}
let qwerty =
[ Map::{
, mod1 = False
, mod2 = False
, mod3 = False
, mod4 = False
, keys = toMap
{ KEY_1 = Key.Code 49
, KEY_2 = Key.Code 50
, KEY_3 = Key.Code 51
, KEY_4 = Key.Code 52
, KEY_5 = Key.Code 53
, KEY_6 = Key.Code 54
, KEY_7 = Key.Code 55
, KEY_8 = Key.Code 56
, KEY_9 = Key.Code 57
, KEY_0 = Key.Code 48
, KEY_MINUS = Key.Code 45
, KEY_EQUAL = Key.Code 61
, KEY_Q = Key.Code 113
, KEY_W = Key.Code 119
, KEY_E = Key.Code 101
, KEY_R = Key.Code 114
, KEY_T = Key.Code 116
, KEY_Y = Key.Code 121
, KEY_U = Key.Code 117
, KEY_I = Key.Code 105
, KEY_O = Key.Code 111
, KEY_P = Key.Code 112
, KEY_LEFTBRACE = Key.Code 91
, KEY_RIGHTBRACE = Key.Code 93
, KEY_A = Key.Code 97
, KEY_S = Key.Code 115
, KEY_D = Key.Code 100
, KEY_F = Key.Code 102
, KEY_G = Key.Code 103
, KEY_H = Key.Code 104
, KEY_J = Key.Code 106
, KEY_K = Key.Code 107
, KEY_L = Key.Code 108
, KEY_SEMICOLON = Key.Code 59
, KEY_APOSTROPHE = Key.Code 39
, KEY_GRAVE = Key.Code 96
, KEY_BACKSLASH = Key.Code 92
, KEY_Z = Key.Code 122
, KEY_X = Key.Code 120
, KEY_C = Key.Code 99
, KEY_V = Key.Code 118
, KEY_B = Key.Code 98
, KEY_N = Key.Code 110
, KEY_M = Key.Code 109
, KEY_COMMA = Key.Code 44
, KEY_DOT = Key.Code 46
, KEY_SLASH = Key.Code 47
, KEY_KPASTERISK = Key.Code 42
, KEY_SPACE = Key.Code 32
, KEY_KP7 = Key.Code 55
, KEY_KP8 = Key.Code 56
, KEY_KP9 = Key.Code 57
, KEY_KPMINUS = Key.Code 45
, KEY_KP4 = Key.Code 52
, KEY_KP5 = Key.Code 53
, KEY_KP6 = Key.Code 54
, KEY_KPPLUS = Key.Code 43
, KEY_KP1 = Key.Code 49
, KEY_KP2 = Key.Code 50
, KEY_KP3 = Key.Code 51
, KEY_KP0 = Key.Code 48
, KEY_KPDOT = Key.Code 46
, KEY_102ND = Key.Code 60
, KEY_KPSLASH = Key.Code 47
, KEY_ESC = Key.Ascii 27
, KEY_BACKSPACE = Key.Ascii 8
, KEY_TAB = Key.Ascii 9
, KEY_ENTER = Key.Ascii 10
, KEY_KPENTER = Key.Ascii 10
, KEY_DELETE = Key.Ascii 127
}
}
, Map::{
, mod1 = True
, mod2 = False
, mod3 = False
, mod4 = False
, keys = toMap
{ KEY_1 = Key.Code 33
, KEY_2 = Key.Code 64
, KEY_3 = Key.Code 35
, KEY_4 = Key.Code 36
, KEY_5 = Key.Code 37
, KEY_6 = Key.Code 94
, KEY_7 = Key.Code 38
, KEY_8 = Key.Code 42
, KEY_9 = Key.Code 40
, KEY_0 = Key.Code 41
, KEY_MINUS = Key.Code 95
, KEY_EQUAL = Key.Code 43
, KEY_Q = Key.Code 81
, KEY_W = Key.Code 87
, KEY_E = Key.Code 69
, KEY_R = Key.Code 82
, KEY_T = Key.Code 84
, KEY_Y = Key.Code 89
, KEY_U = Key.Code 85
, KEY_I = Key.Code 73
, KEY_O = Key.Code 79
, KEY_P = Key.Code 80
, KEY_LEFTBRACE = Key.Code 123
, KEY_RIGHTBRACE = Key.Code 125
, KEY_A = Key.Code 65
, KEY_S = Key.Code 83
, KEY_D = Key.Code 68
, KEY_F = Key.Code 70
, KEY_G = Key.Code 71
, KEY_H = Key.Code 72
, KEY_J = Key.Code 74
, KEY_K = Key.Code 75
, KEY_L = Key.Code 76
, KEY_SEMICOLON = Key.Code 58
, KEY_APOSTROPHE = Key.Code 34
, KEY_GRAVE = Key.Code 126
, KEY_BACKSLASH = Key.Code 124
, KEY_Z = Key.Code 90
, KEY_X = Key.Code 88
, KEY_C = Key.Code 67
, KEY_V = Key.Code 86
, KEY_B = Key.Code 66
, KEY_N = Key.Code 78
, KEY_M = Key.Code 77
, KEY_COMMA = Key.Code 60
, KEY_DOT = Key.Code 62
, KEY_SLASH = Key.Code 63
, KEY_KPASTERISK = Key.Code 42
, KEY_KPMINUS = Key.Code 45
, KEY_KPPLUS = Key.Code 43
, KEY_102ND = Key.Code 62
, KEY_KPSLASH = Key.Code 47
}
}
, Map::{
, mod1 = False
, mod2 = False
, mod3 = True
, mod4 = False
, keys = toMap { KEY_5 = Key.Code 8364, KEY_102ND = Key.Code 124 }
}
, Map::{
, mod1 = False
, mod2 = False
, mod3 = False
, mod4 = True
, keys = toMap
{ KEY_Q = Key.Code 81
, KEY_W = Key.Code 87
, KEY_E = Key.Code 69
, KEY_R = Key.Code 82
, KEY_T = Key.Code 84
, KEY_Y = Key.Code 89
, KEY_U = Key.Code 85
, KEY_I = Key.Code 73
, KEY_O = Key.Code 79
, KEY_P = Key.Code 80
, KEY_A = Key.Code 65
, KEY_S = Key.Code 83
, KEY_D = Key.Code 68
, KEY_F = Key.Code 70
, KEY_G = Key.Code 71
, KEY_H = Key.Code 72
, KEY_J = Key.Code 74
, KEY_K = Key.Code 75
, KEY_L = Key.Code 76
, KEY_Z = Key.Code 90
, KEY_X = Key.Code 88
, KEY_C = Key.Code 67
, KEY_V = Key.Code 86
, KEY_B = Key.Code 66
, KEY_N = Key.Code 78
, KEY_M = Key.Code 77
}
}
, Map::{
, mod1 = True
, mod2 = False
, mod3 = False
, mod4 = True
, keys = toMap
{ KEY_1 = Key.Code 33
, KEY_2 = Key.Code 64
, KEY_3 = Key.Code 35
, KEY_4 = Key.Code 36
, KEY_5 = Key.Code 37
, KEY_6 = Key.Code 94
, KEY_7 = Key.Code 38
, KEY_8 = Key.Code 42
, KEY_9 = Key.Code 40
, KEY_0 = Key.Code 41
, KEY_MINUS = Key.Code 95
, KEY_EQUAL = Key.Code 43
, KEY_Q = Key.Code 113
, KEY_W = Key.Code 119
, KEY_E = Key.Code 101
, KEY_R = Key.Code 114
, KEY_T = Key.Code 116
, KEY_Y = Key.Code 121
, KEY_U = Key.Code 117
, KEY_I = Key.Code 105
, KEY_O = Key.Code 111
, KEY_P = Key.Code 112
, KEY_LEFTBRACE = Key.Code 123
, KEY_RIGHTBRACE = Key.Code 125
, KEY_A = Key.Code 97
, KEY_S = Key.Code 115
, KEY_D = Key.Code 100
, KEY_F = Key.Code 102
, KEY_G = Key.Code 103
, KEY_H = Key.Code 104
, KEY_J = Key.Code 106
, KEY_K = Key.Code 107
, KEY_L = Key.Code 108
, KEY_SEMICOLON = Key.Code 58
, KEY_APOSTROPHE = Key.Code 34
, KEY_GRAVE = Key.Code 126
, KEY_BACKSLASH = Key.Code 124
, KEY_Z = Key.Code 122
, KEY_X = Key.Code 120
, KEY_C = Key.Code 99
, KEY_V = Key.Code 118
, KEY_B = Key.Code 98
, KEY_N = Key.Code 110
, KEY_M = Key.Code 109
, KEY_COMMA = Key.Code 60
, KEY_DOT = Key.Code 62
, KEY_SLASH = Key.Code 63
, KEY_102ND = Key.Code 62
}
}
]
in Prelude.List.map Map.Type XML.Type mapToXML qwerty