-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
417 lines (379 loc) · 14.5 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
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
##########################
# title: qtile #
# tags: config.py #
# author: thelinuxfraud #
##########################
import os
import subprocess
from libqtile import bar, layout, widget, hook, qtile
from libqtile.backend.wayland import InputConfig
from libqtile.config import Click, Drag, Group, Key, Match, Screen
from libqtile.lazy import lazy
from libqtile.utils import guess_terminal
from qtile_extras import widget
from qtile_extras.widget.decorations import BorderDecoration
from qtile_extras.widget.decorations import RectDecoration
# Startup Applications
@hook.subscribe.startup_once
def autostart():
if qtile.core.name == "x11":
autostartscript = "~/.config/qtile/scripts/x11-autostart.sh"
elif qtile.core.name == "wayland":
autostartscript = "~/.config/qtile/scripts/wayland-autostart.sh"
home = os.path.expanduser(autostartscript)
subprocess.Popen([home])
if qtile.core.name == "wayland":
os.environ["XDG_SESSION_DESKTOP"] = "qtile:wlroots"
os.environ["XDG_CURRENT_DESKTOP"] = "qtile:wlroots"
mod = "mod4"
terminal = "kitty"
home = os.path.expanduser('~')
keys = [
# ESSENTIALS #
# Important keys
Key([mod, "shift"], "m", lazy.spawn("dmenu_run -i"), desc="Dmenu app"),
Key([mod, "shift"], "d", lazy.spawn("wofi --show drun"), desc="App launcher"),
Key([mod, "shift"], "r", lazy.reload_config(), desc="Reload the config"),
Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"),
Key([mod], "Space", lazy.next_layout(), desc="Toggle between layouts"),
Key([mod], "q", lazy.window.kill(), desc="Kill focused window"),
Key([mod], "m", lazy.window.toggle_fullscreen(), desc="Toggle fullscreen on the focused window",),
Key([mod], "r", lazy.spawncmd(), desc="Spawn prompt widget"),
# Multimedia keys
Key([], "XF86MonBrightnessUp", lazy.spawn("brightnessctl set +3%"), desc="Raise brightness level by 3%"),
Key([], "XF86MonBrightnessDown", lazy.spawn("brightnessctl set 3-%"), desc="Lower brightness level by 3%"),
Key([], "XF86AudioRaiseVolume", lazy.spawn("amixer sset Master 3%+"), desc="Raise volume level by 3%"),
Key([], "XF86AudioLowerVolume", lazy.spawn("amixer sset Master 3%-"), desc="Lower volume level by 3%"),
Key([], "XF86AudioMute", lazy.spawn("amixer sset Master 1+ toggle"), desc="Mute or unmute volume level"),
# Applications
Key([mod, "shift"], "l", lazy.spawn("spotify"), desc="Music player"),
Key([mod, "shift"], "Return", lazy.spawn("thunar"), desc="File manager"),
Key([mod, "shift"], "e", lazy.spawn("emacs"), desc="Doom Emacs"),
Key([mod], "Return", lazy.spawn("kitty"), desc="Terminal"),
Key([mod], "b", lazy.spawn("firefox"), desc="Web browser"),
Key([mod], "d", lazy.spawn("discord"), desc="Discord app"),
Key([mod], "p", lazy.spawn("grim"), desc="Screenshot tool"),
# WINDOW FOCUSING #
# Change Window Focus
Key([mod], "Up", lazy.layout.up()),
Key([mod], "Down", lazy.layout.down()),
Key([mod], "Left", lazy.layout.left()),
Key([mod], "Right", lazy.layout.right()),
# Resize Windows
Key([mod, "control"], "Right",
lazy.layout.grow_right(),
lazy.layout.grow(),
lazy.layout.increase_ratio(),
lazy.layout.delete(),
),
Key([mod, "control"], "Left",
lazy.layout.grow_left(),
lazy.layout.shrink(),
lazy.layout.decrease_ratio(),
lazy.layout.add(),
),
Key([mod, "control"], "Up",
lazy.layout.grow_up(),
lazy.layout.grow(),
lazy.layout.decrease_nmaster(),
),
Key([mod, "control"], "Down",
lazy.layout.grow_down(),
lazy.layout.shrink(),
lazy.layout.increase_nmaster(),
),
# Shift focused window
Key([mod, "shift"], "Up", lazy.layout.shuffle_up()),
Key([mod, "shift"], "Down", lazy.layout.shuffle_down()),
Key([mod, "shift"], "Left", lazy.layout.swap_left()),
Key([mod, "shift"], "Right", lazy.layout.swap_right()),
]
groups = [Group(i) for i in "1234567890"]
for i in groups:
keys.extend(
[
# Change workspaces
Key([mod], i.name, lazy.group[i.name].toscreen()),
Key([mod], "Tab", lazy.screen.next_group()),
Key([mod, "shift" ], "Tab", lazy.screen.prev_group()),
# Move focused window to workspace 1-10 / follow
Key([mod, "shift"],i.name,lazy.window.togroup(i.name, switch_group=True), desc="Switch to & move focused window to group {}".format(i.name),),
# Moved focused window to workspace 1-10 / stay
Key([mod, "control"], i.name, lazy.window.togroup(i.name), desc="move focused window to group {}".format(i.name)),
])
def init_layout_theme():
return {"margin":8,
"border_width":2,
"border_focus": "#81a1c1",
"border_normal": "#2e3440"
}
layout_theme = init_layout_theme()
layouts = [
layout.MonadTall(**layout_theme, new_client_position='top'),
layout.Max(),
]
widget_defaults = dict(
font="RobotoMono Nerd Font",
fontsize=12,
padding=3,
)
extension_defaults = widget_defaults.copy()
screens = [
Screen(
top=bar.Bar(
[
widget.Sep(
linewidth = 1,
padding = 5,
foreground = "#4c566a",
background = "#2e3440"
),
widget.CurrentLayoutIcon(
padding = 4,
scale = 0.7,
foreground = "#d8dee9",
background = "#2e3440"
),
widget.Sep(
linewidth = 1,
padding = 5,
foreground = "#4c566a",
background = "#2e3440"
),
widget.GroupBox(
font = "RobotoMono Nerd Font Bold",
fontsize = 12,
margin_y = 2,
margin_x = 3,
padding_y = 2,
padding_x = 3,
borderwidth = 0,
disable_drag = True,
active = "#4c566a",
inactive = "#2e3440",
rounded = False,
highlight_method = "text",
this_current_screen_border = "#d8dee9",
foreground = "#4c566a",
background = "#2e3440"
),
widget.Sep(
linewidth = 1,
padding = 5,
foreground = "#4c566a",
background = "#2e3440"
),
widget.Prompt(
font = "RobotoMono Nerd Font",
fontsize = 12,
background = "#2e3440",
foreground = "#d8dee9"
),
widget.WindowName(
font = "RobotoMono Nerd Font Bold",
fontsize = 12,
foreground = "#d8dee9",
background = "#2e3440"
),
widget.Sep(
foreground = "#4c566a",
background = "#2e3440",
padding = 5,
linewidth = 1
),
widget.Net(
foreground = "#2e3440",
background = "#2e3440",
font = 'RobotoMono Nerd Font Bold',
fontsize = 12,
format = '{down} ↓↑ {up}',
interface = 'wlan0',
decorations = [
RectDecoration (
colour = "#8fbcbb",
padding_y = 3,
radius = 2,
filled = True
),
],
),
widget.Sep(
linewidth = 1,
padding = 5,
foreground = "#4c566a",
background = "#2e3440"
),
widget.CPU(
background = "#2e3440",
foreground = "#2e3440",
font = "RobotoMono Nerd Font Bold",
fontsize = 12,
decorations = [
RectDecoration (
colour = "#ebcb8b",
padding_y = 3,
radius = 2,
filled = True
),
],),
widget.Sep(
linewidth = 1,
padding = 5,
foreground = "4c566a",
background = "#2e3440"
),
widget.Memory(
measure_mem = 'G',
foreground = "#2e3440",
background = "#2e3440",
font = "RobotoMono Nerd Font Bold",
fontsize = 12,
decorations = [
RectDecoration (
colour = "#88c0d0",
padding_y = 3,
radius = 2,
filled = True
),
],),
widget.Sep(
linewidth = 1,
padding = 5,
foreground = "#4c566a",
background = "#2e3440"
),
widget.DF(
visible_on_warn = False,
background = "#2e3440",
foreground = "#2e3440",
font = "RobotoMono Nerd Font Bold",
fontsize = 12,
decorations = [
RectDecoration (
colour = "#a3be8c",
padding_y = 3,
radius = 2,
filled = True
),
],),
widget.Sep(
linewidth = 1,
padding = 5,
background = "#2e3440",
foreground = "#4c566a"
),
widget.Clock(
foreground = "#2e3440",
background = "#2e3440",
font = "RobotoMono Nerd Font Bold",
fontsize = 12,
format = "%D %H:%M",
decorations = [
RectDecoration (
colour = "#81a1c1",
padding_y = 3,
radius = 2,
filled = True
),
],),
widget.Sep(
linewidth = 1,
padding = 5,
foreground = "#4c566a",
background = "#2e3440"
),
widget.UPowerWidget(
background = "#2e3440",
border_colour = '#d8dee9',
border_critical_colour = '#bf616a',
border_charge_colour = '#d8dee9',
fill_low = '#ebcb8b',
fill_charge = '#a3be8c',
fill_critical = '#bf616a',
fill_normal = '#d8dee9',
percentage_low = 0.4,
percentage_critical = 0.2,
font = "RobotoMono Nerd Font"
),
widget.StatusNotifier(
background = "#2e3440",
icon_size = 20,
padding = 5
),
#widget.Systray(
# background = "#2e3440",
# icon_size = 20,
# padding = 5,
# ),
widget.Sep(
linewidth = 1,
padding = 5,
foreground = "#4c566a",
background = "#2e3440"
),
widget.OpenWeather(
app_key = "4cf3731a25d1d1f4e4a00207afd451a2",
cityid = "4997193",
format = '{main_temp}° {icon}',
metric = False,
font = "RobotoMono Nerd Font Bold",
fontsize = 12,
background = "#2e3440",
foreground = "#d8dee9",
decorations = [
RectDecoration (
colour = "#2e3440",
padding_y = 3,
radius = 2,
filled = True
),
],),
widget.Sep(
linewidth = 1,
padding = 5,
background = "#2e3440",
foreground = "#4c566a"
),
],
# Sets bar height
24,
),
# Set wallpaper
wallpaper="/home/blake/Pictures/wallpapers/nord/nord-river.png",
wallpaper_mode='fill',
),
]
# Drag floating layouts.
mouse = [
Drag([mod], "Button1", lazy.window.set_position_floating(), start=lazy.window.get_position()),
Drag([mod], "Button3", lazy.window.set_size_floating(), start=lazy.window.get_size()),
Click([mod], "Button2", lazy.window.bring_to_front()),
]
dgroups_key_binder = None
dgroups_app_rules = [] # type: list
main = None
follow_mouse_focus = True
bring_front_click = False
floats_kept_above = True
cursor_warp = False
floating_layout = layout.Floating(border_width=2, border_focus="#5e81ac", border_normal="#2e3440",
float_rules=[
# Run the utility of `xprop` to see the wm class and name of an X client.
*layout.Floating.default_float_rules,
Match(wm_class="confirmreset"), # gitk
Match(wm_class="makebranch"), # gitk
Match(wm_class="maketag"), # gitk
Match(wm_class="ssh-askpass"), # ssh-askpass
Match(title="branchdialog"), # gitk
Match(title="pinentry"), # GPG key password entry
]
)
auto_fullscreen = True
focus_on_window_activation = "focus"
reconfigure_screens = False
# When using the Wayland backend, this can be used to configure input devices.
wl_input_rules = {
"1160:4122:DELL0A20:00 0488:101A Touchpad": InputConfig(tap=True),
}
# Something about java being dumb?
wmname = "LG3D"