Skip to content
Daniel Stock edited this page Feb 20, 2018 · 5 revisions

Contents


SSH

By default the SSH server is running so you can log into your box remotely from your terminal.

ssh tooloop@<IP-ADDRESS-OF-YOUR-BOX>

Windows users might want to install PuTTY.

VNC

The VNC server is not running by default. You can turn it on, using the alias tooloop-vnc-on or in the Settings Server

Terminal commands

There's a bunch of terminal commands for your convenience. Use them on the local machine or remotely via SSH.

Shortcut Description
tooloop-presentation-start Calls /assets/presentation/start-presentation.sh
tooloop-presentation-stop Calls /assets/presentation/stop-presentation.sh
tooloop-presentation-reset Calls stop and start script
tooloop-display-off Turns the display off
tooloop-display-standby Turns the display to standby
tooloop-display-on Turns the display on
tooloop-display-blink Makes the desktop background flash. Got more then one box and want to know which one you're on?
tooloop-vnc-on Starts the VNC server
tooloop-vnc-off Stops the VNC server
tooloop-settings Opens a local browser with the settings UI
tooloop-screenshot Takes a screenshot immediately, no matter whether the screenshot service is running
tooloop-screenshots-clean Will delete old screenshots and organize the rest in folders. This is also done automatically once a day and on every reboot.
tooloop-install-optional-stuff Launches a menu with different options for you to install.

Shortcuts

Shortcut Description
Helpers
Super + t Opens a Terminal
Super + c Opens a clock
Super + s Opens the settings
Windows
Super + w Close window
Super + Esc Send to background
Screenshots
`Super + Alt + 3 Whole display

Btw. Super usually is the Windows or Cmd key.

Poor man’s application watchdog

Create a script, that will check how many instances of your presentation application are running.
The following example script will start the presentation if it isn't there. It will also kill one instance of it if there’s more than one running.

E.g. /assets/scripts/presentation-watchdog.sh

    #!/bin/bash

case $(pidof APPLICATION_NAME | wc -w) in

0)      echo "$(date) - Restarting presentation" >> /assets/logs/presentation.log
        /assets/presentation/start-presentation.sh &
        ;;
1)      # all good
        ;;
*)      echo "$(date) - Too many dicks on the dancefloor, killing presentation" >> /assets/logs/presentation.log
        kill $(pidof APPLICATION_NAME | awk '{print $1}')
        ;;
esac

Now you only have to set up a cron job so the script is automatically called periodically.

Edit your crontab:

crontab -e

This config will call your script once every minute:

# min hou dom mon dow   command
  *   *   *   *   *     env DISPLAY=:0.0 sh /assets/scripts/presentation-watchdog.sh

Hint: You have to tell cron on which display if should start GUI applications. This is done by adding env DISPLAY=:0.0 before the actual command.

Application service

You can create a systemd service for your application and let it care about restarting in case of an error. Read all about creating service units files here.

Create a new file for your app

nano /usr/lib/systemd/system/<YOUR-APP>.service

Now copy these lines in there

[Unit]
Description=YOUR APP DESCRIPTION
After=getty@tty1.service

[Service]
Environment=DISPLAY=:0
Environment=XAUTHORITY=/home/tooloop/.Xauthority
ExecStart=<YOUR_APPLICATION>
Restart=on-failure
TimeoutStopSec=1

[Install]
WantedBy=graphical.target

Enable and start the service

systemctl enable <YOUR-APP>
systemctl start <YOUR-APP>

Now change the start and stop scripts accordingly

/assets/presentation/start-presentation.sh

systemctl start <YOUR-APP>

/assets/presentation/stop-presentation.sh

systemctl stop <YOUR-APP>

Now that systemd is taking care of starting your application service, you should remove or comment the call to the start script in ~/.config/openbox/autostart:

[…]
# sh /assets/presentation/start-presentation.sh &
[…]

Set display resolution

Check available modes

xrandr

Set a mode

xrandr --output DisplayPort-0 --mode 1920x1080  --rate 30

If you need to add a mode you know, your hardware is capable of but isn't listed, you can add it manually. In a terminal generate a modeline

cvt 3840 2160 30

The output should look something like this

Modeline "3840x2160_30.00"  338.75  3840 4080 4488 5136  2160 2163 2168 2200 -hsync +vsync

Create a new mode from the modeline

xrandr --newmode "3840x2160_30.00"  338.75  3840 4080 4488 5136  2160 2163 2168 2200 -hsync +vsync

Make the new mode available

xrandr --addmode DisplayPort-0 3840x2160_30.00

And activate it the same way as above

xrandr --output DisplayPort-0 --mode 3840x2160_30.00

Note that setting the resolution is not permanent. You will probably want to add the line to ~/.config/openbox/autostart. 

Clone this wiki locally