RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    Launch images do not work under Wayland without XWayland

    Scheduled Pinned Locked Moved Ideas and Development
    launch imagesruncommandwayland
    5 Posts 3 Posters 1.6k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ethelingE
      etheling
      last edited by etheling

      Noticed that launching images won't work when running under 'pure' Wayland without XWayland being enabled (because fbi or feh wont run under Wayland). I'm on Ubuntu/x64 but I would guess it'll be the same on arm etc. platforms.

      Easiest 'fix' is to enable XWayland, but under Wayland/Sway feh appears to work a bit oddly not managing to always show the image fullscreen.

      I 'solved' this by adding imv Ubuntu package and by modifying runcommand. sh to use it under Wayland. Trouble is that there doesn't seem to be agreed upon way to reliably detect if one is running under Wayland. I think imv is also mainly intended for tiling window managers like sway/i3, and I didn't test it on stacking ones like Enlightenment, so I don't know how portable this is either. But at least on Wayland/Sway, it does work better than feh when XWayland is enbaled.

      Here's the patch for /opt/retropie/supplementary/runcommand/runcommand.sh in case anyone else bumps into this.

      1221,1222c1221,1231
      <         # if we are running under X use feh otherwise try and use fbi
      <         if [[ -n "$DISPLAY" ]]; then
      ---
      > 	if [[ "$XDG_SESSION_TYPE" == "wayland" ]]; then
      > 	    # if under Wayland use imv 
      > 	    # alas, there appears to be no 'right' way to detect if we're on Wayland:
      > 	    # https://stackoverflow.com/questions/45536141/how-i-can-find-out-if-a-linux-system-uses-wayland-or-x11
      > 	    # https://unix.stackexchange.com/questions/202891/how-to-know-whether-wayland-or-x11-is-being-used	    
      > 	    imv-wayland -f -s full -x "$image" & &>/dev/null
      > 	    IMG_PID=$!
      > 	    sleep "$IMAGE_DELAY"
      > 	    imv-msg "$IMG_PID" "q"
      >         elif [[ -n "$DISPLAY" ]]; then
      > 	    # if we are running under X use feh otherwise try and use fbi
      
      1 Reply Last reply Reply Quote 0
      • johnodonJ
        johnodon
        last edited by johnodon

        @etheling Funny you should ask this question and I just found it. :)

        I hit the same issue while running under KMS/DRM. My quick fix was to just use fbi the same as the Pi does and this works well. I don't know if it would work for Wayland.

            if [[ -n "$image" ]]; then
                # if we are running under X use feh otherwise try and use fbi
                if [[ -n "$DISPLAY" ]]; then
                    fbi -1 -t "$IMAGE_DELAY" -noverbose -a "$image" </dev/tty &>/dev/null
                    #feh -F -N -Z -Y -q "$image" & &>/dev/null
                    #IMG_PID=$!
                    #sleep "$IMAGE_DELAY"
                else
                    fbi -1 -t "$IMAGE_DELAY" -noverbose -a "$image" </dev/tty &>/dev/null
                fi
        
        

        Naturally, we probably don't want to be mucking with 'runcommand.sh' since the changes would be overwritten at next update.

        @mitu Is it possible to add another layer of logic to call the proper image viewer when running under Wayland or KMS/DRM?

        John

        mituM 1 Reply Last reply Reply Quote 0
        • mituM
          mitu Global Moderator @johnodon
          last edited by

          @johnodon said in Launch images do not work under Wayland without XWayland:

          @mitu Is it possible to add another layer of logic to call the proper image viewer when running under Wayland or KMS/DRM?

          Probably - it would make sense for Wayland, for KMS/DRM not so much.

          johnodonJ 1 Reply Last reply Reply Quote 0
          • johnodonJ
            johnodon @mitu
            last edited by johnodon

            @mitu Thanks. Actually, I can just forego runcommand for launch images and use runcommand-onstart instead. This gives me total control. :)

            #!/bin/bash
            ROMPATH="$3"
            ROM_BN_EXT="${ROMPATH##*/}"
            ROM_BN="${ROM_BN_EXT%.*}"
            LAUNCHIMAGE="/home/pi/RetroPie/roms/$1/images/$ROM_BN-launch.png"
            fbi -1 -t 3 -noverbose -a "$LAUNCHIMAGE" </dev/tty &>/dev/null
            
            johnodonJ 1 Reply Last reply Reply Quote 0
            • johnodonJ
              johnodon @johnodon
              last edited by

              Now that I am back to playing with Wayland/Sway, I found the best solution is what @etheling was doing...using imv as the image viewer. The difference is that I am using runcommand-onstart.sh to display the loading screens so I don't have to mess with editingruncommand.sh. The key is to NOT name you launch images *-launching.png (I use *-launch.png) as this will invoke feh via runcomand.sh.

              #!/bin/bash
              ROMPATH="$3"
              ROM_BN_EXT="${ROMPATH##*/}"
              ROM_BN="${ROM_BN_EXT%.*}"
              LAUNCHIMAGE="/home/pi/RetroPie/roms/$1/images/$ROM_BN-launch.png"
              imv-wayland -f -s full -x "$LAUNCHIMAGE" & &>/dev/null
              IMG_PID=$!
              sleep 4
              imv-msg "$IMG_PID" "q"
              
              1 Reply Last reply Reply Quote 0
              • First post
                Last post

              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.