Home Page

Moving Screen assignments

Posted By: The Flying Ape

Moving Screen assignments - 12/30/19 04:22 PM

I have a 3 monitor display layout as:
  • LEFT - 2K Portrait for vertical games
  • TOP - 4K for horizontal games
  • BOTTOM - 4K for computer emulation

From time to time, after a re-boot or from a suspended display (Fedora 31 / Wayland), I notice that the screen0, screen1, screen2 assignments can get re-ordered. And so from time to time, I have to edit those ini files to reflect my preferred 'screen screenN'.
I crafted this wrapper script in $HOME/bin/mame.sh to help correct moving screen assignments:


while read Screen X1 Position X2 ; do
        declare -i n=$( echo $Screen | tr -d ' :' )
        IFS='+' read -r geom x y <<< $Position
        [ $x -eq 0 ] && LEFT="screen$n"
        [ $y -eq 0 ] && TOP="screen$n"
        [ $y -eq 1600 ] && BOTTOM="screen$n"
done < <(xrandr --listactivemonitors | grep ^[[:space:][:digit:]])

# save monitor layout to my preferences
sed -i "s/^screen \(.*\)/screen ${BOTTOM}/" $INI/computer.ini
sed -i "s/^screen \(.*\)/screen ${TOP}/" $INI/horizont.ini
sed -i "s/^screen \(.*\)/screen ${LEFT}/" $INI/vertical.ini
sed -i "s/^screen \(.*\)/screen ${TOP}/" $INI/dkong.ini
sed -i "s/^screen \(.*\)/screen ${TOP}/" $INI/pacman.ini

mame64 $@

Am I working too hard? Is there a better/correct way to handle this?
Posted By: R. Belmont

Re: Moving Screen assignments - 12/30/19 06:33 PM

That's a neat solution, but it's IMO the root problem is that Fedora shouldn't be changing your display assignments like that. Have you filed a bug?
Posted By: The Flying Ape

Re: Moving Screen assignments - 01/01/20 06:25 PM

lol, I agree root cause is Wayland, perhaps complicated by GnomeShell events. Just thought I'd check-in, because I end up doing stuff like this to workaround maturing stuff... sometimes needlessly. smile

P.S., Happy New Year!
Posted By: Firehawke

Re: Moving Screen assignments - 01/02/20 03:39 PM

Are your monitors connected with HDMI or DisplayPort? If so, that's the issue. According to Microsoft (who is doing the same damn thing to my incredible irritation) if a DP/HDMI display disappears for a moment (e.g. goes to sleep) the OS is required to disconnect the monitor causing all the detections/positions to reset. On Windows, the detection can completely shuffle the order of the displays too.

It's enough to make me seriously consider getting a set of EDDID override passthroughs so I can make Windows permanently see the displays.
Posted By: Vas Crabb

Re: Moving Screen assignments - 01/03/20 12:29 AM

Yeah, but if the OS used the serial number to identify the display or something, it could make persistent device mappings. We've already been through this with NICs, and Linux seems to have settled on using bus topology to create identifiers for them.
Posted By: The Flying Ape

Re: Moving Screen assignments - 01/07/20 02:09 AM

Interesting. The only thing I could find persistent were my preferences for the display layouts using xrandr in the script above:
$ xrandr --listactivemonitors
Monitors: 3
 0: +XWAYLAND2 1200/350x1920/540+0+1280  XWAYLAND2
 1: +XWAYLAND35 2560/600x1600/340+1200+0  XWAYLAND35
 2: +XWAYLAND36 2560/600x1600/340+1200+1600  XWAYLAND36

... and to parse X/Y to determine which one was the left, top, and bottom displays. The 4K displays are HDMI and are "disconnecting" when they go to sleep and re-register upon wake. The 2K display is DVI-D and pretty much remains static.
© 2020 Forums