Previous Thread
Next Thread
Print Thread
#116630 12/30/19 04:22 PM
Joined: Mar 2007
Posts: 238
T
Senior Member
OP Offline
Senior Member
T
Joined: Mar 2007
Posts: 238
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?

Joined: Mar 2001
Posts: 16,680
Likes: 4
R
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 16,680
Likes: 4
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?

Joined: Mar 2007
Posts: 238
T
Senior Member
OP Offline
Senior Member
T
Joined: Mar 2007
Posts: 238
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!

Joined: May 2006
Posts: 141
Likes: 1
F
Senior Member
Offline
Senior Member
F
Joined: May 2006
Posts: 141
Likes: 1
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.

Joined: Feb 2004
Posts: 2,217
Likes: 5
Very Senior Member
Online Content
Very Senior Member
Joined: Feb 2004
Posts: 2,217
Likes: 5
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.

Joined: Mar 2007
Posts: 238
T
Senior Member
OP Offline
Senior Member
T
Joined: Mar 2007
Posts: 238
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 

Link Copied to Clipboard
Who's Online Now
1 members (r09), 36 guests, and 1 robot.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics8,880
Posts116,792
Members4,962
Most Online890
Jan 17th, 2020
Forum Host
These forums are hosted by www.retrogamesformac.com
Forum hosted by www.retrogamesformac.com