RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    Opening StartX with a script, and then running a program

    Scheduled Pinned Locked Moved Help and Support
    startxshell script
    4 Posts 3 Posters 777 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.
    • Fiddla01F
      Fiddla01
      last edited by

      Raspberry Pi 4b+
      Retropie version 4.7.19

      I have a weird scenario I am trying to execute and I am running into problems. My goal is to run a script from the emulationstation menu, which executes OutFox (formerly known as StepMania). To run OutFox, the startx desktop must be open, otherwise nothing happens. I have everything set up where I only need to run a command line argument of

      OutFox
      

      and everything will work as long as I am in the desktop environment.

      I am trying a run this shell script:

      startx -- vt1 -keeptty -nocursor &
      (sleep 10 ; OutFox)
      

      The desktop environment loads, but the OutFox command either doesn't run or doesn't work. If I open a terminal in the now opened desktop environment, and run the command

      OutFox
      

      the game will open properly. Does anyone know why it doesn't work when running the command from the shell script? I've tried a lot of different variations of the script and nothing seems to work.

      SuperFromNDS 1 Reply Last reply Reply Quote 0
      • SuperFromNDS
        SuperFromND @Fiddla01
        last edited by

        @Fiddla01 I can't say I'm too familiar with Outfox/Stepmania in terms of running it, but I have messed with scriptmodules that involve startx before, so I can try to offer advice!

        I generally find xinit works better for whenever something requires startx to run, as it has arguments that let you execute arbitrary commands. For example, take this command from my (probably out of date) Gnash script for running Flash games:

        xinit -e 'gnash --hwaccel vaapi --hide-menubar %ROM%'
        

        However, some programs tend to be a bit more tempermental. IKEMEN GO in particular took me quite a while to work out a string of commands that worked (xinit by itself wouldn't run it at all, so I had to resort to running a very small xterm with a similar execute argument), and even then I had to resort to making an actual script file to run via ports in EmulationStation:

        #!/bin/bash
        export MESA_GL_VERSION_OVERRIDE=2.1
        xset -dpms s off s noblank
        xterm -g 1x1+0-0 -e 'cd $md_inst && ./Ikemen_GO'
        

        Perhaps the latter solution might work for you, using a Bash script to start up either xinit or startx, then automatically opening a terminal to run the game.

        I should note RetroPie actually has built-in functionality for running scripts from within xinit, like what's used for Minecraft Pi Edition:

        XINIT:$md_inst/Minecraft.sh
        
        #!/bin/bash
        xset -dpms s off s noblank
        matchbox-window-manager &
        /usr/bin/minecraft-pi
        

        Hope at least some of this info helps!

        ▲▼▲▼▲▼▲▼▲▼
        IKEMEN Go
        SRB2Kart
        ▼▲▼▲▼▲▼▲▼▲

        Fiddla01F 1 Reply Last reply Reply Quote 1
        • ExarKunIvE
          ExarKunIv
          last edited by

          If you post where you are finding the program. Maybe a install script can be made for it. So it's way easier then trying so fo about the way you are trying it.

          Just saying

          Also maybe others would want it also

          RPi3B+ / 200GB/ RetroPie v4.5.14, RPi4 Model B 4gb / 256gb / RetroPie 4.8.2
          RPi5 4gb / 512gb / RetroPie 4.8.9 -Basic
          Maintainer of RetroPie-Extra .

          1 Reply Last reply Reply Quote 0
          • Fiddla01F
            Fiddla01 @SuperFromND
            last edited by

            @SuperFromND Thanks!!! Your guidance led me to a solution.

            Xinit was indeed the solution to my problems, and it actually ended up being very simple. I'll try to spell out everything that was done so anyone finding this thread can follow along the best they can.

            OutFox/Stepmania works either from the startx or the xinit environments, but the following code is what allowed me to start the game from the emulationstation menu automatically. This is the contents of ~/RetroPie/roms/ports/OutFox.sh

            #!/bin/bash
            xinit /opt/OutFox/OutFox -- vt1 -keeptty -nocursor
            

            The second argument is the location of the executable for outfox (if you have stepmania it will be the path to the stepmania execuatable). The last arguments keep a no-permission error from occuring.

            Once this file is in that location, there should be an OutFox option to choose on the ports screen, and it should load OutFox properly. Surprisingly I didn't have to change any configs anywhere else, it just seemed to work like this for me.

            Here's a post that I mostly used to get OutFox setup (there are plenty of other good tutorials for this too): https://www.reddit.com/r/Stepmania/comments/psd1hm/raspberry_pi_4_stepmania_outfox_53_guide/

            I'm obviously a novice when it comes to this so I'm sure there's better ways of doing this, but this works for me so I'm happy.

            1 Reply Last reply Reply Quote 1
            • 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.