-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkeys.py
More file actions
228 lines (213 loc) · 5.55 KB
/
Copy pathkeys.py
File metadata and controls
228 lines (213 loc) · 5.55 KB
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
import enum
from libqtile import extension
from libqtile.config import Click, Drag, Key
from libqtile.lazy import lazy
from colors import kanagawa
from commands import commands
from meta_config import CUR_DIR, TERMINAL
class Arrows(enum.Enum):
LEFT = "h"
RIGHT = "l"
UP = "k"
DOWN = "j"
class Modifiers(enum.Enum):
META = "mod4"
ALT = "mod1"
CTRL = "control"
SHIFT = "shift"
_focus_keys = [
Key(
[Modifiers.META.value],
Arrows.LEFT.value,
lazy.layout.left(),
desc="Move focus to left",
),
Key(
[Modifiers.META.value],
Arrows.RIGHT.value,
lazy.layout.right(),
desc="Move focus to right",
),
Key(
[Modifiers.META.value],
Arrows.DOWN.value,
lazy.layout.down(),
desc="Move focus down",
),
Key(
[Modifiers.META.value], Arrows.UP.value, lazy.layout.up(), desc="Move focus up"
),
Key(
[Modifiers.ALT.value],
"Tab",
lazy.layout.next(),
desc="Move window focus to other window",
),
]
_move_keys = [
# Move windows between left/right columns or move up/down in current stack.
# Moving out of range in Columns layout will create new column.
Key(
[Modifiers.META.value, Modifiers.CTRL.value],
Arrows.LEFT.value,
lazy.layout.shuffle_left(),
desc="Move window to the left",
),
Key(
[Modifiers.META.value, Modifiers.CTRL.value],
Arrows.RIGHT.value,
lazy.layout.shuffle_right(),
desc="Move window to the right",
),
Key(
[Modifiers.META.value, Modifiers.CTRL.value],
Arrows.DOWN.value,
lazy.layout.shuffle_down(),
desc="Move window down",
),
Key(
[Modifiers.META.value, Modifiers.CTRL.value],
Arrows.UP.value,
lazy.layout.shuffle_up(),
desc="Move window up",
),
Key(
[Modifiers.META.value, Modifiers.SHIFT.value],
"Return",
lazy.layout.toggle_split(),
desc="Toggle between split and unsplit sides of stack",
),
]
_resize_keys = [
# Grow windows. If current window is on the edge of screen and direction
# will be to screen edge - window would shrink.
Key(
[Modifiers.META.value, Modifiers.SHIFT.value],
Arrows.LEFT.value,
lazy.layout.grow_left(),
desc="Grow window to the left",
),
Key(
[Modifiers.META.value, Modifiers.SHIFT.value],
Arrows.RIGHT.value,
lazy.layout.grow_right(),
desc="Grow window to the right",
),
Key(
[Modifiers.META.value, Modifiers.SHIFT.value],
Arrows.DOWN.value,
lazy.layout.grow_down(),
desc="Grow window down",
),
Key(
[Modifiers.META.value, Modifiers.SHIFT.value],
Arrows.UP.value,
lazy.layout.grow_up(),
desc="Grow window up",
),
Key(
[Modifiers.META.value],
"n",
lazy.layout.normalize(),
desc="Reset all window sizes",
),
]
_shortcut_keys = [
Key(
[Modifiers.META.value],
"Return",
lazy.spawn(TERMINAL),
desc="Launch terminal",
),
Key(
[Modifiers.META.value],
"Tab",
lazy.next_layout(),
desc="Toggle between layouts",
),
Key([Modifiers.META.value], "w", lazy.window.kill(), desc="Kill focused window"),
Key(
[Modifiers.META.value, Modifiers.CTRL.value],
"r",
lazy.reload_config(),
desc="Reload the config",
),
Key(
[Modifiers.META.value, Modifiers.SHIFT.value],
"s",
lazy.spawn("flameshot gui"),
desc="Start a manual capture in GUI mode",
),
Key(
[Modifiers.META.value],
"e",
lazy.spawn(TERMINAL + " -e ranger"),
desc="Open file manager",
),
Key(
[Modifiers.META.value],
"m",
lazy.run_extension(
extension.CommandSet(
fontsize=15,
dmenu_prompt=">_ ",
foreground=kanagawa.base0B,
selected_foreground=kanagawa.base00,
selected_background=kanagawa.base0B,
commands={
k: v for c in commands for k, v in c.as_command_set_dict().items()
},
)
),
),
]
_media_keys = [
Key(
[],
"XF86AudioRaiseVolume",
lazy.spawn("pulsemixer --change-volume +5 --max-volume 100"),
lazy.spawn(f"aplay '{CUR_DIR}/beep2.wav'"),
desc="Increase volume",
),
Key(
[],
"XF86AudioLowerVolume",
lazy.spawn("pulsemixer --change-volume -5 --max-volume 100"),
lazy.spawn(f"aplay '{CUR_DIR}/beep2.wav'"),
desc="Decrease volume",
),
Key(
[],
"XF86AudioPlay",
lazy.spawn("playerctl play-pause"),
desc="Play/Pause music",
),
Key(
[],
"XF86AudioNext",
lazy.spawn("playerctl next"),
desc="Next music",
),
Key(
[],
"XF86AudioPrev",
lazy.spawn("playerctl previous"),
desc="Previous music",
),
]
keys = _focus_keys + _move_keys + _resize_keys + _shortcut_keys + _media_keys
mouse = [
Drag(
[Modifiers.META.value],
"Button1",
lazy.window.set_position_floating(),
start=lazy.window.get_position(),
),
Drag(
[Modifiers.META.value],
"Button3",
lazy.window.set_size_floating(),
start=lazy.window.get_size(),
),
Click([Modifiers.META.value], "Button2", lazy.window.toggle_floating()),
]