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

Commit 5423cf39f3ee271725a3110479f30cb8925ef2cd
Parent: cd040823aa191720b57366d1f1e878f27c9e3bb3
Author: mcol <mcol@posteo.net>
Date: 2022-09-03 03:23:47 +0100
Committer: mcol <mcol@posteo.net>
Committed: 2022-09-03 03:23:47 +0100

add hacky workaround for my bad monitor

config.py Modified

@@ -624,6 +624,29 @@
         groupboxes[0].bar.draw()
 
 
+@hook.subscribe.screen_change
+def _(*_):
+    # Temporary hacky fix for the dell monitor on my desk which for some mysterious
+    # reason doesn't advertise that it supports any HD mode. Qtile does support setting
+    # custom modes via the protocol, but neither kanshi nor wdisplays do. So instead,
+    # I'll detect if that monitor is present and set the desired custom mode here.
+    for output in qtile.core.outputs:
+        wlr_output = output.wlr_output
+        # Not only does this monitor not report modes correctly, it ALSO doesn't report
+        # a make or model.
+        if wlr_output.make == wlr_output.model == "<Unknown>":
+            if wlr_output.current_mode.width == 1024:
+                break
+    else:
+        return
+
+    wlr_output.set_custom_mode(1920, 1080, 0)
+    # Lastly, while cmd_reconfigure_screens will be fired right after this hook, as it
+    # gets subscribed to this hook right after the config is loaded, the backend doesn't
+    # get a change to actually apply the mode, so let's flush it.
+    qtile.core.flush()
+
+
 bar_border_width = [0, 3, 0, 3]
 bar_border_color = ["000000", colours[5], "000000", colours[5]]