Nowadays Xorg infers the configuration automatically, and for most of my usecases it works perfectly!
I work on Passenger Information System software and now one bus has their monitors installed upside down.
I could circumvent it with: xrandr --output HMDI-1 --mode 1920x1080 --rotate inverted
Except, that my software also uses xrandr
to turn the screen off (xrandr --output HDMI-1 --off
) and back on (xrandr --output HDMI-1 --auto
) when necessary via exec
calls.
But it goes through all connected devices and uses their actual device names instead. It's not a hardcoded HDMI-1
.
The trick here is that --auto
by default uses the default configuration, and in this instance, the default is to have the screen in it's expected rotation, which due to it being installed upside-down is.. well... upside-down.
If I was to add the xrandr --rotate
call on software bootup, it would tamper with other instances, that do not need this. And to solve it in software in this case is much too big of an effort, when I think the alternative could be to provide the default via Xorg configuration augmentation.
I could set up the augments by hand on each installation where the screens are installed in weird ways and leave software as generic as possible.
My idea is to add Option "Rotate" "inverted"
to a config in /usr/share/X11/xorg.conf.d/xx-HDMI-1-default-rotation.conf
.
Again, the HDMI-1 would be swapped for the actual device name on each installation, this happens to be HDMI-1.
First problem: I don't know if such a minimal augmentation is possible.
Second problem: I don't know if xrandr --auto
would use that as it's default in such case.
Third problem: In this auto-configuration setup, I don't know how to hook up the augmentation because I don't know which Identifier
's to use.
Section "Monitor"
Identifier "???" <-- what to use here, so I don't override other defaults inferred by Xorg?
Device "???" <-- what to use here, so that it applies to devices found by Xorg?
Option "Rotate" "inverted"
EndSection
The other way I can think of is to use Xorg :0 -configure
and add my augmentations there, but in this case, I am not sure if the configuration will be valid and wouldn't tamper with anything else.
I am no X expert, and the Xorg :0 -configure
call provides me with too much configuration parameters that my confidence of using it in production lowers dramatically.