Last active
January 23, 2022 22:05
-
-
Save rvaiya/03c2bdd850dddad05dd9460f9b3944ad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# Generates a keyd config consisting of modifier layers in which each modified keycode is | |
# mapped to its identity. This is a proof of concept and not intended to be used | |
# in practice. See https://github.com/rvaiya/keyd/issues/119 | |
from itertools import combinations | |
mods = ['meta', 'alt', 'shift', 'control'] | |
for i in range(len(mods)): | |
for modset in combinations(mods, i+1): | |
modset = sorted(modset) | |
layer_name = '_'.join(modset) | |
mod_tags = '-'.join([{ 'meta': 'M', 'alt': 'A', 'shift': 'S', 'control': 'C', }[m] for m in modset]) | |
print(f'[{layer_name}:{mod_tags}]') | |
for next_mod in mods: | |
if next_mod not in modset: | |
next_name = '_'.join(sorted(list(modset)+[next_mod])) | |
print(f'\t{next_mod} = layer({next_name})') | |
# Paydirt... | |
for c in "abcdefghijklmnopqrstuvwxyz0123456789,.;/[]\\-=`'": | |
print(f'\t{c} = {mod_tags}-{c}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[meta:M] | |
alt = layer(alt_meta) | |
shift = layer(meta_shift) | |
control = layer(control_meta) | |
a = M-a | |
b = M-b | |
c = M-c | |
d = M-d | |
e = M-e | |
f = M-f | |
g = M-g | |
h = M-h | |
i = M-i | |
j = M-j | |
k = M-k | |
l = M-l | |
m = M-m | |
n = M-n | |
o = M-o | |
p = M-p | |
q = M-q | |
r = M-r | |
s = M-s | |
t = M-t | |
u = M-u | |
v = M-v | |
w = M-w | |
x = M-x | |
y = M-y | |
z = M-z | |
0 = M-0 | |
1 = M-1 | |
2 = M-2 | |
3 = M-3 | |
4 = M-4 | |
5 = M-5 | |
6 = M-6 | |
7 = M-7 | |
8 = M-8 | |
9 = M-9 | |
, = M-, | |
. = M-. | |
; = M-; | |
/ = M-/ | |
[ = M-[ | |
] = M-] | |
\ = M-\ | |
- = M-- | |
= = M-= | |
` = M-` | |
' = M-' | |
[alt:A] | |
meta = layer(alt_meta) | |
shift = layer(alt_shift) | |
control = layer(alt_control) | |
a = A-a | |
b = A-b | |
c = A-c | |
d = A-d | |
e = A-e | |
f = A-f | |
g = A-g | |
h = A-h | |
i = A-i | |
j = A-j | |
k = A-k | |
l = A-l | |
m = A-m | |
n = A-n | |
o = A-o | |
p = A-p | |
q = A-q | |
r = A-r | |
s = A-s | |
t = A-t | |
u = A-u | |
v = A-v | |
w = A-w | |
x = A-x | |
y = A-y | |
z = A-z | |
0 = A-0 | |
1 = A-1 | |
2 = A-2 | |
3 = A-3 | |
4 = A-4 | |
5 = A-5 | |
6 = A-6 | |
7 = A-7 | |
8 = A-8 | |
9 = A-9 | |
, = A-, | |
. = A-. | |
; = A-; | |
/ = A-/ | |
[ = A-[ | |
] = A-] | |
\ = A-\ | |
- = A-- | |
= = A-= | |
` = A-` | |
' = A-' | |
[shift:S] | |
meta = layer(meta_shift) | |
alt = layer(alt_shift) | |
control = layer(control_shift) | |
a = S-a | |
b = S-b | |
c = S-c | |
d = S-d | |
e = S-e | |
f = S-f | |
g = S-g | |
h = S-h | |
i = S-i | |
j = S-j | |
k = S-k | |
l = S-l | |
m = S-m | |
n = S-n | |
o = S-o | |
p = S-p | |
q = S-q | |
r = S-r | |
s = S-s | |
t = S-t | |
u = S-u | |
v = S-v | |
w = S-w | |
x = S-x | |
y = S-y | |
z = S-z | |
0 = S-0 | |
1 = S-1 | |
2 = S-2 | |
3 = S-3 | |
4 = S-4 | |
5 = S-5 | |
6 = S-6 | |
7 = S-7 | |
8 = S-8 | |
9 = S-9 | |
, = S-, | |
. = S-. | |
; = S-; | |
/ = S-/ | |
[ = S-[ | |
] = S-] | |
\ = S-\ | |
- = S-- | |
= = S-= | |
` = S-` | |
' = S-' | |
[control:C] | |
meta = layer(control_meta) | |
alt = layer(alt_control) | |
shift = layer(control_shift) | |
a = C-a | |
b = C-b | |
c = C-c | |
d = C-d | |
e = C-e | |
f = C-f | |
g = C-g | |
h = C-h | |
i = C-i | |
j = C-j | |
k = C-k | |
l = C-l | |
m = C-m | |
n = C-n | |
o = C-o | |
p = C-p | |
q = C-q | |
r = C-r | |
s = C-s | |
t = C-t | |
u = C-u | |
v = C-v | |
w = C-w | |
x = C-x | |
y = C-y | |
z = C-z | |
0 = C-0 | |
1 = C-1 | |
2 = C-2 | |
3 = C-3 | |
4 = C-4 | |
5 = C-5 | |
6 = C-6 | |
7 = C-7 | |
8 = C-8 | |
9 = C-9 | |
, = C-, | |
. = C-. | |
; = C-; | |
/ = C-/ | |
[ = C-[ | |
] = C-] | |
\ = C-\ | |
- = C-- | |
= = C-= | |
` = C-` | |
' = C-' | |
[alt_meta:A-M] | |
shift = layer(alt_meta_shift) | |
control = layer(alt_control_meta) | |
a = A-M-a | |
b = A-M-b | |
c = A-M-c | |
d = A-M-d | |
e = A-M-e | |
f = A-M-f | |
g = A-M-g | |
h = A-M-h | |
i = A-M-i | |
j = A-M-j | |
k = A-M-k | |
l = A-M-l | |
m = A-M-m | |
n = A-M-n | |
o = A-M-o | |
p = A-M-p | |
q = A-M-q | |
r = A-M-r | |
s = A-M-s | |
t = A-M-t | |
u = A-M-u | |
v = A-M-v | |
w = A-M-w | |
x = A-M-x | |
y = A-M-y | |
z = A-M-z | |
0 = A-M-0 | |
1 = A-M-1 | |
2 = A-M-2 | |
3 = A-M-3 | |
4 = A-M-4 | |
5 = A-M-5 | |
6 = A-M-6 | |
7 = A-M-7 | |
8 = A-M-8 | |
9 = A-M-9 | |
, = A-M-, | |
. = A-M-. | |
; = A-M-; | |
/ = A-M-/ | |
[ = A-M-[ | |
] = A-M-] | |
\ = A-M-\ | |
- = A-M-- | |
= = A-M-= | |
` = A-M-` | |
' = A-M-' | |
[meta_shift:M-S] | |
alt = layer(alt_meta_shift) | |
control = layer(control_meta_shift) | |
a = M-S-a | |
b = M-S-b | |
c = M-S-c | |
d = M-S-d | |
e = M-S-e | |
f = M-S-f | |
g = M-S-g | |
h = M-S-h | |
i = M-S-i | |
j = M-S-j | |
k = M-S-k | |
l = M-S-l | |
m = M-S-m | |
n = M-S-n | |
o = M-S-o | |
p = M-S-p | |
q = M-S-q | |
r = M-S-r | |
s = M-S-s | |
t = M-S-t | |
u = M-S-u | |
v = M-S-v | |
w = M-S-w | |
x = M-S-x | |
y = M-S-y | |
z = M-S-z | |
0 = M-S-0 | |
1 = M-S-1 | |
2 = M-S-2 | |
3 = M-S-3 | |
4 = M-S-4 | |
5 = M-S-5 | |
6 = M-S-6 | |
7 = M-S-7 | |
8 = M-S-8 | |
9 = M-S-9 | |
, = M-S-, | |
. = M-S-. | |
; = M-S-; | |
/ = M-S-/ | |
[ = M-S-[ | |
] = M-S-] | |
\ = M-S-\ | |
- = M-S-- | |
= = M-S-= | |
` = M-S-` | |
' = M-S-' | |
[control_meta:C-M] | |
alt = layer(alt_control_meta) | |
shift = layer(control_meta_shift) | |
a = C-M-a | |
b = C-M-b | |
c = C-M-c | |
d = C-M-d | |
e = C-M-e | |
f = C-M-f | |
g = C-M-g | |
h = C-M-h | |
i = C-M-i | |
j = C-M-j | |
k = C-M-k | |
l = C-M-l | |
m = C-M-m | |
n = C-M-n | |
o = C-M-o | |
p = C-M-p | |
q = C-M-q | |
r = C-M-r | |
s = C-M-s | |
t = C-M-t | |
u = C-M-u | |
v = C-M-v | |
w = C-M-w | |
x = C-M-x | |
y = C-M-y | |
z = C-M-z | |
0 = C-M-0 | |
1 = C-M-1 | |
2 = C-M-2 | |
3 = C-M-3 | |
4 = C-M-4 | |
5 = C-M-5 | |
6 = C-M-6 | |
7 = C-M-7 | |
8 = C-M-8 | |
9 = C-M-9 | |
, = C-M-, | |
. = C-M-. | |
; = C-M-; | |
/ = C-M-/ | |
[ = C-M-[ | |
] = C-M-] | |
\ = C-M-\ | |
- = C-M-- | |
= = C-M-= | |
` = C-M-` | |
' = C-M-' | |
[alt_shift:A-S] | |
meta = layer(alt_meta_shift) | |
control = layer(alt_control_shift) | |
a = A-S-a | |
b = A-S-b | |
c = A-S-c | |
d = A-S-d | |
e = A-S-e | |
f = A-S-f | |
g = A-S-g | |
h = A-S-h | |
i = A-S-i | |
j = A-S-j | |
k = A-S-k | |
l = A-S-l | |
m = A-S-m | |
n = A-S-n | |
o = A-S-o | |
p = A-S-p | |
q = A-S-q | |
r = A-S-r | |
s = A-S-s | |
t = A-S-t | |
u = A-S-u | |
v = A-S-v | |
w = A-S-w | |
x = A-S-x | |
y = A-S-y | |
z = A-S-z | |
0 = A-S-0 | |
1 = A-S-1 | |
2 = A-S-2 | |
3 = A-S-3 | |
4 = A-S-4 | |
5 = A-S-5 | |
6 = A-S-6 | |
7 = A-S-7 | |
8 = A-S-8 | |
9 = A-S-9 | |
, = A-S-, | |
. = A-S-. | |
; = A-S-; | |
/ = A-S-/ | |
[ = A-S-[ | |
] = A-S-] | |
\ = A-S-\ | |
- = A-S-- | |
= = A-S-= | |
` = A-S-` | |
' = A-S-' | |
[alt_control:A-C] | |
meta = layer(alt_control_meta) | |
shift = layer(alt_control_shift) | |
a = A-C-a | |
b = A-C-b | |
c = A-C-c | |
d = A-C-d | |
e = A-C-e | |
f = A-C-f | |
g = A-C-g | |
h = A-C-h | |
i = A-C-i | |
j = A-C-j | |
k = A-C-k | |
l = A-C-l | |
m = A-C-m | |
n = A-C-n | |
o = A-C-o | |
p = A-C-p | |
q = A-C-q | |
r = A-C-r | |
s = A-C-s | |
t = A-C-t | |
u = A-C-u | |
v = A-C-v | |
w = A-C-w | |
x = A-C-x | |
y = A-C-y | |
z = A-C-z | |
0 = A-C-0 | |
1 = A-C-1 | |
2 = A-C-2 | |
3 = A-C-3 | |
4 = A-C-4 | |
5 = A-C-5 | |
6 = A-C-6 | |
7 = A-C-7 | |
8 = A-C-8 | |
9 = A-C-9 | |
, = A-C-, | |
. = A-C-. | |
; = A-C-; | |
/ = A-C-/ | |
[ = A-C-[ | |
] = A-C-] | |
\ = A-C-\ | |
- = A-C-- | |
= = A-C-= | |
` = A-C-` | |
' = A-C-' | |
[control_shift:C-S] | |
meta = layer(control_meta_shift) | |
alt = layer(alt_control_shift) | |
a = C-S-a | |
b = C-S-b | |
c = C-S-c | |
d = C-S-d | |
e = C-S-e | |
f = C-S-f | |
g = C-S-g | |
h = C-S-h | |
i = C-S-i | |
j = C-S-j | |
k = C-S-k | |
l = C-S-l | |
m = C-S-m | |
n = C-S-n | |
o = C-S-o | |
p = C-S-p | |
q = C-S-q | |
r = C-S-r | |
s = C-S-s | |
t = C-S-t | |
u = C-S-u | |
v = C-S-v | |
w = C-S-w | |
x = C-S-x | |
y = C-S-y | |
z = C-S-z | |
0 = C-S-0 | |
1 = C-S-1 | |
2 = C-S-2 | |
3 = C-S-3 | |
4 = C-S-4 | |
5 = C-S-5 | |
6 = C-S-6 | |
7 = C-S-7 | |
8 = C-S-8 | |
9 = C-S-9 | |
, = C-S-, | |
. = C-S-. | |
; = C-S-; | |
/ = C-S-/ | |
[ = C-S-[ | |
] = C-S-] | |
\ = C-S-\ | |
- = C-S-- | |
= = C-S-= | |
` = C-S-` | |
' = C-S-' | |
[alt_meta_shift:A-M-S] | |
control = layer(alt_control_meta_shift) | |
a = A-M-S-a | |
b = A-M-S-b | |
c = A-M-S-c | |
d = A-M-S-d | |
e = A-M-S-e | |
f = A-M-S-f | |
g = A-M-S-g | |
h = A-M-S-h | |
i = A-M-S-i | |
j = A-M-S-j | |
k = A-M-S-k | |
l = A-M-S-l | |
m = A-M-S-m | |
n = A-M-S-n | |
o = A-M-S-o | |
p = A-M-S-p | |
q = A-M-S-q | |
r = A-M-S-r | |
s = A-M-S-s | |
t = A-M-S-t | |
u = A-M-S-u | |
v = A-M-S-v | |
w = A-M-S-w | |
x = A-M-S-x | |
y = A-M-S-y | |
z = A-M-S-z | |
0 = A-M-S-0 | |
1 = A-M-S-1 | |
2 = A-M-S-2 | |
3 = A-M-S-3 | |
4 = A-M-S-4 | |
5 = A-M-S-5 | |
6 = A-M-S-6 | |
7 = A-M-S-7 | |
8 = A-M-S-8 | |
9 = A-M-S-9 | |
, = A-M-S-, | |
. = A-M-S-. | |
; = A-M-S-; | |
/ = A-M-S-/ | |
[ = A-M-S-[ | |
] = A-M-S-] | |
\ = A-M-S-\ | |
- = A-M-S-- | |
= = A-M-S-= | |
` = A-M-S-` | |
' = A-M-S-' | |
[alt_control_meta:A-C-M] | |
shift = layer(alt_control_meta_shift) | |
a = A-C-M-a | |
b = A-C-M-b | |
c = A-C-M-c | |
d = A-C-M-d | |
e = A-C-M-e | |
f = A-C-M-f | |
g = A-C-M-g | |
h = A-C-M-h | |
i = A-C-M-i | |
j = A-C-M-j | |
k = A-C-M-k | |
l = A-C-M-l | |
m = A-C-M-m | |
n = A-C-M-n | |
o = A-C-M-o | |
p = A-C-M-p | |
q = A-C-M-q | |
r = A-C-M-r | |
s = A-C-M-s | |
t = A-C-M-t | |
u = A-C-M-u | |
v = A-C-M-v | |
w = A-C-M-w | |
x = A-C-M-x | |
y = A-C-M-y | |
z = A-C-M-z | |
0 = A-C-M-0 | |
1 = A-C-M-1 | |
2 = A-C-M-2 | |
3 = A-C-M-3 | |
4 = A-C-M-4 | |
5 = A-C-M-5 | |
6 = A-C-M-6 | |
7 = A-C-M-7 | |
8 = A-C-M-8 | |
9 = A-C-M-9 | |
, = A-C-M-, | |
. = A-C-M-. | |
; = A-C-M-; | |
/ = A-C-M-/ | |
[ = A-C-M-[ | |
] = A-C-M-] | |
\ = A-C-M-\ | |
- = A-C-M-- | |
= = A-C-M-= | |
` = A-C-M-` | |
' = A-C-M-' | |
[control_meta_shift:C-M-S] | |
alt = layer(alt_control_meta_shift) | |
a = C-M-S-a | |
b = C-M-S-b | |
c = C-M-S-c | |
d = C-M-S-d | |
e = C-M-S-e | |
f = C-M-S-f | |
g = C-M-S-g | |
h = C-M-S-h | |
i = C-M-S-i | |
j = C-M-S-j | |
k = C-M-S-k | |
l = C-M-S-l | |
m = C-M-S-m | |
n = C-M-S-n | |
o = C-M-S-o | |
p = C-M-S-p | |
q = C-M-S-q | |
r = C-M-S-r | |
s = C-M-S-s | |
t = C-M-S-t | |
u = C-M-S-u | |
v = C-M-S-v | |
w = C-M-S-w | |
x = C-M-S-x | |
y = C-M-S-y | |
z = C-M-S-z | |
0 = C-M-S-0 | |
1 = C-M-S-1 | |
2 = C-M-S-2 | |
3 = C-M-S-3 | |
4 = C-M-S-4 | |
5 = C-M-S-5 | |
6 = C-M-S-6 | |
7 = C-M-S-7 | |
8 = C-M-S-8 | |
9 = C-M-S-9 | |
, = C-M-S-, | |
. = C-M-S-. | |
; = C-M-S-; | |
/ = C-M-S-/ | |
[ = C-M-S-[ | |
] = C-M-S-] | |
\ = C-M-S-\ | |
- = C-M-S-- | |
= = C-M-S-= | |
` = C-M-S-` | |
' = C-M-S-' | |
[alt_control_shift:A-C-S] | |
meta = layer(alt_control_meta_shift) | |
a = A-C-S-a | |
b = A-C-S-b | |
c = A-C-S-c | |
d = A-C-S-d | |
e = A-C-S-e | |
f = A-C-S-f | |
g = A-C-S-g | |
h = A-C-S-h | |
i = A-C-S-i | |
j = A-C-S-j | |
k = A-C-S-k | |
l = A-C-S-l | |
m = A-C-S-m | |
n = A-C-S-n | |
o = A-C-S-o | |
p = A-C-S-p | |
q = A-C-S-q | |
r = A-C-S-r | |
s = A-C-S-s | |
t = A-C-S-t | |
u = A-C-S-u | |
v = A-C-S-v | |
w = A-C-S-w | |
x = A-C-S-x | |
y = A-C-S-y | |
z = A-C-S-z | |
0 = A-C-S-0 | |
1 = A-C-S-1 | |
2 = A-C-S-2 | |
3 = A-C-S-3 | |
4 = A-C-S-4 | |
5 = A-C-S-5 | |
6 = A-C-S-6 | |
7 = A-C-S-7 | |
8 = A-C-S-8 | |
9 = A-C-S-9 | |
, = A-C-S-, | |
. = A-C-S-. | |
; = A-C-S-; | |
/ = A-C-S-/ | |
[ = A-C-S-[ | |
] = A-C-S-] | |
\ = A-C-S-\ | |
- = A-C-S-- | |
= = A-C-S-= | |
` = A-C-S-` | |
' = A-C-S-' | |
[alt_control_meta_shift:A-C-M-S] | |
a = A-C-M-S-a | |
b = A-C-M-S-b | |
c = A-C-M-S-c | |
d = A-C-M-S-d | |
e = A-C-M-S-e | |
f = A-C-M-S-f | |
g = A-C-M-S-g | |
h = A-C-M-S-h | |
i = A-C-M-S-i | |
j = A-C-M-S-j | |
k = A-C-M-S-k | |
l = A-C-M-S-l | |
m = A-C-M-S-m | |
n = A-C-M-S-n | |
o = A-C-M-S-o | |
p = A-C-M-S-p | |
q = A-C-M-S-q | |
r = A-C-M-S-r | |
s = A-C-M-S-s | |
t = A-C-M-S-t | |
u = A-C-M-S-u | |
v = A-C-M-S-v | |
w = A-C-M-S-w | |
x = A-C-M-S-x | |
y = A-C-M-S-y | |
z = A-C-M-S-z | |
0 = A-C-M-S-0 | |
1 = A-C-M-S-1 | |
2 = A-C-M-S-2 | |
3 = A-C-M-S-3 | |
4 = A-C-M-S-4 | |
5 = A-C-M-S-5 | |
6 = A-C-M-S-6 | |
7 = A-C-M-S-7 | |
8 = A-C-M-S-8 | |
9 = A-C-M-S-9 | |
, = A-C-M-S-, | |
. = A-C-M-S-. | |
; = A-C-M-S-; | |
/ = A-C-M-S-/ | |
[ = A-C-M-S-[ | |
] = A-C-M-S-] | |
\ = A-C-M-S-\ | |
- = A-C-M-S-- | |
= = A-C-M-S-= | |
` = A-C-M-S-` | |
' = A-C-M-S-' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment