summaryrefslogtreecommitdiffstats
path: root/files/.config/qtile/config.py
diff options
context:
space:
mode:
Diffstat (limited to 'files/.config/qtile/config.py')
-rw-r--r--files/.config/qtile/config.py232
1 files changed, 232 insertions, 0 deletions
diff --git a/files/.config/qtile/config.py b/files/.config/qtile/config.py
new file mode 100644
index 0000000..9106731
--- /dev/null
+++ b/files/.config/qtile/config.py
@@ -0,0 +1,232 @@
1import os
2import subprocess
3
4from typing import List
5
6from libqtile import bar, layout, widget
7from libqtile.config import Click, Drag, Group, Key, Match, Screen, KeyChord
8from libqtile import extension
9from libqtile.lazy import lazy
10from libqtile.utils import guess_terminal
11from libqtile import hook
12
13MOD = "mod4"
14
15TERMINAL = guess_terminal()
16
17DMENU_FLAGS = '-l 16 -p run -c -i'
18
19BAR = '#282a36'
20LIGHT_BAR = '#393b37'
21YELLOW = '#f1fa8c'
22RED = '#ff5555'
23LIGHT_RED = '#ff9999'
24GREEN = '#50fa7b'
25CYAN = '#8be9fd'
26LIGHT_CYAN = '#abfbff'
27
28@hook.subscribe.startup_once
29def autostart():
30 home = os.path.expanduser('~/.config/qtile/autorc')
31 subprocess.run([home])
32
33keys = [
34 Key([MOD], "h", lazy.layout.left(), desc="Move focus to left"),
35 Key([MOD], "l", lazy.layout.right(), desc="Move focus to right"),
36 Key([MOD], "j", lazy.layout.down(), desc="Move focus down"),
37 Key([MOD], "k", lazy.layout.up(), desc="Move focus up"),
38 Key([MOD], "s", lazy.next_screen() ),
39 Key([MOD], "space", lazy.window.toggle_floating(),
40 desc="Move window focus to other window"),
41
42 Key([MOD, "shift"], "h", lazy.layout.shuffle_left(),
43 desc="Move window to the left"),
44 Key([MOD, "shift"], "l", lazy.layout.shuffle_right(),
45 desc="Move window to the right"),
46 Key([MOD, "shift"], "j", lazy.layout.shuffle_down(),
47 desc="Move window down"),
48 Key([MOD, "shift"], "k", lazy.layout.shuffle_up(), desc="Move window up"),
49
50 Key([MOD, "control"], "h", lazy.layout.grow_left(),
51 desc="Grow window to the left"),
52 Key([MOD, "control"], "l", lazy.layout.grow_right(),
53 desc="Grow window to the right"),
54 Key([MOD, "control"], "j", lazy.layout.grow_down(),
55 desc="Grow window down"),
56 Key([MOD, "control"], "k", lazy.layout.grow_up(), desc="Grow window up"),
57 Key([MOD], "n", lazy.layout.normalize(), desc="Reset all window sizes"),
58
59 Key([MOD, "shift"], "Return", lazy.layout.toggle_split(),
60 desc="Toggle between split and unsplit sides of stack"),
61 Key([MOD], "Return", lazy.spawn(TERMINAL), desc="Launch terminal"),
62
63 Key([MOD], "Tab", lazy.next_layout(), desc="Toggle between layouts"),
64 Key([MOD], "c", lazy.window.kill(), desc="Kill focused window"),
65
66 Key([MOD, "control"], "r", lazy.restart(), desc="Restart Qtile"),
67 Key([MOD, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"),
68
69 Key([MOD], "F12", os.system("xbacklight -inc 10"), desc="Inc backlight"),
70 Key([MOD], "F11", os.system("xbacklight -dec 10"), desc="Dec backlight"),
71
72 Key([MOD], "r", lazy.spawncmd(),
73 desc="Spawn a command using a prompt widget"),
74
75 KeyChord([MOD], "p", [
76 Key([], "p", lazy.spawn(f"dmenu_run {DMENU_FLAGS}"), desc="Spawn dmenu run"),
77 Key([], "n", lazy.spawn(f"networkmanager_dmenu {DMENU_FLAGS}"), desc="Spawn dmenu for network manager"),
78 ]),
79
80 Key([MOD, "mod1"], "q", lazy.spawn("qutebrowser"), desc="Spawn qutebrowser"),
81 Key([MOD, "mod1"], "b", lazy.spawn("brave"), desc="Spawn brave"),
82 Key([MOD, "mod1"], "f", lazy.spawn("firefox"), desc="Spawn firefox"),
83
84 KeyChord([MOD], "e", [
85 Key([], "e", lazy.spawn("emacsclient -c -a 'emacs'"), desc="Spawn Emacsclient"),
86 Key([], "d", lazy.spawn("emacsclient -c -a 'emacs' --eval '(dired nil)'"), desc='Emacsclient Dired'),
87 Key([], "m", lazy.spawn("emacsclient -c -a 'emacs' --eval '(emms-browser)'"), desc='Emacsclient Dired'),
88 ]),
89
90 Key([MOD, "mod1"], "s", lazy.spawn("alacritty -e spt"), desc="Spawn spt (spotify clent)"),
91 Key([MOD, "mod1"], "l", lazy.spawn("slock"), desc="lock desktop"),
92 Key([MOD, "mod1"], "r", lazy.spawn("alacritty -e ranger"), desc="Spawn ranger (file manager)"),
93 Key([MOD, "mod1"], "p", lazy.spawn("alacritty -e pulsemixer"), desc="Spawn pulsemixer"),
94]
95
96groups_names = [
97 "dev",
98 "www",
99 "music",
100 "virt",
101 "sys",
102 "other"
103]
104
105groups = [Group(i) for i in groups_names]
106for i, group in enumerate(groups):
107 keys.extend([
108 Key([MOD], str(i+1), lazy.group[group.name].toscreen(),
109 desc="Switch to group {}".format(group.name)),
110
111 Key([MOD, "shift"], str(i+1), lazy.window.togroup(group.name, switch_group=True),
112 desc="Switch to & move focused window to group {}".format(group.name)),
113 ])
114
115mouse = [
116 Drag([MOD], "Button1", lazy.window.set_position_floating(),
117 start=lazy.window.get_position()),
118 Drag([MOD], "Button3", lazy.window.set_size_floating(),
119 start=lazy.window.get_size()),
120 Click([MOD], "Button2", lazy.window.bring_to_front())
121]
122
123layout_cfg = {
124 'border_width': 2,
125 'border_normal': "#bb8888",
126 'border_focus': "884444",
127 'margin': 8
128}
129
130layouts = [
131 # layout.Columns(**layout_cfg),
132 # layout.Max(),
133 layout.Stack(num_stacks=1, **layout_cfg),
134 # layout.Bsp(),
135 # layout.Matrix(),
136 layout.MonadTall(**layout_cfg),
137 # layout.MonadWide(),
138 # layout.RatioTile(),
139 # layout.Tile(),
140 # layout.TreeTab(),
141 # layout.VerticalTile(),
142 # layout.Zoomy(),
143]
144
145widget_defaults = dict(
146 font='sans',
147 fontsize=12,
148 padding=6,
149)
150
151transparent_sep = {
152 'foreground': BAR,
153 'margin': 2
154}
155
156soft_sep = {
157 'foreground': '44475a',
158 'padding': 2,
159 'margin': 4
160}
161
162screens = [
163 Screen(
164 top=bar.Bar(
165 [
166 widget.Sep(**transparent_sep),
167 widget.Image(filename="~/.config/qtile/python.png", margin=4),
168 widget.Sep(**transparent_sep),
169 widget.CurrentLayout(),
170 widget.Sep(**transparent_sep),
171 widget.GroupBox(
172 margin_y = 3,
173 margin_x = 0,
174 padding_y = 5,
175 padding_x = 3,
176 borderwidth = 3,
177 rounded = False,
178 highlight_color = LIGHT_BAR,
179 highlight_method = "line",
180 this_current_screen_border = CYAN,
181 this_screen_border = CYAN,
182 other_current_screen_border = LIGHT_BAR,
183 other_screen_border = LIGHT_BAR,
184 ),
185 widget.Prompt(),
186 widget.Sep(**transparent_sep),
187 widget.WindowName(),
188 widget.Net(format="🌐 ↓{down} ↑{up}", foreground=YELLOW),
189 widget.Sep(**soft_sep),
190 widget.CPU(format='💻 {load_percent}%', fontsize=12, foreground=RED),
191 widget.Sep(**soft_sep),
192 widget.Battery(format='🔋 {char} {percent:2.0%} {hour:d}:{min:02d} {watt:.2f} W', foreground=GREEN),
193 widget.Sep(**soft_sep),
194 widget.Clock(format='📅 %B %-d, %H:%M', foreground=CYAN),
195 widget.Sep(**soft_sep),
196 widget.CurrentScreen(),
197 widget.Sep(**soft_sep),
198 widget.Systray()
199 ],
200 24,
201 margin=8,
202 background=BAR,
203 border_color=CYAN,
204 border_width=1
205 ),
206 ),
207]
208
209floating_layout = layout.Floating(float_rules=[
210 # Run the utility of `xprop` to see the wm class and name of an X client.
211 *layout.Floating.default_float_rules,
212 Match(wm_class='confirmreset'), # gitk
213 Match(wm_class='makebranch'), # gitk
214 Match(wm_class='maketag'), # gitk
215 Match(wm_class='ssh-askpass'), # ssh-askpass
216 Match(title='branchdialog'), # gitk
217 Match(title='pinentry'), # GPG key password entry
218])
219
220dgroups_key_binder = None
221dgroups_app_rules = []
222
223follow_mouse_focus = True
224bring_front_click = False
225cursor_warp = False
226auto_fullscreen = True
227focus_on_window_activation = "smart"
228reconfigure_screens = True
229
230auto_minimize = True
231
232wmname = "LG3D"