Previous Thread
Next Thread
Print Thread
Moving Screen assignments #116630 12/30/19 04:22 PM
Joined: Mar 2007
Posts: 237
T
The Flying Ape Offline OP
Senior Member
OP Offline
Senior Member
T
Joined: Mar 2007
Posts: 237
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:
Code
#!/bin/bash

INI=~/.mame/ini
LEFT=auto
TOP=auto
BOTTOM=auto

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?

Re: Moving Screen assignments [Re: The Flying Ape] #116632 12/30/19 06:33 PM
Joined: Mar 2001
Posts: 16,434
R
R. Belmont Offline
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 16,434
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?

Re: Moving Screen assignments [Re: R. Belmont] #116658 01/01/20 06:25 PM
Joined: Mar 2007
Posts: 237
T
The Flying Ape Offline OP
Senior Member
OP Offline
Senior Member
T
Joined: Mar 2007
Posts: 237
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!

Re: Moving Screen assignments [Re: The Flying Ape] #116660 01/02/20 03:39 PM
Joined: May 2006
Posts: 127
F
Firehawke Offline
Senior Member
Offline
Senior Member
F
Joined: May 2006
Posts: 127
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.

Re: Moving Screen assignments [Re: The Flying Ape] #116661 01/03/20 12:29 AM
Joined: Feb 2004
Posts: 2,118
Vas Crabb Online Content
Very Senior Member
Online Content
Very Senior Member
Joined: Feb 2004
Posts: 2,118
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.

Re: Moving Screen assignments [Re: The Flying Ape] #116700 01/07/20 02:09 AM
Joined: Mar 2007
Posts: 237
T
The Flying Ape Offline OP
Senior Member
OP Offline
Senior Member
T
Joined: Mar 2007
Posts: 237
Interesting. The only thing I could find persistent were my preferences for the display layouts using xrandr in the script above:
Code
$ 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.


Moderated by  R. Belmont 

Who's Online Now
1 registered members (AJR), 155 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
ShoutChat Box
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics8,747
Posts114,929
Members4,881
Most Online890
Jan 17th, 2020
Powered by UBB.threads™ PHP Forum Software 7.7.3