-
Notifications
You must be signed in to change notification settings - Fork 1
/
lucas_config.py
185 lines (152 loc) · 8.28 KB
/
lucas_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
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
# This is my own config. I put this in the git repo because I am very important.
# Keys are based on a custom dvorak keyboard layout.
import pylewm
import pylewm.modes
import pylewm.modes.hint_mouse
import pylewm.modes.hint_window
import pylewm.modes.hint_mouse
import pylewm.modes.keynav
import pylewm.modes.goto_window
import pylewm.modes.select_application
import pylewm.modes.execute_task
import pylewm.modes.window_switcher
import pylewm.modes.retrieve_hidden_window
from pylewm.filters import *
pylewm.config.AllowDroppingIntoLayout = False
pylewm.config.HideTaskbar = True
# I have remapped the 'app' key to a more convenient place on the keyboard
# and use it for all my window management shortcuts.
MOD = ('app',)
def GoToSleep():
pylewm.hotkeys.clear()
pylewm.execution.run([r'C:\bin\GoToSleep.bat'], cmd_window=True).run()
pylewm.config.hotkeys({
# Focus management
(*MOD, 'h') : pylewm.spaces.focus_left,
(*MOD, 's') : pylewm.spaces.focus_right,
(*MOD, 't') : pylewm.spaces.focus_down,
(*MOD, 'n') : pylewm.spaces.focus_up,
(*MOD, '&') : pylewm.focus.focus_monitor(-1),
(*MOD, '[') : pylewm.focus.focus_monitor(0),
(*MOD, '{') : pylewm.focus.focus_monitor(1),
(*MOD, '}') : pylewm.focus.focus_monitor(2),
# Move window slots
(*MOD, 'shift', 'h') : pylewm.spaces.move_left,
(*MOD, 'shift', 's') : pylewm.spaces.move_right,
(*MOD, 'shift', 't') : pylewm.spaces.move_down,
(*MOD, 'shift', 'n') : pylewm.spaces.move_up,
(*MOD, 'shift', 'lctrl', 'h') : pylewm.spaces.move_insert_left,
(*MOD, 'shift', 'lctrl', 's') : pylewm.spaces.move_insert_right,
(*MOD, 'shift', 'lctrl', 't') : pylewm.spaces.move_down,
(*MOD, 'shift', 'lctrl', 'n') : pylewm.spaces.move_up,
(*MOD, 'shift', '&') : pylewm.windows.move_to_monitor(-1),
(*MOD, 'shift', '[') : pylewm.windows.move_to_monitor(0),
(*MOD, 'shift', '{') : pylewm.windows.move_to_monitor(1),
(*MOD, 'shift', '}') : pylewm.windows.move_to_monitor(2),
# Window management
(*MOD, '$') : pylewm.windows.close,
(*MOD, '@') : pylewm.windows.close,
(*MOD, '\\') : pylewm.windows.poke,
(*MOD, "'") : pylewm.windows.drop_window_into_layout,
(*MOD, 'shift', 'b') : pylewm.windows.minimize,
(*MOD, 'y') : pylewm.yank.yank_window,
(*MOD, 'shift', 'y') : pylewm.yank.yank_window(detach_from_tab_group=True),
(*MOD, 'i') : pylewm.yank.drop_window,
(*MOD, 'shift', 'i') : pylewm.yank.drop_window_into_tab_group,
(*MOD, 'x') : pylewm.zoom.toggle_zoomed,
# Space management
(*MOD, ' ') : pylewm.spaces.flip,
(*MOD, 'shift', ' ') : pylewm.spaces.move_flip,
(*MOD, 'o') : pylewm.spaces.goto_temporary,
(*MOD, 'w') : pylewm.spaces.next_temporary,
(*MOD, 'v') : pylewm.spaces.previous_temporary,
(*MOD, 'shift', 'o') : pylewm.spaces.move_to_new_temporary_space,
(*MOD, 'g') : pylewm.spaces.focus_space(-1, 0),
(*MOD, 'c') : pylewm.spaces.focus_space(0, 0),
(*MOD, 'r') : pylewm.spaces.focus_space(1, 0),
(*MOD, 'l') : pylewm.spaces.focus_space(2, 0),
(*MOD, '*') : pylewm.spaces.focus_space(-1, 1),
(*MOD, ')') : pylewm.spaces.focus_space(0, 1),
(*MOD, '+') : pylewm.spaces.focus_space(1, 1),
(*MOD, ']') : pylewm.spaces.focus_space(2, 1),
(*MOD, 'shift', 'g') : pylewm.spaces.move_to_space(-1, 0),
(*MOD, 'shift', 'c') : pylewm.spaces.move_to_space(0, 0),
(*MOD, 'shift', 'r') : pylewm.spaces.move_to_space(1, 0),
(*MOD, 'shift', 'l') : pylewm.spaces.move_to_space(2, 0),
(*MOD, 'shift', '*') : pylewm.spaces.move_to_space(-1, 1),
(*MOD, 'shift', ')') : pylewm.spaces.move_to_space(0, 1),
(*MOD, 'shift', '+') : pylewm.spaces.move_to_space(1, 1),
(*MOD, 'shift', ']') : pylewm.spaces.move_to_space(2, 1),
(*MOD, 'a') : pylewm.dropdown.toggle_dropdown([r'wt.exe', '-p', 'Arch']),
(*MOD, 'shift', 'a') : pylewm.dropdown.set_as_dropdown,
# Tab management
(*MOD, 'm') : pylewm.tabs.make_next_window_tabbed,
(*MOD, 'right') : pylewm.tabs.next_tab_or_emit_ctrltab,
(*MOD, 'shift', 'right') : pylewm.tabs.move_tab_next,
(*MOD, 'left') : pylewm.tabs.previous_tab_or_emit_shiftctrltab,
(*MOD, 'shift', 'left') : pylewm.tabs.move_tab_previous,
(*MOD, 'ctrl', 'w') : pylewm.tabs.close_tab_or_emit_ctrlw,
(*MOD, 'ctrl', 't') : pylewm.tabs.duplicate_window_into_tab,
(*MOD, "shift", "'") : pylewm.tabs.detach_window_from_tab_group,
# Application management
(*MOD, ';') : pylewm.execution.run([r'wt.exe', '-p', 'Arch']),
(*MOD, 'shift', ';') : pylewm.execution.run([r'wt.exe', '-p', 'Windows PowerShell'], as_admin=True),
(*MOD, 'ctrl', ',') : pylewm.execution.toggle_taskbar_visibility,
(*MOD, 'p') : pylewm.execution.run(r'C:\Program Files\Mozilla Firefox\firefox.exe'),
(*MOD, 'k') : pylewm.execution.run([r'C:\Program Files\Alacritty\alacritty.exe', '-e', 'wsl.exe', "--", "ranger", "/data/spool"]),
(*MOD, 'shift', 'k') : pylewm.execution.this_pc,
(*MOD, '.') : pylewm.execution.run([r'C:\mpd\toggle.bat']),
(*MOD, 'shift', '.') : pylewm.execution.run([r'C:\mpd\mpc.exe', 'next']),
(*MOD, 'tab') : pylewm.execution.start_screenclip,
(*MOD, 'shift', 'p') : pylewm.modes.execute_task.start_execute_task,
# PyleWM management
(*MOD, 'shift', 'q') : pylewm.run.restart,
('any_mod', '=app') : pylewm.window_drag.activate_window_drag_resize,
# List selection modes
(*MOD, ',') : pylewm.modes.select_application.run_application,
(*MOD, 'enter') : pylewm.modes.goto_window.start_goto_window,
(*MOD, 'shift', 'enter') : pylewm.modes.hint_mouse.start_hint_mouse(hintkeys="aoeuhtns"),
(*MOD, 'e') : pylewm.modes.window_switcher.start_window_switcher(hintkeys="aoeuhtns"),
(*MOD, 'f') : pylewm.modes.hint_window.start_hint_window(hintkeys="aoeuhtns"),
(*MOD, 'shift', 'f') : pylewm.modes.hint_window.start_hint_floating_window(hintkeys="aoeuhtns"),
# Copy-paste shortcuts
(*MOD, 'q') : pylewm.sendkeys.sendkey(('ctrl', 'c')),
(*MOD, 'j') : pylewm.sendkeys.sendkey(('ctrl', 'v')),
(*MOD, 'u') : pylewm.sendkeys.sendkey(('ctrl', 'z')),
(*MOD, 'shift', 'u') : pylewm.sendkeys.sendkey(('ctrl', 'y')),
# Unicode shortcuts
(*MOD, '-') : pylewm.hotkeys.Mode(
oneshot=True,
hotkeys={
"-" : pylewm.sendkeys.sendtext("—"),
"." : pylewm.sendkeys.sendtext("…"),
"a" : pylewm.sendkeys.sendtext("å"),
"e" : pylewm.sendkeys.sendtext("ä"),
"o" : pylewm.sendkeys.sendtext("ö"),
('shift', 'a') : pylewm.sendkeys.sendtext("Å"),
('shift', 'e') : pylewm.sendkeys.sendtext("Ä"),
('shift', 'o') : pylewm.sendkeys.sendtext("Ö"),
"h" : pylewm.sendkeys.sendtext("←"),
"t" : pylewm.sendkeys.sendtext("↓"),
"n" : pylewm.sendkeys.sendtext("↑"),
"s" : pylewm.sendkeys.sendtext("→"),
},
),
# System management
(*MOD, 'ctrl', '$') : GoToSleep,
})
pylewm.config.filters([
({"class": "mintty"}, NoTitlebar, AutoPoke),
({"title": "Windows Terminal"}, NoTitlebar),
({"title": "Slack *"}, Tiling, Monitor(2)),
({"title": "* Discord"}, Tiling, Monitor(2)),
({"class": "MediaPlayerClassicW"}, Floating),
# Visual Studio
({"class": "HwndWrapper[*"}, KeepStartMonitor, AutoPoke, ForceBorders(2)),
({"class": "Ghost"}, Ignore),
# Unreal Engine
({"title": "*Unreal Editor*", "child": False}, Tiling, Monitor(1), TemporarySpace),
({"class": "SplashScreenClass"}, Ignore),
({"class": "UnrealWindow", "child": True}, Floating),
({"title": "*PCD3D_SM5*", "class": "UnrealWindow"}, Tiling, Monitor(1), TemporarySpace),
])