Power-key menu, screen-off, and tap-to-wake on L4T Ubuntu
View the Project on GitHub Ozdotdotdot/switch-tablet-screenctl
This guide gives an L4T Ubuntu Switch tablet-like display controls:
The setup uses X11, xrandr, evtest, YAD, and two systemd user services. It was verified on Ubuntu 24.04 with the Switch panel exposed as DSI-0.
git clone https://github.com/Ozdotdotdot/switch-tablet-screenctl.git
cd switch-tablet-screenctl
sudo apt update
sudo apt install -y evtest yad zenity x11-xserver-utils xinput
sudo usermod -aG input "$USER"
Log out and back in after adding the group. Confirm it with:
id | grep input
xrandr --query
./scripts/find-powerkey
./scripts/find-touch
The tested Switch reports:
DSI-0, 1280x720, 60 Hz, normal rotationmax77620_onofftouchscreenThe event numbers may change. The included finder scripts discover them instead of relying on fixed /dev/input/eventN paths.
sudo install -m 755 scripts/screenctl scripts/find-powerkey scripts/find-touch \
scripts/powerkey-listener.sh scripts/tapwake.sh /usr/local/bin/
sudo install -m 644 config/screenctl.conf /etc/screenctl.conf
Edit /etc/screenctl.conf if xrandr --query reports a different panel or mode:
PANEL="DSI-0"
MODE="1280x720"
RATE="60"
ROTATE="normal"
DISPLAY=":0"
Test the controller before continuing:
screenctl status
screenctl off
sleep 2
screenctl on
If the screen does not return, connect over SSH and run screenctl on after correcting /etc/screenctl.conf.
Install the included logind drop-in:
sudo install -d /etc/systemd/logind.conf.d
sudo install -m 644 config/powerkey-menu.conf \
/etc/systemd/logind.conf.d/powerkey-menu.conf
It keeps a long press as the emergency power-off fallback:
[Login]
HandlePowerKey=ignore
HandlePowerKeyLongPress=poweroff
Restarting logind can close the graphical session. Save your work first, then run:
sudo systemctl restart systemd-logind
mkdir -p ~/.config/systemd/user
install -m 644 systemd/powerkey-listener.service systemd/tapwake.service \
~/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable --now powerkey-listener.service tapwake.service
loginctl enable-linger "$USER"
Use these user services only. Do not also create a system-level tap-wake service with a fixed event number.
systemctl --user status powerkey-listener tapwake.Watch logs in another terminal if anything fails:
journalctl --user -u powerkey-listener -u tapwake -f
power key -> evtest --grab -> YAD menu -> screenctl off
touch event -> tapwake.sh -> screenctl on
screenctl off runs xrandr --output DSI-0 --off. This turns off the display output while the separate touchscreen input device stays active.powerkey-listener.sh finds and grabs the physical power key. A short press opens YAD instead of suspending the machine.tapwake.sh watches the discovered touchscreen. Its first event calls screenctl on, then the watcher restarts.xrandr can use the active X11 display and ~/.Xauthority.The tested 1280x720 panel uses normal rotation and the identity touch matrix:
xinput set-prop "$(xinput list --id-only touchscreen)" \
"Coordinate Transformation Matrix" 1 0 0 0 1 0 0 0 1
If you rotate the display, update both ROTATE in /etc/screenctl.conf and the touchscreen matrix.
/dev/input/eventN: confirm id lists the input group, then log out and back in.DISPLAY=:0 is correct, and ~/.Xauthority exists.DSI-0 in /etc/screenctl.conf with the connected output from xrandr --query.systemd-analyze cat-config systemd/logind.conf and confirm HandlePowerKey=ignore is effective.Verified against the running Switch on 2026-08-20.