[xmonad] Multi-Monitor issues with XMonad.Hooks.DynamicBars and xmobar

Tomas Janousek tomi at nomi.cz
Sat Apr 27 14:05:11 UTC 2024


Hi Jan,

On Mon, Mar 11, 2024 at 05:44:56PM +0000, Jan Detke wrote:
>[…]
>When I plug my laptop into the docking station my rescreenHook gets executed which invokes autorandr to load my specified profiles, which - when docked - applies the rules for my docked configuration shown above. Xmobar spawns on monitor with ID 1 and indicates, that there is also a second monitor displaying a different workspace but somehow there is no xmobar present on the other monitor (ID 0). When I run the command defined in my barSpawner for monitor ID 0, the xmobar is spawned and works perfectly fine.

The X.H.StatusBar machinery does not normally restart bars that are 
already running. It leaves it up to xmobar itself to notice xrandr 
layout changes and to reposition themselves. That usually works fine but 
yeah I got to admit I've seen xmobar fail to reposition itself. I think 
I even spent some time trying to fix that but concluded it's some weird 
race condition in the X server or Xlib itself that's preventing it from 
seeing the correct layout info.

Anyway, you can try to add 
[killAllStatusBars](https://xmonad.github.io/xmonad-docs/xmonad-contrib/XMonad-Hooks-StatusBar.html#v:killAllStatusBars) 
to your `afterRescreenHook`, and that should cause all bars to be 
restarted.

-- 
Tomáš "liskin" ("Pivník") Janoušek, https://lisk.in/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/xmonad/attachments/20240427/c2305ae9/attachment.html>


More information about the xmonad mailing list