Make it work more gracefully
We’ve been transforming a Dell Wyse 3040 thin client PC into an HTPC using Arch Linux. Last time in Part 2, we got hardware acceleration working so that Kodi and Netflix would play smoothly. Now we want to add a layer of user-friendliness.
Switching Media Players
In part 2 we created/used services for our media players — Kodi and Netflix — and made them available to our user via sudoers config. This makes switching simple:
systemctl stop kodi && systemctl start chromium # starts Netflix systemctl stop chromium && systemctl start kodi # starts Kodi
That’s easy to do from a logged-in shell like an ssh session, but it’s terrible user experience for a regular TV. As such it fails the user friendliness test.
A window manager makes switching easier; either via keycombo to switch window, or via custom commands. We don’t need everything a full desktop environment provides, so we can save the Wyse 3040’s limit resources there.
I had a quick look at the tiling window manager comparison page, and settled on a choice primarily based on one that was lightweight .
I spent some time with ratpoison but had issues with the hotkeys not working; possibly they were being send to the applications instead. It’s a window manager I’d like to use more though, something I would consider for, say, a laptop where screen real estate is at a premium.
Openbox is the window manager on my primary machine, so I installed that for familiarity. It provides a more traditional alt+tab, plus custom keybindings via its
rc.xml configuration file.
I’ve continued with openbox, but really any window manager would do, as long as its window switching functioned.
Autologin and Autostart X
The next bit of user-friendliness is automatically starting the media application[s] when the HTPC is started, as faffing with a keyboard to login is not a great TV user experience.
To log in to the console automatically, I overrode the
getty systemd service file:
less /etc/systemd/system/getty\@tty1.service.d/override.conf [Service] Type=simple ExecStart= ExecStart=-/usr/bin/agetty --autologin robert --noclear %I $TERM
less ~/.xinitrc #!/bin/sh userresources=$HOME/.Xresources usermodmap=$HOME/.Xmodmap sysresources=/etc/X11/xinit/.Xresources sysmodmap=/etc/X11/xinit/.Xmodmap # merge in defaults and keymaps if [ -f $sysresources ]; then xrdb -merge $sysresources fi if [ -f $sysmodmap ]; then xmodmap $sysmodmap fi if [ -f "$userresources" ]; then xrdb -merge "$userresources" fi if [ -f "$usermodmap" ]; then xmodmap "$usermodmap" fi xsetroot -solid black & exec /usr/bin/openbox-session
less ~/.bash_profile [[ -f ~/.bashrc ]] && . ~/.bashrc if systemctl -q is-active graphical.target && [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then exec startx fi
That takes care of getting to openbox when the system has finished starting up and reaches the user login stage.
To start our media applications, we can make use of Openbox’s own autostart mechanisms:
less ~/.config/openbox/autostart xset -b (sleep 1 && /usr/bin/chromium --start-maximized --kiosk "https://netflix.com") & (sleep 1 && kodi) &
Now when we power on the Wyse 3040, it will automatically log in once started, run openbox under X, and start Kodi and Netflix.
We’re a good part of the way there, but we can make it even more user-friendly. We’ll look at that next time!