-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
383 lines (344 loc) · 12 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
import os
import subprocess
from typing import List
from libqtile import qtile
from libqtile import bar, layout, qtile, widget
from libqtile.config import Click, Drag, Group, Key, Match, Screen, hook, KeyChord, ScratchPad, DropDown
from libqtile.lazy import lazy
from qtile_extras import widget
from libqtile.widget.wlan import Wlan
from libqtile.widget.pulse_volume import PulseVolume
from qtile_extras.widget.decorations import PowerLineDecoration, RectDecoration
mod = "mod4"
alt = "mod1"
shift = "shift"
control = "control"
tab = "Tab"
pgup = "Next"
pgdn = "Prior"
left = "left"
right = "right"
down = "down"
up = "up"
terminal = "alacritty"
def toggle_keyboard_layout(qtile):
qtile.cmd_spawn('setxkbmap $(setxkbmap -query | awk "/layout/{print $2=="us"?"es":"us"}")')
keys = [
# Windows Control
Key([mod], left, lazy.layout.left(), desc="Move focus to left"),
Key([mod], right, lazy.layout.right(), desc="Move focus to right"),
Key([mod], down, lazy.layout.down(), desc="Move focus down"),
Key([mod], up, lazy.layout.up(), desc="Move focus up"),
Key([alt], tab, lazy.layout.next(), desc="Move window focus to other window"),
Key([mod, shift], left, lazy.layout.shuffle_left(), desc="Move window to the left"),
Key([mod, shift], right, lazy.layout.shuffle_right(), desc="Move window to the right"),
Key([mod, shift], down, lazy.layout.shuffle_down(), desc="Move window down"),
Key([mod, shift], up, lazy.layout.shuffle_up(), desc="Move window up"),
Key([mod, control], left, lazy.layout.grow_left(), desc="Grow window to the left"),
Key([mod, control], right, lazy.layout.grow_right(), desc="Grow window to the right"),
Key([mod, control], down, lazy.layout.grow_down(), desc="Grow window down"),
Key([mod, control], up, lazy.layout.grow_up(), desc="Grow window up"),
Key([mod], "n", lazy.layout.normalize(), desc="Reset all window sizes"),
Key(
[mod, shift],
"Return",
lazy.layout.toggle_split(),
desc="Toggle between split and unsplit sides of stack",
),
Key([mod], "Return", lazy.spawn(terminal), desc="Launch terminal"),
Key([mod], tab, lazy.next_layout(), desc="Toggle between layouts"),
Key([mod], "w", lazy.window.kill(), desc="Kill focused window"),
Key(
[mod],
"f",
lazy.window.toggle_fullscreen(),
desc="Toggle fullscreen on the focused window",
),
Key([mod], "t", lazy.window.toggle_floating(), desc="Toggle floating on the focused window"),
Key([mod, control], "r", lazy.reload_config(), desc="Reload the config"),
Key([mod, control], "q", lazy.shutdown(), desc="Shutdown Qtile"),
Key([mod, shift], "r", lazy.spawncmd(), desc="Spawn a command using a prompt widget"),
# Launch Apps
Key([mod], "a", lazy.spawn("rofi -show drun"), desc="Abrir menu"),
Key([mod], "r", lazy.spawn("rofi -show run"), desc="Abrir menu"),
Key([alt, shift], tab, lazy.spawn("rofi -show window"), desc="Abrir menu"),
Key([mod], "s", lazy.spawn("rofi -show ssh"), desc="Abrir menu"),
# Multimedia controls
Key([], "XF86AudioPlay", lazy.spawn("playerctl play-pause"), desc='playerctl'),
Key([], "XF86AudioPrev", lazy.spawn("playerctl previous"), desc='playerctl'),
Key([], "XF86AudioNext", lazy.spawn("playerctl next"), desc='playerctl'),
Key([], "XF86MonBrightnessUp", lazy.spawn("brightnessctl s 10%+"), desc='brightness UP'),
Key([], "XF86MonBrightnessDown", lazy.spawn("brightnessctl s 10%-"), desc='brightness Down'),
Key([], "XF86AudioMute", lazy.spawn("amixer -c 1 Master toggle")),
Key([], "XF86AudioLowerVolume", lazy.spawn("amixer -c 0 set Master 2%-")),
Key([], "XF86AudioRaiseVolume", lazy.spawn("amixer -c 0 set Master 2%+")),
# Others controls
Key([mod, shift], "s", lazy.spawn("flameshot gui"), desc='Screenshot'),
Key([mod], "n", lazy.spawn("kitty ranger"), desc="Abrir Ranger"),
# Set KeyboardLayout
# Key([mod], "space", lazy.function(toggle_keyboard_layout), lazy.spawn('setxkbmap $(setxkbmap -query | awk "/layout/{print $2=="us"?"es":"us"}")'), desc="Toggle Keyboard Layout"),
Key([mod], "space", lazy.spawn("setxkbmap us"), desc="Cambiar Ingés"),
Key([mod, control], "space", lazy.spawn("setxkbmap es"), desc="Cambiar Español"),
Key([mod], pgup, lazy.screen.next_group(), desc="Switch to next screen"),
Key([mod], pgdn, lazy.screen.prev_group(), desc="Switch to previous screen"),
]
groups = []
group_names = [
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"0"
]
group_labels = [
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
]
for i in range(len(group_names)):
groups.append(
Group(
name=group_names[i],
label=group_labels[i],
)
)
for i in groups:
keys.extend(
[
Key(
[mod],
i.name,
lazy.group[i.name].toscreen(),
desc="Switch to group {}".format(i.name),
),
Key(
[mod, "shift"],
i.name,
lazy.window.togroup(i.name, switch_group=True),
desc="Switch to & move focused window to group {}".format(i.name),
),
]
)
layout_theme = {
"margin":10,
"border_width": 4,
"border_focus": "#371B58",
"border_normal": "#5B4B8A"
}
layouts = [
layout.Columns(**layout_theme),
layout.Max(**layout_theme),
# Try more layouts by unleashing below layouts.
# layout.Stack(num_stacks=2),
# layout.Bsp(),
# layout.Matrix(**layout_theme),
# layout.MonadTall(**layout_theme),
layout.MonadWide(**layout_theme),
# layout.RatioTile(**layout_theme),
# layout.Tile(),
# layout.TreeTab(),
layout.VerticalTile(**layout_theme),
# layout.Zoomy(**layout_theme),
]
widget_defaults = dict(
font="sans",
fontsize=12,
padding=3,
)
extension_defaults = widget_defaults.copy()
def open_audio_devices():
qtile.cmd_spawn("pavucontrol")
def system_monitor():
qtile.cmd_spawn("kitty htop")
def system_calendar():
qtile.cmd_spawn("gnome-calendar")
def system_network():
qtile.cmd_spawn("kitty iwctl")
def system_power():
qtile.cmd_spawn("kitty htop")
powerline_left = {
"decorations": [
RectDecoration(use_widget_background=True, padding_x=-2, filled=True, size = 8),
PowerLineDecoration(path="arrow_left", padding_y=0)
]
}
powerline_right = {
"decorations": [
RectDecoration(use_widget_background=True, padding_x=-2, filled=True, size = 8),
PowerLineDecoration(path="arrow_right", padding_y=0)
]
}
screens = [
Screen(
top=bar.Bar(
[
widget.GroupBox(
background="#371B58",
highlight_method='text',
this_current_screen_border="#f1f1f1",
active="#7858A6",
inactive="#4C3575",
**powerline_left,
),
widget.Prompt(),
widget.WindowName(),
widget.Chord(
chords_colors={
"launch": ("#ff0000", "#ffffff"),
},
name_transform=lambda name: name.upper(),
),
widget.Notify(),
widget.TextBox(
foreground="#371B58",
background="#00000000",
**powerline_right,
),
widget.TextBox(
background="#371B58",
text="",
),
widget.ThermalSensor(
background="#371B58",
**powerline_right,
),
widget.StatusNotifier(
background="#4C3575",
),
widget.KeyboardLayout(
background="#4C3575",
fmt=" {}",
),
widget.Systray(
background="#4C3575",
),
widget.Clock(
background="#4C3575",
format="%Y-%m-%d %a",
fmt=" {}",
mouse_callbacks={'Button1': system_calendar},
),
widget.Clock(
background="#4C3575",
format="%I:%M %p",
fmt=" {}",
mouse_callbacks={'Button1': system_calendar},
**powerline_right,
),
widget.CheckUpdates(
background="#5B4B8A",
),
widget.Volume(
background="#5B4B8A",
cardid="amixer",
fmt="",
mouse_callbacks={'Button1': open_audio_devices},
),
widget.PulseVolume(
background="#5B4B8A",
),
widget.Battery(
background="#5B4B8A",
charge_char="",
discharge_char="",
empty_char="",
full_char="",
not_charging_char="",
format='{char} {percent:2.0%}',
update_interval=1,
mouse_callbacks={'Button1': system_power},
),
widget.TextBox(
background="#5B4B8A",
text="",
),
widget.Net(
background="#5B4B8A",
mouse_callbacks={'Button1': system_network},
interface='wlp2s0',
),
widget.Wlan(
background="#5B4B8A",
mouse_callbacks={'Button1': system_network},
**powerline_right,
),
widget.QuickExit(
background="#7858A6",
fontsize=16,
default_text="⏻ ",
countdown_start=5,
countdown_format="{}s",
),
widget.CurrentLayoutIcon(
background="#7858A6",
scale=0.6,
),
widget.CurrentLayout(
background="#7858A6",
),
],
24,
opacity=1,
background="#00000000",
# layout_margin=10,
# single_layout_margin=10,
# layout_border_width=4,
# single_border_width=4,
#margin=[4,4,0,4]
),
),
]
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 = []
follow_mouse_focus = True
bring_front_click = False
floats_kept_above = True
cursor_warp = False
floating_layout = layout.Floating(
float_rules=[
*layout.Floating.default_float_rules,
Match(wm_class="confirmreset"),
Match(wm_class="makebranch"),
Match(wm_class="maketag"),
Match(wm_class="ssh-askpass"),
Match(title="branchdialog"),
Match(title="pinentry"),
]
)
autostart = [
"feh --bg-fill $HOME/.local/share/backgrounds/anderon.png &",
"xsettingsd &",
"picom --no-vsync &",
"xinput --set-prop 10 'libinput Natural Scrolling Enabled' 1 &",
"syncthing -no-browser -no-restart -logflags=0 &",
]
for x in autostart:
os.system(x)
'''
@hook.subscribe.startup_once
def start_once():
subprocess.call(['/usr/bin/sh ~/.config/qtile/sh/autostart.sh'])
'''
auto_fullscreen = True
focus_on_window_activation = "smart"
reconfigure_screens = True
auto_minimize = True
wl_input_rules = None
wmname = "Qtile"