DISCUSSION

Quality of life improvements to running modbros in a standard raspbian distro

2 people are following

Warning up front: I'm extremely new to raspberry pi's and linux, so a lot of this was put together somewhat haphazardly.  I'm doing my best to remember the parts that went into it.

 

One of the first things I did with my pi was copy a set up for a gif player to run in a chromium kiosk window (https://learn.adafruit.com/raspi-animated-gif-picture-frame?view=all)*.  So then I realized if I could get modbros to run the same way in the browser then once everything was installed in my PC I could switch between modbros and gifs with VNC whenever I wanted!  For me I found the correct autostart file to work with at /etc/xdg/lxsession/LXDE-pi/autostart and created my little newbie scripts in /home/pi/Documents/Scripts/

*this link is super duper old and was like, 60% not applicable anymore.  but the html + js file that does the heavy lifting worked fine and I eventually hacked it into life!

First little thing that plagued me was the mouse cursor kept showing in the middle of my screen.  Found the program “unclutter” (sudo apt-get install unclutter) and added a line for it to my autostart file “@unclutter -idle 5”, which makes the pointer disappear after 5 seconds of no input.  

Originally I also added the following line to open modbros automatically too: “@chromium-browser --kiosk http://192.168.0.13:42100/?uuid=pi1&name=RaspberryPi”, where 192.168.0.13 is the address of my desktop.  However, I started noticing that my connection would freeze after extended use, requiring me to either open+close the configuration pane on my desktop or refresh the browser on my pi.  Preferring an automated solution, I spent way longer than it should have taken to figure out a basic script to refresh my browser every hour on my pi:

#!/bin/bash

chromium-browser --kiosk http://192.168.0.13:42100/?uuid=pi1&name=RaspberryPi

counter=0

while pgrep "chromium" >/dev/null
do
#  echo "chromium running"
  sleep 5
  let counter++
  if [ $counter -gt 720 ]
  then
    xdotool key "F5"
    counter=0
  fi
done

echo "*****End of Mobro script*****"

I had to install xdotool to mimic keyboard entry commands to virtually hit “F5” first (sudo apt-get install xdotool), and implemented a crude way to end the script if/when you close the browser.  I saved this script in my documents folder and instead added “@/home/pi/Documents/Scripts/LoadModbros.sh” to my autostart file.  Said script is also how I restart my modbros session as well.

So yeah, I'm actually super pleased with running modbros in the browser.  It (subjectively) feels like it boots up a bit quicker, and the only downsides are it lacks the screensaver and every hour it flashes white for a brief second while it reloads.  And I can switch to sweet sweet pony gifs in 30 seconds without swapping an SD card, lol.

Replies 1 - 1 (1)

Hi @Aleoin 

thanks for sharing this and including the script and all the details.
It's really cool to see that people start tinkering around and learning about Linux etc. because of something we've built :)

If you check out the code of our MoBro image on GitHub you will see that we're also just starting the chromium browser in kiosk mode like you did.
Just with a bit more code and the whole configuration process built around it ;)

The automatic refresh is something that shouldn't be required, so we will have to look into that issue of the frozen connection. But it's handy to have an automated refresh for situations like this. Certainly something we could incorporate into our image as well as a configurable feature.

Login to comment

Login
Like most websites, we also use cookies. But don't worry, we only use them for your login and statistics.