[xmonad] Managing Multiple Displays

Yecine Megdiche yecine.megdiche at gmail.com
Fri Jul 9 15:14:34 UTC 2021


Hello,

if you're using the git version of xmonad-contrib, you're in luck: the new
XMonad.Hooks.StatusBar module caters to that use case. It has built-in
functionality to make status bars (or anything, really) react to changes in
the screen configuration. This is achieved by defining a function that maps
a screen id to "IO StatusBarConfig", which then gets passed to dynamicSBs.
That takes care of appropriately setting the handleEventHook, startupHook
and logHook.

I hope it works!

Yecine

On Fri, 9 Jul 2021 at 16:16, Eyal Erez <oneself at gmail.com> wrote:

> Hi,
>
> I often use multiple displays.  Here are some configurations that I've
> used with my laptop:
> 1. Laptop monitor only
> 2. External monitor only (laptop lid closed)
> 3. External and laptop monitor at the same time.
> 4. Two external monitors (laptop lid closed).
>
> In order to show display correctly (which monitor is to the right/left of
> which and which is on/off) and shift trayer around to the right monitor and
> position, I've written a script that parses the output of xrandr, figures
> out if the laptop lid is open or not, then calls xrandr again to activate
> the right monitors and kills and relaunches trayer and places it in the
> correct position.  I launch this script from a keybinding configured in
> xmonad.hs.
>
> This works, however, it has several disadvantages.  The first is that
> adding a new configuration is a bit tedious -- this doesn't happen very
> often so it's not a huge deal.  The other is that I can only activate the
> script if my screen is unlocked.  This means that if my laptop is suspended
> and I want to disconnect the external monitor and put it in my bag for
> later use, I need to first wake it up, unlock it, launch the script to turn
> the laptop monitor on, and then put it away.  Otherwise, I'll be staring at
> a blank screen when I turn it on and have to guess what to press to unlock
> and use the script.
>
> I was wondering how others deal with this challenge?  Are there other,
> more well-built tools, than the script I have to do this more robustly and
> automatically?
>
> Thank you,
> --
> There are 10 types of people, those who know binary and those who don't.
>
> _______________________________________________
> xmonad mailing list
> xmonad at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/xmonad/attachments/20210709/f077b0c8/attachment.html>


More information about the xmonad mailing list