My Qtile window manager configuration
git clone https://github.com/m-col/qtile-config
Files | Refs | Readme

Commit 51638c15c5cdafecc2c7c8a181f7661a3f4322a1
Parent: aebdd4b96ab7e35730f48a60d545016a8298d1eb
Author: mcol <mcol@posteo.net>
Date: 2022-09-15 22:45:27 +0100
Committer: mcol <mcol@posteo.net>
Committed: 2022-09-15 22:45:27 +0100

clean up some stuff

wayland.py Modified

@@ -95,17 +95,8 @@
 @hook.subscribe.startup_once
 async def _():
     # Run a startup script
-    env = os.environ.copy()
-    env["WOB_HEIGHT"] = "28"
-    env["WOB_WIDTH"] = "1920"
-    env["WOB_MARGIN"] = "0"
-    env["WOB_OFFSET"] = "0"
-    env["WOB_BORDER"] = "0"
-    env["WOB_PADDING"] = "0"
-    env["WOB_BACKGROUND"] = "#00000000"
-    env["WOB_BAR"] = "#66CFCCD6"
     HOME = os.path.expanduser("~")
-    p = subprocess.Popen(f"{HOME}/.config/qtile/startup.sh", shell=True, env=env)
+    p = subprocess.Popen(f"{HOME}/.config/qtile/startup.sh")
     hook.subscribe.shutdown(p.terminate)
 
 

startup.sh Modified

@@ -2,20 +2,15 @@
 #
 # Qtile Wayland startup script
 
-QTILE_PID=$PPID
-
-
 {
     foot --server &
 
     # wob
     FIFO=/tmp/wob-$WAYLAND_DISPLAY
     test -e $FIFO || mkfifo $FIFO
-    tail -f $FIFO | wob -a bottom \
-	-M ${WOB_MARGIN:-0} -H ${WOB_HEIGHT:-32} -W ${WOB_WIDTH:-400} \
-	-o ${WOB_OFFSET:-0} -b ${WOB_BORDER:-0} -p ${WOB_PADDING:-0} \
-	--background-color ${WOB_BACKGROUND:-#ff000000} \
-	--bar-color ${WOB_BAR:-#00ffffff} -t 800 &
+    tail -f $FIFO | wob \
+	-a bottom -M 0 -H 28 -W 1920 -o 0 -b 0 -p 0 \
+	--background-color "#00000000" --bar-color "#66CFCCD6" -t 800 &
 
 } &> /dev/null
 
@@ -28,7 +23,7 @@
 	WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=$XDG_CURRENT_DESKTOP &
 
     # Services
-    kanshi &
+    kanshi &>> ~/.local/share/qtile/qtile.log &
     wlsunset &
     swayidle &
     mpDris2 &

power_menu.py Modified

@@ -1,6 +1,5 @@
-from qtile_extras.popup.toolkit import PopupRelativeLayout, PopupImage, PopupText
-
 from libqtile.lazy import lazy
+from qtile_extras.popup.toolkit import PopupImage, PopupRelativeLayout, PopupText
 
 
 def show_power_menu(qtile):

mindfulness.py Modified

@@ -19,17 +19,16 @@
 # SOFTWARE.
 
 import os
-from urllib import request
 from random import randint
+from urllib import request
 
 import gi
 
 gi.require_version("Gst", "1.0")
 from gi.repository import Gst
-
 from libqtile.log_utils import logger
-from libqtile.widget import base
 from libqtile.utils import get_cache_dir
+from libqtile.widget import base
 
 Gst.init(None)
 

groups.py Modified

@@ -28,14 +28,14 @@
 
 
 groups: list[Group] = [
-    Group("1", label="term"),
-    Group("2", label="term"),
-    Group("3", label="term"),
-    Group("4", label="spot", matches=[Match(title="spotify")]),
-    Group("q", label="html", matches=[Match(wm_class="firefox")]),
-    Group("w", label="imap", matches=[Match(wm_class="geary"), Match(title="Geary")]),
-    Group("e", label="work"),
-    Group("r", label="work"),
+    Group("1", label="html", matches=[Match(wm_class="firefox")]),
+    Group("2", label="mail", matches=[Match(wm_class="geary"), Match(title="Geary")]),
+    Group("3", label="tune", matches=[Match(title="spotify")]),
+    Group("4", label="term"),
+    Group("q", label="term"),
+    Group("w", label="term"),
+    Group("e", label="term"),
+    Group("r", label="term"),
 ]
 
 
@@ -121,12 +121,14 @@
     if len(qtile.screens) > 1:
         qtile.groups_map["1"].cmd_toscreen(0, toggle=False)
         qtile.groups_map["q"].cmd_toscreen(1, toggle=False)
+        qtile.focus_screen(1)
 
 
-@hook.subscribe.screen_change
-def _(_):
+@hook.subscribe.screens_reconfigured
+def _():
     # Set groups to screens
     if len(qtile.screens) > 1:
         if qtile.screens[0].group.name not in "1234":
             qtile.groups_map["1"].cmd_toscreen(0, toggle=False)
-        qtile.groups_map["q"].cmd_toscreen(1, toggle=False)
+        if qtile.screens[1].group.name in "1234":
+            qtile.groups_map["q"].cmd_toscreen(1, toggle=False)

config.py Modified

@@ -5,15 +5,14 @@
 
 from __future__ import annotations
 
-import asyncio
 import importlib
 import os
+import re
 import subprocess
 import sys
-import re
 from typing import TYPE_CHECKING
 
-from libqtile import bar, hook, layout, qtile, widget
+from libqtile import bar, hook, layout, qtile, utils, widget
 from libqtile.backend import base
 from libqtile.config import Click, Drag, Key, Match, Screen
 from libqtile.lazy import lazy
@@ -33,6 +32,7 @@
 
 
 import traverse
+from toggle_debug import toggle_debug
 
 use_tags = False
 
@@ -147,6 +147,7 @@
         ([mod, "control"], "Escape", lazy.shutdown(), "Shutdown Qtile"),
         ([mod], "Tab", lazy.next_layout(), "Next layout"),
         ([mod], "b", lazy.hide_show_bar("bottom"), "Hide bar"),
+        ([mod, "control"], "d", lazy.function(toggle_debug), "Toggle debug logging"),
         # Volume control - MyVolume widget is defined further down
         ([], "XF86AudioMute", lazy.widget["myvolume"].mute(), "Mute audio"),
         ([mod], "F10", lazy.widget["myvolume"].mute(), "Mute audio"),
@@ -264,11 +265,13 @@
 border_focus = [colours[5]]
 border_normal = "001122"
 
+
 class MyColumns(layout.Columns):
     """
     I only override this method so I can make 'foot' have wide margins at each side if
     it's the only window open.
     """
+
     def configure(self, client, screen_rect):
         pos = 0
         for col in self.columns:
@@ -290,17 +293,27 @@
             if "foot" in (client.get_wm_class() or []):
                 margin_size = [0, 200, 0, 200]
         width = int(0.5 + col.width * screen_rect.width * 0.01 / len(self.columns))
-        x = screen_rect.x + int(0.5 + pos * screen_rect.width * 0.01 / len(self.columns))
+        x = screen_rect.x + int(
+            0.5 + pos * screen_rect.width * 0.01 / len(self.columns)
+        )
         if col.split:
             pos = 0
             for c in col:
                 if client == c:
                     break
                 pos += col.heights[c]
-            height = int(0.5 + col.heights[client] * screen_rect.height * 0.01 / len(col))
+            height = int(
+                0.5 + col.heights[client] * screen_rect.height * 0.01 / len(col)
+            )
             y = screen_rect.y + int(0.5 + pos * screen_rect.height * 0.01 / len(col))
             client.place(
-                x, y, width - 2 * border, height - 2 * border, border, color, margin=margin_size
+                x,
+                y,
+                width - 2 * border,
+                height - 2 * border,
+                border,
+                color,
+                margin=margin_size,
             )
             client.unhide()
         elif client == col.cw:
@@ -397,6 +410,8 @@
     "fontsize": 16,
 }
 
+icon_font_size = 22
+
 groupbox_config = {
     "active": foreground,
     "highlight_method": "block",
@@ -463,17 +478,17 @@
                 f.write(str(self.volume) + "\n")
 
     def cmd_increase_vol(self):
-        subprocess.call("amixer -c PCH set PCM 3%+".split())
+        subprocess.run("amixer -c PCH set PCM 3%+".split(), capture_output=True)
         self.volume = self.get_volume()
         self._update_drawer(wob=IS_WAYLAND)
 
     def cmd_decrease_vol(self):
-        subprocess.call("amixer -c PCH set PCM 3%-".split())
+        subprocess.run("amixer -c PCH set PCM 3%-".split(), capture_output=True)
         self.volume = self.get_volume()
         self._update_drawer(wob=IS_WAYLAND)
 
     def cmd_mute(self):
-        subprocess.call("amixer -c PCH set PCM toggle".split())
+        subprocess.run("amixer -c PCH set PCM toggle".split(), capture_output=True)
         self.volume = self.get_volume()
         self._update_drawer(wob=False)
 
@@ -483,6 +498,7 @@
     step=1,
     update_interval=None,
     format="",
+    fontsize=icon_font_size,
     change_command=None,
     foreground=colours[3],
 )
@@ -493,7 +509,7 @@
 )
 
 volume = MyVolume(
-    fontsize=18,
+    fontsize=icon_font_size,
     channel="PCM",
     font="Font Awesome 5 Free",
     foreground=colours[4],
@@ -507,13 +523,6 @@
 else:
     systray = widget.Systray(padding=20, icon_size=24)
 
-wlan = widget.Wlan(
-    format="",
-    disconnected_message="",
-    foreground=colours[5],
-    update_interval=5,
-)
-
 # mind = ReMindfulness(
 #    "",
 #    reminder_text="MIND!",
@@ -576,13 +585,14 @@
     low_percentage=0.12,
     foreground=colours[6],
     notify_below=12,
+    fontsize=icon_font_size + 10,
 )
 
 date = widget.Clock(
     format="%e/%m/%g",
     fontsize=16,
     font="TamzenForPowerline Bold",
-    foreground=colours[7],
+    foreground=foreground,
     update_interval=60,
     name="date",
 )
@@ -591,7 +601,7 @@
     fontsize=20,
     font="TamzenForPowerline Medium",
     update_interval=60,
-    foreground=colours[7],
+    foreground=foreground,
     name="time",
 )
 
@@ -637,7 +647,6 @@
                 # mind,
                 volume,
                 bklight,
-                wlan,
                 battery,
                 date,
                 time,
@@ -661,7 +670,6 @@
                 pomodoro,
                 volume,
                 bklight,
-                wlan,
                 battery,
                 date,
                 time,