Here I will document how I got this project to work
For Starters, get linux on your switch
I want my switch to be able to have a tap-to-wake option, so currently I am working on setting that up
I am currently using xrandr to force my screen on and off, I have the commands aliased in my .bashrc for ease of use, but below are those codes
# Controls for my Switch Server Screen
alias screenoff="export DISPLAY=:0 && xrandr --output DSI-0 --off"
alias screenon="DISPLAY=:0 XAUTHORITY=/home/ozswitchserver/.Xauthority xrandr --output DSI-0 --mode 720x1280 --rate 60 --rotate left"
The switch is made to be a portable, battery-powered console. It wasn’t meant to be always on so it tries to fight that behavior. I have KDE Plasma as my DE and under the battery section, I can choose to force the screen on and not sleep - which is the behavior I want as I want this on 24/7 running services in the background.
Using xrandr to force the screen off in conjunction with this behavior from KDE plasma allows me to keep the screen off but the switch on. However, this does not give me the exact “tap to wake” behavior I am looking for. So next is figuring that out.
The screen on the switch is DSI-0 - which is a MIPI Standard for mobile device screens. So the native resolution of the screen is actually vertical, not horizontal. Software just readjusts it to be horizontal. Hence why my xrandr has the rotate left flag.
Within it lies the Transfrom Matrix:
1.000000 0.000000 0.000000
0.000000 1.000000 0.000000
0.000000 0.000000 1.000000
This supposedly helps dial in and adjust the touchscreen settings, which I might want to do down the line
sudo tee /usr/local/bin/screenctl >/dev/null <<'EOF'
#!/bin/bash
set -euo pipefail
CONF="/etc/screenctl.conf"
[ -f "$CONF" ] && . "$CONF"
export DISPLAY="${DISPLAY:-:0}"
export XAUTHORITY="${XAUTHORITY:-$HOME/.Xauthority}"
PANEL="${PANEL:-DSI-0}"
MODE="${MODE:-720x1280}"
RATE="${RATE:-60}"
ROTATE="${ROTATE:-left}"
xr() { xrandr --output "$PANEL" "$@"; }
on() { xr --mode "$MODE" --rate "$RATE" --rotate "$ROTATE"; }
off() { xr --off; }
status() {
xrandr --verbose | awk -v p="$PANEL" '
$1==p { state=$0; on=($0 ~ /connected/ && $0 ~ /[0-9]+x[0-9]+/ && $0 ~ /current/) }
END { if (state=="") { print "Panel not found: " p; exit 1 }
print state; print (on ? "State: ON" : "State: OFF (no active mode)") }'
}
toggle() {
if xrandr --query | grep -A1 "^$PANEL " | grep -q "current"; then off; else on; fi
}
rotate() {
case "${1:-}" in left|right|normal|inverted) xr --rotate "$1" ;;
*) echo "Usage: $0 rotate {left|right|normal|inverted}"; exit 1 ;; esac
}
case "${1:-}" in
on) on ;; off) off ;; toggle) toggle ;; status) status ;;
rotate) rotate "${2:-}" ;;
*) echo "Usage: screenctl {on|off|toggle|status|rotate {left|right|normal|inverted}}"; exit 1 ;;
esac
EOF
sudo chmod +x /usr/local/bin/screenctl
This set of commands creates a binary called screenctl that allows you to check the status of the screen, turn it on, or off. Frankly this should work out of the box for you if you are also using a nintendo switch running linux for this.
To use it, just type screenctl, it will tell you the commands it supports.
sudo tee /usr/local/bin/find-touch >/dev/null <<'EOF'
#!/bin/sh
# Portable finder for the touchscreen's /dev/input/eventN node.
# Works with mawk/busybox awk (no gawk extensions).
file=/proc/bus/input/devices
awk 'BEGIN{RS=""; FS="\\n"}
{
name_ok=0
for(i=1;i<=NF;i++){
# Look for a touchscreen-ish device name (case-insensitive without tolower)
if ($i ~ /^N: Name=/) {
if ($i ~ /(touch|Touch|TOUCH|Goodix|goodix|Elan|elan|Synaptics|synaptics|hid-multitouch|HID-multitouch|fts|FTS)/) {
name_ok=1
}
}
# Once we think this block is a touchscreen, grab eventN from Handlers
if (name_ok && $i ~ /^H: Handlers=/) {
line=$i
# POSIX awk: use match() without the third-arg array, then RSTART/RLENGTH
if (match(line, /event[0-9]+/)) {
print "/dev/input/" substr(line, RSTART, RLENGTH)
exit
}
}
}
}' "$file"
EOF
sudo chmod +x /usr/local/bin/find-touch