Arcade – How to launch MagicMirror from RetroPie

Arcade – How to launch MagicMirror from RetroPie

I’m new to Raspberry Pi and I have recently built an Arcade with it, using an old monitor and 2 Player Joystick Buttons. Now I’m trying to explore the full potential of the Raspberry Pi and I wanted to launch the MagicMirror application from RetroPie.

My version of RetroPie is comit f90600 (Date: Jul 30 2019) and I can see that by typing this at the command line:

$ cd ~/RetroPie-Setup
$ git show

If you want to install RetroPie in your Raspberry Pi just follow this link. You can also install MagicMirror by following the installation manual.

Getting back to the subject, first you have to install PIXEL desktop environment (to run MagicMirror from there) by accessing RetroPie menu -> RetroPie SETUP -> Configuration / tools -> raspbiantools – Raspbian related tools -> Install Pixel desktop environment. After that you can access desktop from the ports menu.

To start MagicMirror automatically first you have to create a file to call a bash script that executes MagicMirror (you must have installed it before). Let’s call the file mirror.desktop and save it in /home/pi/.config/autostart to run at every boot. You’ll have to create the autostart folder if it doesn’t exist.

$ cd /home/pi/.config/
$ mkdir autostart
$ cd autostart
$ nano mirror.desktop

Save the code bellow as mirror.desktop. This file is going call the bash script mirror.sh saved in /home/pi/Documents.

[Desktop Entry] 
Type=Application
Name=mirror
Exec=/home/pi/Documents/mirror.sh

You can write mirror.sh code as described bellow.

#!/bin/bash

cd /home/pi/MagicMirror
DISPLAY=:0 npm start

Don’t forget to make mirror.sh executable by tipping the following code at command line.

$ sudo chmod +x /home/pi/Documents/mirror.sh

Yes!!! Finally the MagicMirror starts automatically from the RetroPie!!!! But… What about going back to RetroPie from MagicMirror, without a mouse or a keyboard, just using the joystick controller. I’ve tried two different approaches to end the user session and you can check it out by clicking the following links: using USB joystick buttons and using a push button connected to GPIO.

I hope you enjoyed and learned something new! See you around!! 🙂


Log out of this account

Leave a Reply