[xmonad] Managing Multiple Displays

eye eye at eyenx.ch
Sat Jul 10 06:23:54 UTC 2021


Hi Eyal

For automating xrandr and making sure it configures the Monitors (not xmonad) right I use autorandr [1] not sure how that works with laptop lid close tho.

Regards Toni

[1] https://github.com/phillipberndt/autorandr

On 9 July 2021 21:31:04 CEST, Ramon Diaz-Uriarte <rdiaz02 at gmail.com> wrote:
>Dear Eyal,
>
>For the "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. "
>
>why not have a script that, on resuming from suspension, calls your
>already
>working script? This should work even if your screen is locked.
>
>
>I have a very ugly kludge in a script that does that.
>
>I no longer use more than one monitor at a time (my neck did not like
>it),
>but I work either with the laptop connected to an external monitor or
>just
>with the laptop monitor, and I can easily switch from one to another
>with
>suspend events (and all suspend events include locking) in between.
>When I
>resume from suspension, the script is called so that it uses the
>external
>monitor if the laptop is plugged to it (and the monitor is on), or the
>laptop otherwise.
>
>My script is called by a service file I placed as
>/etc/systemd/system/configure_monitors.service (I can send you the
>service
>file and my script kludge, but the later is just a bunch of calls to
>xrandr to
>figure out what is connected, and then configure the screens).
>
>Best,
>
>
>R.
>
>
>
>
>
>
>On Fri, 09-July-2021, at 16:14:54, 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,


More information about the xmonad mailing list