responding to xrandr events (or: I'm looking for an xmobar-like app that will work with lots of screen rotations)

I apparently have unusual usage patterns when it comes to multiple monitors, and it's causing problems for xmonad (and other WMs too, but Xmonad is the one I care about..). I frequently change the arrangement, orientation, and number of monitors on my system (it's a laptop that I dock 5-6x/day, and I alternate between sitting/standing at my desk, and I also just like rotating an external 19" lcd depending on the task at hand.). The problem I have is that I haven't found any status-bar like programs (eg: xmobar, taffybar) that will keep up with the screen adjustments I do. (gnome-panel worked, but it's apparently being phased out, and I'm not particularly happy with gnome dependencies anyway.) I usually end up with a status bar that's offset into the middle of the screen after a rotation / addition (taffybar) or, with xmobar, the bar eventually disappears entirely. I think I can probably fix things by tweaking taffybar/xmobar to respond to resize commands from xmonad, but I don't know how to detect the screen geometry changes within my xmonad source. This looks like the right module to start with: http://xmonad.org/xmonad-docs/X11/Graphics-X11-Xlib-Extras.html#t%3AEvent but I haven't been enlightened by any of the Event values, and I don't know enough to tell if there are event types missing (eg: XRRScreenChangeNotify, maybe?) or if I just don't know how to interpret the xmonad module/types. Does anyone have suggestions? Thanks! Rogan

Excerpts from Rogan Creswick's message of Wed Oct 26 18:12:51 -0600 2011:
...
I frequently change the arrangement, orientation, and number of monitors on my system (it's a laptop that I dock 5-6x/day, and I alternate between sitting/standing at my desk, and I also just like rotating an external 19" lcd depending on the task at hand.).
Nice!
The problem I have is that I haven't found any status-bar like programs (eg: xmobar, taffybar) that will keep up with the screen adjustments I do. (gnome-panel worked, but it's apparently being phased out, and I'm not particularly happy with gnome dependencies anyway.) I usually end up with a status bar that's offset into the middle of the screen after a rotation / addition (taffybar) or, with xmobar, the bar eventually disappears entirely.
I think I can probably fix things by tweaking taffybar/xmobar to respond to resize commands from xmonad, but I don't know how to detect the screen geometry changes within my xmonad source. This looks like the right module to start with:
http://xmonad.org/xmonad-docs/X11/Graphics-X11-Xlib-Extras.html#t%3AEvent
It turns out all the good stuff is in Graphics.X11.Xlib.Extras
but I haven't been enlightened by any of the Event values .. snip ..
Assuming you are running darcs xmonad, and assuming root window configure events signal such changes, I believe you could use something like (untested): fixBars = -- probably something using getCleanedScreenInfo and Display -- fixBars could be :: IO () or :: X () -- if you end up in X, change (io u) to u, making -- onRescreen :: X () -> Event -> X All onRescreen :: IO () -> Event -> X All onRescreen u (ConfigureEvent {ev_window = w}) = whenX (isRoot w) (io u) >> return (All True) onRescreen _ _ = return (All True) someConfig { handleEventHook = onRescreen fixBars } XMonad.Main runs rescreen on this same event so it's probably what you're looking for. Regards, -Wirt

The problem I have is that I haven't found any status-bar like programs (eg: xmobar, taffybar) that will keep up with the screen adjustments I do.
The current upstream version of xmobar [0] listens to xrandr events and updates its position and size accordingly. -Martin [0]: https://github.com/jaor/xmobar
participants (3)
-
Martin Perner
-
Rogan Creswick
-
Wirt Wolff