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