/
config.py
109 lines (94 loc) · 3.28 KB
/
config.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
# -*- coding: utf-8 -*-
import re
import shlex
from xkeysnail.transform import *
def E(sh, arg=None):
loc = "bash /home/nlfiasel/.doom.d/dot/xkeysnail/"
if arg is None:
return shlex.split(sh)
else:
return shlex.split(loc+sh+" "+arg)
define_timeout(0.3)
define_modmap({
Key.ESC: Key.GRAVE,
Key.CAPSLOCK: Key.LEFT_CTRL,
# Key.RIGHT_ALT: Key.LEFT_SHIFT,
})
define_multipurpose_modmap({
Key.TAB: [Key.TAB, Key.RIGHT_CTRL],
Key.LEFT_CTRL: [Key.ESC, Key.LEFT_CTRL],
Key.SPACE: [Key.SPACE, Key.LEFT_CTRL],
})
define_conditional_multipurpose_modmap(re.compile(r'Emacs'), {
Key.TAB: [Key.TAB, Key.RIGHT_CTRL],
Key.LEFT_CTRL: [Key.ESC, Key.LEFT_CTRL],
Key.SPACE: [Key.SPACE, Key.LEFT_CTRL],
Key.LEFT_SHIFT: [Key.F13, Key.LEFT_SHIFT],
Key.RIGHT_SHIFT: [Key.F14, Key.RIGHT_SHIFT],
})
define_keymap(None, {
K("RC-KEY_1"): K("F1"),
K("RC-KEY_2"): K("F2"),
K("RC-KEY_3"): K("F3"),
K("RC-KEY_4"): K("F4"),
K("RC-KEY_5"): K("F5"),
K("RC-KEY_6"): K("F6"),
K("RC-KEY_7"): K("F7"),
K("RC-KEY_8"): K("F8"),
K("RC-KEY_9"): K("F9"),
K("RC-KEY_0"): K("F10"),
K("RC-MINUS"): K("F11"),
K("RC-EQUAL"): K("F12"),
K("RC-P"): K("MUTE"),
K("RC-LEFT_BRACE"): K("VOLUMEDOWN"),
K("RC-RIGHT_BRACE"): K("VOLUMEUP"),
K("RC-BACKSLASH"): K("PRINT"),
K("RC-APOSTROPHE"): K("CAPSLOCK"),
K("RC-LC-H"): K("LC-LEFT"),
K("RC-LC-J"): K("LC-DOWN"),
K("RC-LC-K"): K("LC-UP"),
K("RC-LC-L"): K("LC-RIGHT"),
K("RC-LC-LM-KEY_1"): K("LC-LM-F1"),
K("RC-LC-LM-KEY_2"): K("LC-LM-F2"),
K("RC-LC-LM-KEY_3"): K("LC-LM-F3"),
K("RC-A"): launch(E("cycle", "anki")),
K("RC-D"): launch(E("cycle", "dolphin")),
K("RC-E"): launch(E("cycle", "emacs /home/nlfiasel/.doom.d/dot/emacs/startup")),
K("RC-Shift-E"): launch(E("capture", "")),
K("RC-M"): launch(E("cycle", "netease-cloud-music")),
K("RC-R"): launch(E("cycle", "konsole")),
K("RC-S"): launch(E("cycle", "mpv")),
K("RC-T"): launch(E("cycle", "telegram-desktop")),
K("RC-W"): launch(E("cycle", "chromium")),
K("RC-I"): launch(E("ip", "status enp0s20f0u1")),
K("RC-Shift-I"): launch(E("ip", "change enp0s20f0u1")),
K("RC-O"): launch(E("ip", "status wlp58s0")),
K("RC-Q"): launch(E("cycle", "mendeley")),
K("RC-Shift-O"): launch(E("ip", "change wlp58s0")),
K("RC-Y"): launch(E("cycle", "virt-manager")),
K("RC-Z"): {
K("H"): launch(E("rcf", "hiit-mp4")),
K("Shift-H"): launch(E("rcf", "hiit-flv")),
K("P"): launch(E("rcf", "music-pause")),
K("C"): launch(E("rcf", "connect-wf")),
K("Shift-C"): launch(E("rcf", "disconnect-wf")),
K("D"): launch(E("rcf", "tmp-d")),
},
K("RC-X"): {
# K("Q"): K("PREVIOUSSONG"),
# K("W"): K("PLAYPAUSE"),
# K("E"): K("NEXTSONG"),
K("W"): launch(E("virt-manager -c qemu:///system --show-domain-console win10")),
K("S"): launch(E("cycle", "scrcpy /home/nlfiasel/.doom.d/dot/scrcpy/startup")),
},
})
define_keymap(lambda wm_class: wm_class not in ("Emacs"), {
K("LC-H"): K("LEFT"),
K("LC-J"): K("DOWN"),
K("LC-K"): K("UP"),
K("LC-L"): K("RIGHT"),
})
define_keymap(lambda wm_class: wm_class in ("Chromium"), {
K("RC-J"): K("Shift-J"),
K("RC-K"): K("Shift-K"),
})