diff options
Diffstat (limited to '.config/qtile/config.org')
| -rw-r--r-- | .config/qtile/config.org | 291 |
1 files changed, 291 insertions, 0 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 | ||
| 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 | ], | ||
| 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 | ||
| 267 | floating_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 | |||
| 278 | dgroups_key_binder = None | ||
| 279 | dgroups_app_rules = [] | ||
| 280 | |||
| 281 | follow_mouse_focus = True | ||
| 282 | bring_front_click = False | ||
| 283 | cursor_warp = False | ||
| 284 | auto_fullscreen = True | ||
| 285 | focus_on_window_activation = "smart" | ||
| 286 | reconfigure_screens = True | ||
| 287 | |||
| 288 | auto_minimize = True | ||
| 289 | |||
| 290 | wmname = "LG3D" | ||
| 291 | #+end_src | ||
