game controller desktop config
When the desktop machine is across the room, we use a controller-only config.
getting to the desktop without the keyboard
First, we enable autologin and automatically start the graphical desktop. If you use this machine as anything more than a media/gaming appliance you should encrypt your data at rest with a USB keyfile. (See filesystem surgery, you can adapt this to work without password-protecting the keyfile itself.) In /etc/sv/agetty-tty1/run
we can use the -a
argument to autologin with a given username. Then in my ~/.kshrc
I add a clause that will launch the graphical environment automatically if it's not running:
if ! pgrep Xorg > /dev/null; then startx fi
(You may note in my usual kshrc that I already alias startx = 'exec startx'
, so when the graphical session terminates, the shell also logs out. This combined with the agetty
autologin makes the session automatically restart when logged out from.)
using the controller
We use AntiMicroX to map the controller inputs. It supports using multiple assignment layouts (sets). I use a generic PS3 controller (see computing accessories), but you could adapt this to any modern controller.
The layout file is here, and the layouts are illustrated below.
the primary set
- left stick: mouse movement
- dpad: arrows
- right stick: scroll
- r3/right stick click: toggle virtual keyboard
- shoulder buttons + triggers: ctrl, alt, super, shift
- face buttons: square, x, circle = left, middle, and right mouse buttons; triangle = esc
- select: tab
- start: enter
- guide: switch to set 2
the other set
Is blank, except for the guide button which switches you back to the primary set. This lets games natively bind to the controller inputs. When you finish playing, you toggle back to the primary set.
virtual keyboard config
Other than the colors, I use a vanilla svkbd config and save the binary to ~/bin/svkbd
; the sript called by right stick click in the primary layout similarly to the graphics autostart above, just launches svkbd
if it isn't running, otherwise kills it:
#!/bin/sh if ! pgrep svkbd; then svkbd else killall svkbd fi
We can configure openbox
to keep the svkbd
window borderless, on top, hug the bottom of the screen, and on all desktops. And we add a compositing rule in picom.conf to be able to see behind the keyboard a bit.
upscaling
If the montor is across the room we probably want the UI upscaled for the most part. For lxappearance
and qt5ct
we can increase the font size to 18pt. For PCSX2, which for reasons I don't remember we have running on flatpak, we have to tell it to upscale:
flatpak override --user --env=GDK_SCALE=2 net.pcsx2.PCSX2
GDK_SCALE
needs to be a positive integer.
Lastly, we can increase the font sizes to 18 in the openbox
config, and I made an xl version of the abyss theme