Re: Dynamic multimonitor setup question

From: Milan Obuch <freebsd-x11_at_dino.sk>
Date: Mon, 14 Mar 2022 09:16:46 UTC
On Mon, 28 Feb 2022 09:39:51 +0100
Milan Obuch <freebsd-x11@dino.sk> wrote:

> Hi,
> 
> for some time I am using various PCs with multiple video outputs,
> either Intel or AMD built-in graphics (i915kms or radeonkms). It is
> quite common for such setup presenting more video outputs, which
> allows more displays to be connected.
> 
> For some time, I am using some manually started scripts to modify the
> setup, kind of
> 
> --- 8<
> -----------------------------------------------------------------
> 
> #! /bin/sh
> 
> xrandr --output DVI-D-1 --auto
> xrandr --output VGA-1 --auto
> xrandr --output VGA-1 --left-of DVI-D-1
> 
> --- 8<
> -----------------------------------------------------------------
> 
> to activate monitors to be used independently as larger working area.
> If such setup is static box, not moved, everything is OK, no need to
> make any change later.
> 
> Recently, I've got a GPD's MicroPC for mobile usage, which changes the
> play. There is internal display with resolution 720x1280 (this needs
> rotation right in order to be used normally, not breaking one's neck
> and having usual corelation mouse to screen), with HDMI output
> available to attach a monitor, possible larger (up to 4K works well,
> tested).
> 
> I can manually switch the second display on, set resolution as
> required (using --auto is the simplest way), start some program and
> use it on additional monitor etc. What I'd like to achieve is some
> dynamic setup, ideally ability to launch some script when monitor is
> detected on HDMI output (connect/disconnect event).
> 
> Has anybody some hints for me? As all notebooks and similar devices
> probably have additional video output, this functionality is, I think,
> really desired.
> 

I did some searching, googling and similar... a found two ports already
in FreeBSD's port collection, x11/arandr and x11/srandrd. The former is
just a graphical interface to xrandr, easy to understand and intuitive
(similar to the way Windows and MacOS X does multimonitor setup). The
latter should do what I am after, but it did not work for me :(

Per 'man srandrd', if started with 'srandrd -v -n some_script', it
should output some debug data (-v), stay in foreground (-n) and invoke
some_script when monitor is being plugged or unplugged. It does not
work for me. Something happens just when I invoke 'xrandr' in another
terminal - I see some debug output, but the script is not invoked.

Is anybody here using x11/srandrd? I can debug the script invocation,
but if the event is not detected without external intervention, it is
not really usable for me. And I have no experience with debugging the
issue in graphics stack...

Regards,
Milan