SOLVED: Using 'feh' to display image on second monitor (runcommand_onstart)
-
UPDATE: Solution detailed here: https://retropie.org.uk/forum/post/262396 I imagine you can do the same on a PI4 using
fbi
since it has 2x HDMI ports.Current RP x86_64 (Ubuntu 20.04).
I am currently using the pause button on my arcade cab to pause the game and switch bezels that show the controls. Pushing the pause button again switches back to the main bezel and unpauses the game.
This approach works well but I have decided to install a 2nd monitor that will always show the controls. I figured I could just use the runcommand_onstart file to display the image on the second monitor (using 'feh' since I am x86) but I don't know how to specify the target display in the command line switches.
I've found a few articles that talk about using the --geometry switch since the desktops are essentially extended and just provide the height, width and starting position but figured I would ask here first. Is there a way to specify the display? Is there another image display software I can use that will accomplish what I want to do? Since I am using x86, I can pretty much install anything I need. Or, is the geometry switch the way to go?
Tia!
John -
I have never tried this, but according to the manual you can use --xinerama-index to set the specific monitor you want with feh, assuming it is built with xinerama support:
Use --no-xinerama to treat the whole X display as one monitor when setting wallpapers. You may also use --xinerama-index to use feh as a background set ter for a specific monitor.
This is under the header BACKGROUND SETTING in the feh manual.
EDIT: Also found this in the Arch wiki:
To setup different wallpapers for different monitors one should pass as many file paths as many monitors are available. For example, for a dual monitor setup it would be:$ feh --bg-center path/to/file/for/first/monitor path/to/file/for/second/monitor
I hope this helps!
-
Thanks @brandflake11
I got this one figured out. It was a PITA! :)
Long and short of it is this...
xrandr
treats both displays and one large one (extended). You can see below that Screen 0: is recognized as 5760x1080 (4K TV + 1080P monitor):Screen 0: minimum 320 x 200, current 5760 x 1080, maximum 16384 x 16384 VGA-1 disconnected (normal left inverted right x axis y axis) DP-1 disconnected (normal left inverted right x axis y axis) HDMI-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 800mm x 450mm 3840x2160 30.00 + 24.00 29.97 23.98 4096x2160 30.00 24.00 29.97 23.98 1920x1080 60.00* 59.94 30.00 24.00 29.97 23.98 1920x1080i 60.00 59.94 1680x1050 59.88 1280x1024 75.02 60.02 1440x900 59.90 1280x960 60.00 1280x800 59.91 1152x864 75.00 1280x720 60.00 30.00 59.94 29.97 24.00 23.98 1024x768 75.03 70.07 60.00 800x600 72.19 75.00 60.32 720x480 60.00 59.94 720x480i 60.00 59.94 640x480 75.00 72.81 60.00 59.94 720x400 70.08 DP-2 connected 1920x1080+3840+0 (normal left inverted right x axis y axis) 509mm x 286mm 1920x1080 60.00*+ 50.00 59.94 1920x1080i 60.00 50.00 59.94 1680x1050 59.88 1280x1024 60.02 1440x900 59.90 1280x800 59.91 1152x864 75.00 1280x720 60.00 50.00 59.94 1024x768 70.07 60.00 800x600 60.32 56.25 720x576 50.00 720x480 60.00 59.94 640x480 66.67 60.00 59.95 59.94 720x400 70.08 HDMI-2 disconnected (normal left inverted right x axis y axis)
This is what my
autostart.sh
file looks like:#! /bin/bash #set primary display and resolution. xrandr --display :0 --output HDMI-1 --mode 1920x1080 --primary & #call cvlc to play a startup animation. Wait for it to end before continuing. cvlc --random --play-and-stop --play-and-exit --fullscreen --video-on-top --no-video-title-show --quiet --gl=any --preferred-resolution=1080 ~/RetroPie/splashscreens &> /dev/null #start ES in a terminal (openbox). gnome-terminal --full-screen --hide-menubar -- emulationstation --no-splash
Naturally,
feh
sees the display the same way so you need to use the--geometry
switch to identify the starting pixel on the 2nd monitor. This is what myruncommand-onstart.sh
looks like:#! /bin/bash ROMPATH="$3" ROM_BN_EXT="${ROMPATH##*/}" ROM_BN="${ROM_BN_EXT%.*}" CONTROLSIMAGE="/home/pi/RetroPie/roms/$1/images/$ROM_BN-controls.png" feh --geometry +3840+0 "$CONTROLSIMAGE" &>/dev/null &
This essentially gets the full path to the romfile and trims the extension to get the rom base name.
It then builds the path to the controls image I need and displays at the starting position I tell it to (3840x0) which is the entire screen of the 2nd monitor. When I exit the game, and merely kill feh viaruncommand-onend.sh
:#! /bin/bash killall feh &
This is working perfectly. Now I just need to find a fancy graphic to display on the 2nd monitor when it isn't showing controls. :)
John
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.