Turning a Dell Wyse 3040 into an HTPC (Part 3)

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.


Interested in more info on the Wyse 3040? ParkyTowers has a treasure trove of info on the hardware, disassembly, firmware, installing TinyCore Linux, and some further reading. Enjoy!


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.

Window Managers

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 .

Ratpoison

The ratpoison window manager looked interesting to me as it aims to provide an X window analogue to GNU screen, the terminal/shell window manager. The default key bindings reflect that.

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

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

I added Type=simple as suggested since we’re also going to automatically start X, too. Starting with ~/.xinitrc:

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

and ~/.bash_profile:

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!

One thought on “Turning a Dell Wyse 3040 into an HTPC (Part 3)”

Tell us what's on your mind