Fedora to display automated image or video slideshows
Here are some instructions on how to configure a computer using Fedora for image or video slideshows. The idea is to have the computer automatically run some fullscreen application on boot, which is typically what is wanted on public displays in fairs, hallways, stores etc, all this without running any window manager.
To achieve this in a non-intrusive way, in case this is just a temporary setup, runlevel 4 is used for all the specific configuration. For the normal text or GUI modes, switching back the default to runlevel 3 or 5 respectively is the only change required.
The big picture is the following :
- Configure the default to be runlevel 4 and have it execute the “tv” user’s “startx”
- Configure the “tv” user’s X session to run some fullscreen application in an infinite loop
Now the details of the changes :
- Edit the /etc/inittab file to default to runlevel 4 instead of 3 or 5 : id:4:initdefault:
- Create the “tv” user with : useradd -c “TV” tv
- Create the /etc/event.d/tv file with the following content :
# tv start on stopped rc4 stop on runlevel [!4] console output respawn respawn limit 10 120 exec /bin/su tv -l -c "/bin/bash --login -c startx >/dev/null 2>&1"
- Create the ~tv/.xinitrc file with the following content :
# tv xinitrc # To check : xset -q | more # To switch display off : xset dpms force off # Set the background to black instead of the default grey. This is only seen # when exiting feh, but looks nicer when black. xsetroot -solid black # Disable DPMS (Energy Star), or the display will be turned off after idling xset -dpms # Disable Screen Saver or an "X" will be displayed after idling xset s off # The main slideshow loop rm -f /tmp/slideshow.lock while true; do # If we're running something else, then we lock the slideshow if [ -f /tmp/slideshow.lock ]; then sleep 10s else feh --hide-pointer --full-screen --auto-zoom --slideshow-delay 600 \ --randomize --cycle-once --recursive /mnt/tv/${HOSTNAME} fi done
The above example runs an image slideshow of all the content under /mnt/tv/${HOSTNAME}. You obviously need the feh package installed for it to work. If you want to manually run an application and don’t want the slideshow to conflict with it, just create the /tmp/slideshow.lock file.
The next example is to have something similar but with video files, where the playback can then be controlled through VLC’s integrated web interface :
# tv xinitrc # To check : xset -q | more # To switch display off : xset dpms force off # Set the background to black instead of the default grey. xsetroot -solid black # Disable DPMS (Energy Star), or the display will be turned off after idling xset -dpms # Disable Screen Saver or an "X" will be displayed after idling xset s off # The main slideshow loop rm -f /tmp/slideshow.lock while true; do # If we're running something else, then we lock the slideshow if [ -f /tmp/slideshow.lock ]; then sleep 10s else vlc -I http --http-host 0.0.0.0:8080 --loop --random --recursive expand \ --fullscreen --aout alsa ~/Videos > /tmp/vlc.log 2>&1 fi done
I’ve been using the above on some Atom-based Dell FX160 computers for images as well as on some Dell Studio Hybrid and cheap Acer ultra small form factor computers for videos, and it works just great. For turning on or off the computers, if you don’t have easy access to the power buttons, you might want to look into Wake-on-LAN or BIOS auto power on settings and a simple shutdown cron job.