<html><head></head><body>Not sure if this is out of place, but do you know grobi? It works great for me!<br><br>Dominik<br><br>GitHub - fd0/grobi: Automatically configure monitors/outputs for Xorg via RANDR – <a href="https://github.com/fd0/grobi">https://github.com/fd0/grobi</a><br><br><div class="gmail_quote">On July 20, 2021 2:23:21 PM GMT+02:00, Eyal Erez <oneself@gmail.com> wrote:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div dir="ltr">Thank you all for the wonderful suggestions.  There are definitely many good options available that I was not aware of.<div><br></div><div>I've tried a few and autorandr seems like a good addition into my already (more or less) working workflow.  It solves the specific problem that I've described.  In the future, I might try and replace my custom script with a different end-to-end solution.</div><div><br></div><div> </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jul 13, 2021 at 2:22 PM Tomas Janousek <<a href="mailto:tomi@nomi.cz">tomi@nomi.cz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>






<div>
<p>Hi,</p>
<p style="font-style:italic;color:rgb(153,153,153);font-size:80%">On Fri, Jul 09, 2021 at 05:14:54PM +0300, Eyal Erez wrote:</p>
<blockquote style="padding:0px 0.5em;margin:0px;font-style:italic;border-left:2px solid rgb(204,204,204);color:rgb(153,153,153);font-size:80%">
<p>I often use multiple displays. Here are some configurations that I've used<br>
{.quotelead}>with my laptop:</p>
</blockquote>
<blockquote style="padding:0px 0.5em;margin:0px;font-style:italic;border-left:2px solid rgb(204,204,204);color:rgb(153,153,153);font-size:80%">
<p>[…]<br>
I was wondering how others deal with this challenge? Are there other, more<br>
well-built tools, than the script I have to do this more robustly and<br>
automatically?</p>
</blockquote>
<p>There are many ways to do this. I'll describe my setup and then point to some alternatives.</p>
<hr>
<p>I have <a href="https://work.lisk.in/2020/10/11/xrandr-ux.html" target="_blank">a script</a> that extends xrandr command-line usage so that I can just write a generic vertical layout like so:</p>
<pre style="line-height:125%;margin:0px"><code> xrandr-smart --output 'eDP-*' --auto \  
              --output '!(eDP-*)' --auto --above 'eDP-*'  </code></pre>
<p>Then I have <a href="https://github.com/liskin/dotfiles/blob/home/bin/layout-auto" target="_blank">another script</a> that lets me save layouts for <a href="https://github.com/liskin/dotfiles/tree/home/bin/.xlayout" target="_blank">specific configurations</a> of connected monitors. This one is invoked automatically whenever an output is connected/disconnected, using <a href="https://xmonad.github.io/xmonad-docs/xmonad-contrib-0.16.999/XMonad-Hooks-Rescreen.html#v:addRandrChangeHook" target="_blank">https://xmonad.github.io/xmonad-docs/xmonad-contrib-0.16.999/XMonad-Hooks-Rescreen.html#v:addRandrChangeHook</a>.<br>
I can also invoke it manually via a keybinding to force a laptop-only layout, or to force an automatic multi-head layout in an unknown setup. If I need something extra (like external monitor only for games), I just invoke a "layout-extonly" script via <a href="https://github.com/davatorium/rofi" target="_blank">rofi</a> (I only need to type "ex" for it to know what I mean).</p>
<p>(Re)starting xmobars and trayers is handled by <a href="https://xmonad.github.io/xmonad-docs/xmonad-contrib-0.16.999/XMonad-Hooks-StatusBar.html#v:dynamicSBs" target="_blank">https://xmonad.github.io/xmonad-docs/xmonad-contrib-0.16.999/XMonad-Hooks-StatusBar.html#v:dynamicSBs</a>, as mentioned by Yecine earlier.</p>
<p>In my setup, the automatic switching doesn't happen when the screen is locked, and neither do the keybindings work, but that is just my paranoia (and yeah, I should just use <a href="https://packages.debian.org/experimental/cryptsetup-suspend" target="_blank">https://packages.debian.org/experimental/cryptsetup-suspend</a> instead :-)). It's totally possible to let X.H.Rescreen invoke the script even if locked, and <a href="https://github.com/google/xsecurelock" target="_blank">xsecurelock</a> allows configuration of keybindings when the screen is locked.</p>
<hr>
<p>Now for the alternatives:</p>
<p>Others have mentioned autorandr. That is probably what most minimalist window manager users use. Autorandr can be invoked on output (dis)connect, lid open/close and suspend/resume in various ways:</p>
<ul>
<li><a href="https://xmonad.github.io/xmonad-docs/xmonad-contrib-0.16.999/XMonad-Hooks-Rescreen.html#v:addRandrChangeHook" target="_blank">https://xmonad.github.io/xmonad-docs/xmonad-contrib-0.16.999/XMonad-Hooks-Rescreen.html#v:addRandrChangeHook</a><br>
</li>
<li><a href="https://github.com/jceb/srandrd" target="_blank">https://github.com/jceb/srandrd</a><br>
</li>
<li><a href="https://github.com/phillipberndt/autorandr/blob/master/contrib/autorandr_launcher/autorandr_launcher.c" target="_blank">https://github.com/phillipberndt/autorandr/blob/master/contrib/autorandr_launcher/autorandr_launcher.c</a><br>
</li>
<li><a href="https://github.com/phillipberndt/autorandr/blob/master/contrib/listen_lid.sh" target="_blank">https://github.com/phillipberndt/autorandr/blob/master/contrib/listen_lid.sh</a><br>
</li>
<li><a href="https://github.com/phillipberndt/autorandr/blob/master/contrib/pm-utils/40autorandr" target="_blank">https://github.com/phillipberndt/autorandr/blob/master/contrib/pm-utils/40autorandr</a></li>
</ul>
<p>Also see <a href="https://wiki.archlinux.org/title/xrandr" target="_blank">https://wiki.archlinux.org/title/xrandr</a> for other tools and tips.</p>
<div style="color:rgb(153,153,153);font-family:monospace;white-space:pre-wrap;margin:1em 0px 0px;font-size:80%"><span>-- </span><br>Tomáš "liskin" ("Pivník") Janoušek, <a href="https://work.lisk.in/" target="_blank">https://work.lisk.in/</a></div>
</div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><font face="'courier new', monospace"><b>Eyal Erez <</b><a href="mailto:oneself@gmail.com" target="_blank"><b>oneself@gmail.com</b></a><b>></b><br><br></font><div><div><font face="'courier new', monospace">There are 10 types of people, those who know binary and those who don't.</font></div></div><div><font face="'courier new', monospace"><br></font></div></div></div>
</blockquote></div></body></html>