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