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

Commit d03e0ce806ea1722c824b502adea9ae53ff04619
Parent: ba5c2cde7f199d54f288cf44bf91d06d4a395dcd
Author: mcol <mcol@posteo.net>
Date: 2021-06-19 17:11:03 +0100
Committer: mcol <mcol@posteo.net>
Committed: 2021-06-19 17:11:12 +0100

close startup programs at exit

wayland.py Modified

@@ -7,7 +7,6 @@
 import subprocess
 
 from libqtile import hook, qtile
-from libqtile.backend.wayland import InputConfig
 from libqtile.backend.wayland.window import Window
 from libqtile.lazy import lazy
 from libqtile.log_utils import logger
@@ -37,9 +36,13 @@
 
 
 # Configure libinput devices
-wayland_libinput_config = {
-    "type:pointer": InputConfig(drag=True, tap=True, pointer_accel=0.4)
-}
+try:
+    from libqtile.backend.wayland import InputConfig
+    wayland_libinput_config = {
+        "type:pointer": InputConfig(drag=True, tap=True, pointer_accel=0.4)
+    }
+except ImportError:
+    wayland_libinput_config = None
 
 
 @hook.subscribe.client_new
@@ -69,7 +72,8 @@
     env["WOB_BACKGROUND"] = "#00000000"
     env["WOB_BAR"] = "#66CFCCD6"
     HOME = os.path.expanduser('~')
-    subprocess.Popen(f"{HOME}/.config/qtile/startup.sh", shell=True, env=env)
+    p = subprocess.Popen(f"{HOME}/.config/qtile/startup.sh", shell=True, env=env)
+    hook.subscribe.shutdown(p.terminate)
 
 
 if IS_XEPHYR:

startup.sh Modified

@@ -2,12 +2,18 @@
 #
 # Qtile Wayland startup script
 
-foot --server &
-swaybg -c '#1B2021' &
+QTILE_PID=$PPID
 
+
+{
+    foot --server &
+    swaybg -c '#1B2021' &
+} &> /dev/null
+
+
+# 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} \
@@ -15,20 +21,24 @@
     --bar-color ${WOB_BAR:-#00ffffff} -t 800 &
 
 
-# Things after this are only run on a TTY
-[[ -n "$QTILE_XEPHYR" ]] || exit  
-
-
-run_if_new() { pgrep $1 || $@; }
-
-{
-    run_if_new mako &
-    run_if_new keepassxc &
-
-    pgrep wlsunset && pkill -SIGKILL wlsunset
-    wlsunset -t 3100 -T 5700 -l 55.7 -L -3.1 &
+# TTY session only
+[[ -z "$QTILE_XEPHYR" ]] && {
+    mako &
+    keepassxc &
+    firefox &
     kanshi &
+    wlsunset -t 3100 -T 5700 -l 55.7 -L -3.1 &
+
+    sleep 3
+    check_systemd
 } &> /dev/null
 
-sleep 3
-check_systemd
+
+# Clean up
+clean() {
+    pkill -P $$
+    test -e $FIFO && rm $FIFO
+}
+trap clean SIGINT SIGTERM
+sleep infinity &
+wait $!