summaryrefslogtreecommitdiffstats
path: root/.config
diff options
context:
space:
mode:
authorjdlugosz963 <jdlugosz963@gmail.com>2022-07-26 21:29:51 +0200
committerjdlugosz963 <jdlugosz963@gmail.com>2022-07-26 21:29:51 +0200
commita0807a0ebb07d1cfbcf88bc3dc81eca4a5ff11e1 (patch)
treef9fcce866310d38b3401afb3d7aa153e4aa3f281 /.config
parentd3c7562f6b8d7d14fe6198897289973398177074 (diff)
downloaddotfiles-a0807a0ebb07d1cfbcf88bc3dc81eca4a5ff11e1.tar.gz
dotfiles-a0807a0ebb07d1cfbcf88bc3dc81eca4a5ff11e1.zip
Add config.org file to qtile conig
Diffstat (limited to '.config')
-rw-r--r--.config/qtile/config.org291
-rw-r--r--.config/qtile/config.py113
2 files changed, 348 insertions, 56 deletions
diff --git a/.config/qtile/config.org b/.config/qtile/config.org
new file mode 100644
index 0000000..54892f6
--- /dev/null
+++ b/.config/qtile/config.org
@@ -0,0 +1,291 @@
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
18import os
19import subprocess
20
21from typing import List
22
23from libqtile import bar, layout, widget
24from libqtile.config import Click, Drag, Group, Key, Match, Screen
25from libqtile import extension
26from libqtile.lazy import lazy
27from libqtile.utils import guess_terminal
28from libqtile import hook
29#+end_src
30
31** Defining const variables
32*** Mod key
33#+begin_src python
34MOD = "mod4"
35#+end_src
36
37*** Default terminal
38#+begin_src python
39TERMINAL = guess_terminal()
40#+end_src
41
42*** Color scheme
43#+begin_src python
44BAR = '#282a36'
45LIGHT_BAR = '#393b37'
46YELLOW = '#f1fa8c'
47RED = '#ff5555'
48LIGHT_RED = '#ff9999'
49GREEN = '#50fa7b'
50CYAN = '#8be9fd'
51LIGHT_CYAN = '#abfbff'
52#+end_src
53
54
55** Startup script executor
56#+begin_src python
57@hook.subscribe.startup_once
58def 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
66keys = [
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
129groups_names = [
130 "dev",
131 "www",
132 "music",
133 "virt",
134 "sys",
135 "other"
136]
137
138groups = [Group(i) for i in groups_names]
139for 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
151mouse = [
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
163layout_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
173layouts = [
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
193widget_defaults = dict(
194 font='sans',
195 fontsize=12,
196 padding=6,
197)
198#+end_src
199
200**** Transparent separator
201#+begin_src python
202transparent_sep = {
203 'foreground': BAR,
204 'margin': 2
205}
206#+end_src
207
208**** Soft separator
209#+begin_src python
210soft_sep = {
211 'foreground': '44475a',
212 'padding': 2,
213 'margin': 4
214}
215#+end_src
216
217*** Bar
218#+begin_src python
219screens = [
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 ],
255 24,
256 margin=8,
257 background=BAR,
258 border_color=CYAN,
259 border_width=1
260 ),
261 ),
262]
263#+end_src
264
265** Other settings
266#+begin_src python
267floating_layout = layout.Floating(float_rules=[
268 # Run the utility of `xprop` to see the wm class and name of an X client.
269 ,*layout.Floating.default_float_rules,
270 Match(wm_class='confirmreset'), # gitk
271 Match(wm_class='makebranch'), # gitk
272 Match(wm_class='maketag'), # gitk
273 Match(wm_class='ssh-askpass'), # ssh-askpass
274 Match(title='branchdialog'), # gitk
275 Match(title='pinentry'), # GPG key password entry
276])
277
278dgroups_key_binder = None
279dgroups_app_rules = []
280
281follow_mouse_focus = True
282bring_front_click = False
283cursor_warp = False
284auto_fullscreen = True
285focus_on_window_activation = "smart"
286reconfigure_screens = True
287
288auto_minimize = True
289
290wmname = "LG3D"
291#+end_src
diff --git a/.config/qtile/config.py b/.config/qtile/config.py
index 86d14bd..0cdd232 100644
--- a/.config/qtile/config.py
+++ b/.config/qtile/config.py
@@ -10,8 +10,9 @@ from libqtile.lazy import lazy
10from libqtile.utils import guess_terminal 10from libqtile.utils import guess_terminal
11from libqtile import hook 11from libqtile import hook
12 12
13mod = "mod4" 13MOD = "mod4"
14terminal = guess_terminal() 14
15TERMINAL = guess_terminal()
15 16
16BAR = '#282a36' 17BAR = '#282a36'
17LIGHT_BAR = '#393b37' 18LIGHT_BAR = '#393b37'
@@ -22,55 +23,54 @@ GREEN = '#50fa7b'
22CYAN = '#8be9fd' 23CYAN = '#8be9fd'
23LIGHT_CYAN = '#abfbff' 24LIGHT_CYAN = '#abfbff'
24 25
25
26@hook.subscribe.startup_once 26@hook.subscribe.startup_once
27def autostart(): 27def autostart():
28 home = os.path.expanduser('~/.config/qtile/autorc') 28 home = os.path.expanduser('~/.config/qtile/autorc')
29 subprocess.run([home]) 29 subprocess.run([home])
30 30
31keys = [ 31keys = [
32 Key([mod], "h", lazy.layout.left(), desc="Move focus to left"), 32 Key([MOD], "h", lazy.layout.left(), desc="Move focus to left"),
33 Key([mod], "l", lazy.layout.right(), desc="Move focus to right"), 33 Key([MOD], "l", lazy.layout.right(), desc="Move focus to right"),
34 Key([mod], "j", lazy.layout.down(), desc="Move focus down"), 34 Key([MOD], "j", lazy.layout.down(), desc="Move focus down"),
35 Key([mod], "k", lazy.layout.up(), desc="Move focus up"), 35 Key([MOD], "k", lazy.layout.up(), desc="Move focus up"),
36 Key([mod], "s", lazy.next_screen() ), 36 Key([MOD], "s", lazy.next_screen() ),
37 Key([mod], "space", lazy.layout.next(), 37 Key([MOD], "space", lazy.window.toggle_floating(),
38 desc="Move window focus to other window"), 38 desc="Move window focus to other window"),
39 39
40 Key([mod, "shift"], "h", lazy.layout.shuffle_left(), 40 Key([MOD, "shift"], "h", lazy.layout.shuffle_left(),
41 desc="Move window to the left"), 41 desc="Move window to the left"),
42 Key([mod, "shift"], "l", lazy.layout.shuffle_right(), 42 Key([MOD, "shift"], "l", lazy.layout.shuffle_right(),
43 desc="Move window to the right"), 43 desc="Move window to the right"),
44 Key([mod, "shift"], "j", lazy.layout.shuffle_down(), 44 Key([MOD, "shift"], "j", lazy.layout.shuffle_down(),
45 desc="Move window down"), 45 desc="Move window down"),
46 Key([mod, "shift"], "k", lazy.layout.shuffle_up(), desc="Move window up"), 46 Key([MOD, "shift"], "k", lazy.layout.shuffle_up(), desc="Move window up"),
47 47
48 Key([mod, "control"], "h", lazy.layout.grow_left(), 48 Key([MOD, "control"], "h", lazy.layout.grow_left(),
49 desc="Grow window to the left"), 49 desc="Grow window to the left"),
50 Key([mod, "control"], "l", lazy.layout.grow_right(), 50 Key([MOD, "control"], "l", lazy.layout.grow_right(),
51 desc="Grow window to the right"), 51 desc="Grow window to the right"),
52 Key([mod, "control"], "j", lazy.layout.grow_down(), 52 Key([MOD, "control"], "j", lazy.layout.grow_down(),
53 desc="Grow window down"), 53 desc="Grow window down"),
54 Key([mod, "control"], "k", lazy.layout.grow_up(), desc="Grow window up"), 54 Key([MOD, "control"], "k", lazy.layout.grow_up(), desc="Grow window up"),
55 Key([mod], "n", lazy.layout.normalize(), desc="Reset all window sizes"), 55 Key([MOD], "n", lazy.layout.normalize(), desc="Reset all window sizes"),
56 56
57 Key([mod, "shift"], "Return", lazy.layout.toggle_split(), 57 Key([MOD, "shift"], "Return", lazy.layout.toggle_split(),
58 desc="Toggle between split and unsplit sides of stack"), 58 desc="Toggle between split and unsplit sides of stack"),
59 Key([mod], "Return", lazy.spawn(terminal), desc="Launch terminal"), 59 Key([MOD], "Return", lazy.spawn(TERMINAL), desc="Launch terminal"),
60 60
61 Key([mod], "Tab", lazy.next_layout(), desc="Toggle between layouts"), 61 Key([MOD], "Tab", lazy.next_layout(), desc="Toggle between layouts"),
62 Key([mod], "c", lazy.window.kill(), desc="Kill focused window"), 62 Key([MOD], "c", lazy.window.kill(), desc="Kill focused window"),
63 63
64 Key([mod, "control"], "r", lazy.restart(), desc="Restart Qtile"), 64 Key([MOD, "control"], "r", lazy.restart(), desc="Restart Qtile"),
65 Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"), 65 Key([MOD, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"),
66 66
67 Key([mod], "F12", os.system("xbacklight -inc 10"), desc="Inc backlight"), 67 Key([MOD], "F12", os.system("xbacklight -inc 10"), desc="Inc backlight"),
68 Key([mod], "F11", os.system("xbacklight -dec 10"), desc="Dec backlight"), 68 Key([MOD], "F11", os.system("xbacklight -dec 10"), desc="Dec backlight"),
69 69
70 Key([mod], "r", lazy.spawncmd(), 70 Key([MOD], "r", lazy.spawncmd(),
71 desc="Spawn a command using a prompt widget"), 71 desc="Spawn a command using a prompt widget"),
72 72
73 Key([mod], "p", lazy.run_extension(extension.DmenuRun( 73 Key([MOD], "p", lazy.run_extension(extension.DmenuRun(
74 dmenu_prompt="Run", 74 dmenu_prompt="Run",
75 dmenu_bottom=False, 75 dmenu_bottom=False,
76 dmenu_lines=56, 76 dmenu_lines=56,
@@ -79,17 +79,18 @@ keys = [
79 foreground=CYAN, 79 foreground=CYAN,
80 ))), 80 ))),
81 81
82 Key([mod, "mod1"], "q", lazy.spawn("qutebrowser"), desc="Spawn qutebrowser"), 82 Key([MOD, "mod1"], "q", lazy.spawn("qutebrowser"), desc="Spawn qutebrowser"),
83 Key([mod, "mod1"], "b", lazy.spawn("brave"), desc="Spawn brave"), 83 Key([MOD, "mod1"], "b", lazy.spawn("brave"), desc="Spawn brave"),
84 Key([mod, "mod1"], "f", lazy.spawn("firefox"), desc="Spawn firefox"), 84 Key([MOD, "mod1"], "f", lazy.spawn("firefox"), desc="Spawn firefox"),
85 Key([mod, "mod1"], "e", lazy.spawn("emacs"), desc="Spawn emacs"), 85 Key([MOD, "mod1"], "e", lazy.spawn("emacs"), desc="Spawn emacs"),
86 Key([mod, "mod1"], "s", lazy.spawn("alacritty -e spt"), desc="Spawn spt (spotify clent)"), 86 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)"), 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"), 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"), 89 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)"), 90 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"), 91 Key([MOD, "mod1"], "p", lazy.spawn("alacritty -e pulsemixer"), desc="Spawn pulsemixer"),
92] 92]
93
93groups_names = [ 94groups_names = [
94 "dev", 95 "dev",
95 "www", 96 "www",
@@ -102,13 +103,20 @@ groups_names = [
102groups = [Group(i) for i in groups_names] 103groups = [Group(i) for i in groups_names]
103for i, group in enumerate(groups): 104for i, group in enumerate(groups):
104 keys.extend([ 105 keys.extend([
105 Key([mod], str(i+1), lazy.group[group.name].toscreen(), 106 Key([MOD], str(i+1), lazy.group[group.name].toscreen(),
106 desc="Switch to group {}".format(group.name)), 107 desc="Switch to group {}".format(group.name)),
107 108
108 Key([mod, "shift"], str(i+1), lazy.window.togroup(group.name, switch_group=True), 109 Key([MOD, "shift"], str(i+1), lazy.window.togroup(group.name, switch_group=True),
109 desc="Switch to & move focused window to group {}".format(group.name)), 110 desc="Switch to & move focused window to group {}".format(group.name)),
110 ]) 111 ])
111 112
113mouse = [
114 Drag([MOD], "Button1", lazy.window.set_position_floating(),
115 start=lazy.window.get_position()),
116 Drag([MOD], "Button3", lazy.window.set_size_floating(),
117 start=lazy.window.get_size()),
118 Click([MOD], "Button2", lazy.window.bring_to_front())
119]
112 120
113layout_cfg = { 121layout_cfg = {
114 'border_width': 2, 122 'border_width': 2,
@@ -118,12 +126,12 @@ layout_cfg = {
118} 126}
119 127
120layouts = [ 128layouts = [
121 layout.Columns(**layout_cfg), 129 # layout.Columns(**layout_cfg),
122 # layout.Max(), 130 # layout.Max(),
123 layout.Stack(num_stacks=1, **layout_cfg), 131 layout.Stack(num_stacks=1, **layout_cfg),
124 # layout.Bsp(), 132 # layout.Bsp(),
125 # layout.Matrix(), 133 # layout.Matrix(),
126 # layout.MonadTall(), 134 layout.MonadTall(**layout_cfg),
127 # layout.MonadWide(), 135 # layout.MonadWide(),
128 # layout.RatioTile(), 136 # layout.RatioTile(),
129 # layout.Tile(), 137 # layout.Tile(),
@@ -137,7 +145,6 @@ widget_defaults = dict(
137 fontsize=12, 145 fontsize=12,
138 padding=6, 146 padding=6,
139) 147)
140extension_defaults = widget_defaults.copy()
141 148
142transparent_sep = { 149transparent_sep = {
143 'foreground': BAR, 150 'foreground': BAR,
@@ -195,19 +202,6 @@ screens = [
195 ), 202 ),
196] 203]
197 204
198mouse = [
199 Drag([mod], "Button1", lazy.window.set_position_floating(),
200 start=lazy.window.get_position()),
201 Drag([mod], "Button3", lazy.window.set_size_floating(),
202 start=lazy.window.get_size()),
203 Click([mod], "Button2", lazy.window.bring_to_front())
204]
205
206dgroups_key_binder = None
207dgroups_app_rules = [] # type: List
208follow_mouse_focus = True
209bring_front_click = False
210cursor_warp = False
211floating_layout = layout.Floating(float_rules=[ 205floating_layout = layout.Floating(float_rules=[
212 # Run the utility of `xprop` to see the wm class and name of an X client. 206 # Run the utility of `xprop` to see the wm class and name of an X client.
213 *layout.Floating.default_float_rules, 207 *layout.Floating.default_float_rules,
@@ -218,6 +212,13 @@ floating_layout = layout.Floating(float_rules=[
218 Match(title='branchdialog'), # gitk 212 Match(title='branchdialog'), # gitk
219 Match(title='pinentry'), # GPG key password entry 213 Match(title='pinentry'), # GPG key password entry
220]) 214])
215
216dgroups_key_binder = None
217dgroups_app_rules = []
218
219follow_mouse_focus = True
220bring_front_click = False
221cursor_warp = False
221auto_fullscreen = True 222auto_fullscreen = True
222focus_on_window_activation = "smart" 223focus_on_window_activation = "smart"
223reconfigure_screens = True 224reconfigure_screens = True