-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_xmodmap.py
executable file
·513 lines (441 loc) · 19.8 KB
/
generate_xmodmap.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# -------------------------------------------------------------------
#
# Python Script to generate xmodmap files for neo variants.
#
# Copyright 2010, Ruthard Baudach <rthrd@web.de>.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# Description:
# generiere_xmodmap.py generates a xmodmap file combining
# a keyboard layout defined in a simple text file
# with the modifier keys and levels 3 – 7 of the original neo 2
# keyboard layout.
# The greek letters of levels 5 and 6 are rearranged to stay
# attached at their latin counterparts
#
# Usage:
#
# generiere_xmodmap.py [options|file]
#
# options:
# -h|--help print this text
#
# file: path to file with keyboard layout definition
#
# this must be a utf-8 encoded text file with unix line breaks
# containing four lines:
#
# 1. line: name of layout
# 2. line: upper row of keyboard
# 3. line: middle row of keyboard
# 4. line: bottom row of keyboard
#
# The left and right hand keys are separated by one space
#
# Revision History:
#
# 2010-12-03 first working draft
#
# ToDo:
# Add suitable cli
# Add NordTast style modifier keys
#
# -------------------------------------------------------------------
# imports
# -------------------------------------------------------------------
import sys, codecs
# global variables
# -------------------------------------------------------------------
# keysyms
# key: (level1, level2, level5, level6, level7)
keysym_map={
u'x': [u'x', u'X', u'Greek_xi', u'Greek_XI', u'Greek_XI'],
u'v': [u'v', u'V', u'NoSymbol', u'radical', u'NoSymbol'],
u'l': [u'l', u'L', u'Greek_lambda', u'Greek_LAMBDA', u'Greek_LAMBDA'],
u'c': [u'c', u'C', u'Greek_chi', u'U2102', u'NoSymbol'],
u'w': [u'w', u'W', u'Greek_omega', u'Greek_OMEGA', u'Greek_OMEGA'],
u'k': [u'k', u'K', u'Greek_kappa', u'multiply', u'NoSymbol'],
u'h': [u'h', u'H', u'Greek_psi', u'Greek_PSI', u'Greek_PSI'],
u'g': [u'g', u'G', u'Greek_gamma', u'Greek_GAMMA', u'Greek_GAMMA'],
u'f': [u'f', u'F', u'Greek_phi', u'Greek_PHI', u'Greek_PHI'],
u'q': [u'q', u'Q', u'U03D5', u'U211A', u'NoSymbol'],
u'ß': [u'ssharp', u'U1E9E', u'Greek_finalsmallsigma', u'jot', u'NoSymbol'],
u'u': [u'u', u'U', u'NoSymbol', u'includedin', u'NoSymbol'],
u'i': [u'i', u'I', u'Greek_iota', u'integral', u'NoSymbol'],
u'a': [u'a', u'A', u'Greek_alpha', u'U2200', u'NoSymbol'],
u'e': [u'e', u'E', u'Greek_epsilon', u'U2203', u'NoSymbol'],
u'o': [u'o', u'O', u'Greek_omicron', u'elementof', u'NoSymbol'],
u's': [u's', u'S', u'Greek_sigma', u'Greek_SIGMA', u'Greek_SIGMA'],
u'n': [u'n', u'N', u'Greek_nu', u'U2115', u'NoSymbol'],
u'r': [u'r', u'R', u'Greek_rho', u'U211D', u'NoSymbol'],
u't': [u't', u'T', u'Greek_tau', u'partialderivative', u'NoSymbol'],
u'd': [u'd', u'D', u'Greek_delta', u'Greek_DELTA', u'Greek_DELTA'],
u'y': [u'y', u'Y', u'Greek_upsilon', u'nabla', u'NoSymbol'],
u'ü': [u'udiaeresis', u'Udiaeresis', u'NoSymbol', u'union', u'NoSymbol'],
u'ö': [u'odiaeresis', u'Odiaeresis', u'U03F5', u'intersection', u'NoSymbol'],
u'ä': [u'adiaeresis', u'Adiaeresis', u'Greek_eta', u'U2135', u'NoSymbol'],
u'p': [u'p', u'P', u'Greek_pi', u'Greek_PI', u'Greek_PI'],
u'z': [u'z', u'Z', u'Greek_zeta', u'U2124', u'NoSymbol'],
u'b': [u'b', u'B', u'Greek_beta', u'U21D0', u'NoSymbol'],
u'm': [u'm', u'M', u'Greek_mu', u'ifonlyif', u'NoSymbol'],
u',': [u'comma', u'endash', u'U03F1', u'U21D2', u'NoSymbol'],
u'.': [u'period', u'enfilledcircbullet', u'U03D1', u'U21A6', u'NoSymbol'],
u'j': [u'j', u'J', u'Greek_theta', u'Greek_THETA', u'Greek_THETA'],
# u'⇘': [u'ISO_Group_Shift', u'ISO_Group_Shift', u'ISO_First_Group', u' NoSymbol'],
u' ': u''
}
xmodmap_template = u'''\
!! ~/.xmodmap
!! %s
!!
!! based upon the Modifiers and levels 3 – 7 of
!!
!! German Neo-Layout
!! adopted 2004 by Hanno Behrens <Hanno.Behrens@gmx.de>
!! inspired by Dvorak/de-ergo http://www.goebel-consult.de/de-ergo/
!! Authors:
!! Benjamin Kellermann <Benjamin dot Kellermann at gmx dot Germany>
!! Erik Streb <mail at erikstreb dot de>
!! Pascal Hauck <neo at pascalhauck dot de>
!!
!! Other Questions:
!! <diskussion at neo-layout dot org>
!!
!! $Revision: 2332 $, $Date: 2010-08-06 08:42:35 +0200 (Fr, 06. Aug 2010) $
!! http://neo-layout.org
!!
!! To try the layout in this file, simply do xmodmap <file>.
!! To load the layout in this file at X startup, simply store it as
!! ~/.xmodmap
!!
!!
!! This file generated by generiere_xmodmap.py
!! Ruthard Baudach <rthrd@web.de>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Ebenen
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Ebene 1: normal
! Ebene 2: Shift
! Ebene 3: Mod3
! Ebene 4: Mod4 (zum Markieren Shift+Mod4)
! Ebene 5: Shift+Mod3
! Ebene 6: Mod3+Mod4 (in dieser Reihenfolge!)
! Ebene 7: wird (bis auf technisch bedingte Ausnahmen) nicht belegt
! Multi_key=Compose (keine eigene Ebene): Mod3+Tab or right window key
! Feststellen/Shift_Lock: Shift+Shift
! Mod4_Lock: Mod4(rechts)+Mod4(links)
! Reihenfolge der Ebenen in der Xmodmap:
! Ebene1 Ebene2 Ebene3 Ebene5 Ebene4 Ebene4+Sh Ebene6 Ebene7
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Modifier definition
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
clear Lock
clear Mod2
! Mod2 war NumLock !
clear Mod3
clear Mod5
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Shift
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! 50=left 62=right
! Shift+Shift ergibt ein ShiftLock (wie Caps, wirkt aber auf alle Zeichen, nicht nur auf Großbuchstaben)
! Der Lock lässt sich durch ein weiteres Shift lösen.
! Eigentlich (siehe Referenz) sollte hier ein CapsLock stehen.
keycode 50 = Shift_L Shift_Lock
keycode 62 = Shift_R Shift_Lock
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Mod3
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! 66=left 51=right
! Make CapsLock an modifier called Mod3 (similar to AltGr) (Mode_switch or ISO_Group_Shift is for 3rd and 4th level)
! Make former CapsLock and qwertz-# to Mode_switch or ISO_Group_Shift
! Mod3(links) (=Qwertz-Caps) erlaubt nur 4 Ebenen
! Ohne einen Eintrag in der zweiten Gruppe (=Ebene 3) ergäbe Mod3+Mod3=Group_Shift+Group_Shift=Gruppe 3=Ebene 6. Das ist nicht gewünscht.
keycode 66 = ISO_Group_Shift ISO_Group_Shift ISO_First_Group NoSymbol
keycode 51 = ISO_Group_Shift ISO_Group_Shift ISO_First_Group NoSymbol
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Mod4
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! 94=left 113=right
! Make the former AltGr and qwertz-< to Mod4 (ISO_Level3_Shift)
! Mod4(rechts)+Mod4(links) lässt Mod4 einrasten (Mod4Lock)
! das funktioniert nur in dieser Reihenfolge, da Mod4(rechts) (=Qwertz-AltGr) nur 4 Ebenen hat
! Der Lock lässt sich durch ein weiteres Mod4 lösen.
keysym less = ISO_Level3_Shift ISO_Level3_Shift ISO_Group_Shift ISO_Group_Shift ISO_Level3_Lock NoSymbol
keysym ISO_Level3_Shift = ISO_Level3_Shift ISO_Level3_Shift ISO_Group_Shift ISO_Group_Shift ISO_Level3_Lock NoSymbol
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! window keys
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! keysym Super_L = Super_L
! keycode 116 = Super_R
! keysym Super_R = Multi_key Multi_key
! add Mod4 = Super_L
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! general Lock
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Einrasten über linke Win-Taste+Modifier, Lösen über nochmaliges Betätigen des Modifiers
! Shift_Lock und Mo4_Lock funktionieren, Mod3_Lock lässt sich aber nicht mehr lösen!!!!
! keycode 115 = ISO_Lock NoSymbol
! add Lock = ISO_Lock
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! main keyboard
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Tab key
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
keycode 23 = Tab ISO_Left_Tab Multi_key ISO_Level3_Lock
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Space and Return key
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
keycode 65 = space space space nobreakspace KP_0 KP_0 U202F NoSymbol
keycode 36 = Return Return Return Return KP_Enter KP_Enter Return Return
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! dead keys
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Ebene1 Ebene2 Ebene3 Ebene5 Ebene4 Ebene4+Sh Ebene6 Ebene7
keycode 49 = dead_circumflex dead_caron U21BB U02DE dead_abovedot Pointer_EnableKeys dead_belowdot NoSymbol
! called T1 ˆ ˇ ↻ ˞ ˙ (keypad-mouse mode) .
keycode 21 = dead_grave dead_cedilla dead_abovering dead_dasia dead_diaeresis NoSymbol dead_macron NoSymbol
! called T2 ` ¸ ˚ ῾ dasia (asper) ¨ ¯
keycode 35 = dead_acute dead_tilde dead_stroke dead_psili dead_doubleacute NoSymbol dead_breve NoSymbol
! called T3 ´ ˜ / ᾿ psili (lenis) ˝ ˘
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! The first row (number Row)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Ebene1 Ebene2 Ebene3 Ebene5 Ebene4 Ebene4+Sh Ebene6 Ebene7
keycode 10 = 1 degree onesuperior onesubscript ordfeminine NoSymbol notsign NoSymbol
! ° ¹ ₁ ª ¬
keycode 11 = 2 section twosuperior twosubscript masculine NoSymbol logicalor NoSymbol
! § ² ₂ º ∨
keycode 12 = 3 U2113 threesuperior threesubscript numerosign NoSymbol logicaland NoSymbol
! ℓ liter ³ ₃ № ∧
keycode 13 = 4 guillemotright U203A femalesymbol NoSymbol NoSymbol U22A5 NoSymbol
! » › ♀ ⊥ perpendicular
keycode 14 = 5 guillemotleft U2039 malesymbol periodcentered NoSymbol U2221 NoSymbol
! « ‹ ♂ · ∡ angle sign
keycode 15 = 6 dollar cent U26A5 sterling NoSymbol U2225 NoSymbol
! $ ¢ ⚥ £ ∥ parallel
keycode 16 = 7 EuroSign yen U03F0 currency NoSymbol rightarrow NoSymbol
! € ¥ ϰ Greek_kappa ¤ →
keycode 17 = 8 doublelowquotemark singlelowquotemark leftanglebracket Tab ISO_Left_Tab infinity NoSymbol
! „ ‚ ⟨ (bra) ∞
keycode 18 = 9 leftdoublequotemark leftsinglequotemark rightanglebracket KP_Divide KP_Divide variation NoSymbol
! “ ‘ ⟩ (ket) / / ∝ proportional to
keycode 19 = 0 rightdoublequotemark rightsinglequotemark zerosubscript KP_Multiply KP_Multiply emptyset NoSymbol
! ” ’ ₀ * * ∅
keycode 20 = minus emdash NoSymbol U2011 KP_Subtract KP_Subtract hyphen NoSymbol
! - — ‑ non-breaking - - soft hyphen
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! The upper row
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Ebene1 Ebene2 Ebene3 Ebene5 Ebene4 Ebene4+Sh Ebene6 Ebene7
keycode 24 = %s %s ellipsis %s Prior Prior %s %s
keycode 25 = %s %s underscore %s BackSpace BackSpace %s %s
keycode 26 = %s %s bracketleft %s Up Up %s %s
keycode 27 = %s %s bracketright %s Delete Delete %s %s
keycode 28 = %s %s asciicircum %s Next Next %s %s
keycode 29 = %s %s exclam %s exclamdown NoSymbol %s %s
keycode 30 = %s %s less %s KP_7 KP_7 %s %s
keycode 31 = %s %s greater %s KP_8 KP_8 %s %s
keycode 32 = %s %s equal %s KP_9 KP_9 %s %s
keycode 33 = %s %s ampersand %s KP_Add KP_Add %s %s
keycode 34 = %s %s U017F %s U2212 NoSymbol %s %s
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! The home row (middle row)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Ebene1 Ebene2 Ebene3 Ebene5 Ebene4 Ebene4+Sh Ebene6 Ebene7
keycode 38 = %s %s backslash %s Home Home %s %s
keycode 39 = %s %s slash %s Left Left %s %s
keycode 40 = %s %s braceleft %s Down Down %s %s
keycode 41 = %s %s braceright %s Right Right %s %s
keycode 42 = %s %s asterisk %s End End %s %s
keycode 43 = %s %s question %s questiondown NoSymbol %s %s
keycode 44 = %s %s parenleft %s KP_4 KP_4 %s %s
keycode 45 = %s %s parenright %s KP_5 KP_5 %s %s
keycode 46 = %s %s minus %s KP_6 KP_6 %s %s
keycode 47 = %s %s colon %s KP_Separator comma %s %s
keycode 48 = %s %s at %s period KP_Decimal %s %s
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! The lower row
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Ebene1 Ebene2 Ebene3 Ebene5 Ebene4 Ebene4+Sh Ebene6 Ebene7
keycode 52 = %s %s numbersign %s Escape Escape %s %s
keycode 53 = %s %s dollar %s Tab ISO_Left_Tab %s %s
keycode 54 = %s %s bar %s Insert Insert %s %s
keycode 55 = %s %s asciitilde %s Return Return %s %s
keycode 56 = %s %s grave %s Undo Redo %s %s
keycode 57 = %s %s plus %s colon NoSymbol %s %s
keycode 58 = %s %s percent %s KP_1 KP_1 %s %s
keycode 59 = %s %s quotedbl %s KP_2 KP_2 %s %s
keycode 60 = %s %s apostrophe %s KP_3 KP_3 %s %s
keycode 61 = %s %s semicolon %s semicolon NoSymbol %s %s
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Keypad
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! The uppest row
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Ebene1 Ebene2 Ebene3 Ebene5 Ebene6 Ebene7 Ebene4 Ebene4+Sh
keycode 77 = Tab ISO_Left_Tab equal approxeq identical NoSymbol notequal Pointer_EnableKeys
! = ≈ almost equal ≡ identical to ≠ (keypad-mouse mode)
keysym KP_Divide = KP_Divide KP_Divide division U2300 U2223 NoSymbol U2044 NoSymbol
! / / ÷ ⌀ diameter ∣ divides (for ⁶⁄₅₉)
keycode 63 = KP_Multiply KP_Multiply U22C5 U2299 U2297 NoSymbol multiply NoSymbol
! * * ⋅ dot ⊙ cirled dot ⊗ circled times × times
keycode 82 = KP_Subtract KP_Subtract U2212 U2296 U2238 NoSymbol U2216 NoSymbol
! - - − real minus ⊖ cirled minus ∸ dot minus ∖ set minus
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! The upper row
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Ebene1 Ebene2 Ebene3 Ebene5 Ebene6 Ebene7 Ebene4 Ebene4+Sh
keycode 79 = KP_7 U2714 U2195 U226A upstile NoSymbol KP_Home KP_Home
! ✔ check mark ↕ arrow ≪ much less ⌈
keycode 80 = KP_8 U2718 uparrow intersection U22C2 NoSymbol KP_Up KP_Up
! ✘ ballot x ↑ ∩ ⋂ n-ary intersection
keycode 81 = KP_9 dagger U20D7 U226B U2309 NoSymbol KP_Prior KP_Prior
! † vector ≫ much greater ⌉
keycode 86 = KP_Add KP_Add plusminus U2295 U2214 NoSymbol U2213 NoSymbol
! + + ± circled plus dot plus ∓ minus-plus
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! The middle row
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Ebene1 Ebene2 Ebene3 Ebene5 Ebene6 Ebene7 Ebene4 Ebene4+Sh
keycode 83 = KP_4 club leftarrow includedin U2286 NoSymbol KP_Left KP_Left
! ♣ ← ⊂ ⊆
keycode 84 = KP_5 EuroSign colon U22B6 U22B7 NoSymbol KP_Begin KP_Begin
! € : ⊶ original of ⊷ image of
keycode 85 = KP_6 U2023 rightarrow includes U2287 NoSymbol KP_Right KP_Right
! ‣ → ⊃ ⊇
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! The lower row
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Ebene1 Ebene2 Ebene3 Ebene5 Ebene6 Ebene7 Ebene4 Ebene4+Sh
keycode 87 = KP_1 diamond U2194 lessthanequal downstile NoSymbol KP_End KP_End
! ♦ ↔ arrow ≤ ⌊
keycode 88 = KP_2 heart downarrow union U22C3 NoSymbol KP_Down KP_Down
! ♥ ↓ ∪ ⋃ n-ary union
keycode 89 = KP_3 U2660 U21CC greaterthanequal U230B NoSymbol KP_Next KP_Next
! ♠ ⇌ ≥ ⌋
! keycode 108 = KP_Enter KP_Enter KP_Enter KP_Enter KP_Enter KP_Enter KP_Enter KP_Enter
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! The lowest row
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Ebene1 Ebene2 Ebene3 Ebene5 Ebene6 Ebene7 Ebene4 Ebene4+Sh
keycode 90 = KP_0 U2423 percent U2030 U25A1 NoSymbol KP_Insert KP_Insert
! ␣ space sign %% ‰ per mille □ white square
keycode 91 = KP_Separator period comma minutes seconds NoSymbol KP_Delete KP_Delete
! , . , ′ min,feets ″ sec,inches
add Mod3 = ISO_First_Group
add Mod5 = ISO_Level3_Shift
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Bemerkungen
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! 1.) Ebene 6 (hier: der 7. Eintrag) erreicht man über ISO_Group_Shift+ISO_Group_Shift
! (bzw. mode_switch+mode_switch) und über keine andere mir bekannte Kombination. Insbesondere legt
! ISO_Level3_Shift Level3 (Ebene 4, hier: Eintrag 5) fest, verschiebt also nicht. Darum kann man
! ISO_Level3_Shift nur mit Shift sinnvoll kombinieren. Daraus resultiert, dass Ebene 6 nur über
! Mod3+Mod4 (in dieser Reihenfolge!) erreicht werden kann.
!
! 2.) Die KP_-Einträge ermöglichen die Steuerung des Mauscursors mit der Tastatur.
! Hierzu wird mittels Shift+Mod4+T1 dieser Betriebsmodus ein- und später wieder ausgeschaltet.
! Die Steuerung des Cursors kann über den Ziffernblock (Ebene 4, eventuell mit
! eingerastetem Mod4) erfolgen.
'''
# global funktions
# -----------------------------------------------------------------
def printUsage(err=0):
'''
prints usage
'''
sys.stderr.write(u'usage: ' + sys.argv[0] + u''' [options|file]
options:
-h|--help print this text
file: path to file with keyboard layout definition
this must be a utf-8 encoded text file with unix line breaks
containing four lines:
1. line: name of layout
2. line: upper row of keyboard
3. line: middle row of keyboard
4. line: bottom row of keyboard
The left and right hand keys are separated by one space
''')
exit(err)
def raiseFileError(err=2):
'''
File has wrong format.
'''
sys.stderr.write(u'Die Datei ' + sys.argv[1] + u' entspricht nicht dem erforderlichen Eingabeformat')
printUsage(err)
def raiseFileNotFound(err=4):
'''
Input file not found.
'''
sys.stderr.write(u'Die Datei ' + sys.argv[1] + u' konnte nicht geöffnet werden')
exit(err)
def handleCharNotFound(char):
'''
Hook to handle not defined charakters in input file.
ToDo – prompt for layers 2,5 and 6
'''
sys.stderr.write(char + u' ist leider nicht definiert.')
exit(4)
def parseCommandLine(argv):
'''
Parses command line.
argv: sys.argv
Returns layout definition as file like object.
ToDo: CLI
'''
try:
if argv[1] == u'-h' or argv[1] == u'--help':
printUsage()
except IndexError:
printUsage(1)
try:
return codecs.open(sys.argv[1],u'r',u'utf-8')
except Exception:
raiseFileNotFound()
# classes
# ------------------------------------------------------------
class key_symbol_map(list):
'''
List containing layout name as entry [0] and all keysyms for
the layout, entry [1] to [5] corresponding to first key etc.
'''
def __init__(self,keysym_map,layout_definition):
'''
keysym_map: dictionary of lists containing the keysymbols for
neo level 1,2,5,6,7
layout_definition: file object containing layout definition.
'''
try:
self.append(layout_definition.next())
for line in layout_definition:
for char in line[:-1]:
if char not in keysym_map.keys():
handleCharNotFound(char)
#elif char <> u' ':
# self.extend(keysym_map[char])
except KeyError:
raiseFileError()
tuple(self)
if __name__ == u'__main__':
layout_definition = parseCommandLine(sys.argv)
mapp = key_symbol_map(keysym_map,layout_definition)
# print len(mapp)
# print mapp
xmodmap = xmodmap_template % tuple(mapp)
sys.stdout.write(xmodmap.encode(u'utf-8'))