Skip to content

Instantly share code, notes, and snippets.

@gmvi
Last active March 12, 2026 05:30
Show Gist options
  • Select an option

  • Save gmvi/4a7828ed90da2dc84c4edb1de34e29f1 to your computer and use it in GitHub Desktop.

Select an option

Save gmvi/4a7828ed90da2dc84c4edb1de34e29f1 to your computer and use it in GitHub Desktop.
A script to turn off the touchscreen on your Steam Deck while using Mod Organizer 2 so it doesn't crash to desktop
# version 1.0
# This is intended to turn off the Steam Deck's touchscreen in desktop mode when you launch Mod Organizer 2 as installed
# by modorganizer2-linux-installer (haven't tested on a SteamTinkerLaunch install). In desktop mode only, any input from the
# touchscreen causes my MO2 to crash. And I haven't tested this under a SteamTinkerLaunch install yet.
# 1. save this to /home/deck/bin/no-touch.sh (and run `chmod u+x` on it)
# 2. update sudoers (use `sudo visudo`) to let the script turn the touchscreen off. Add the line:
# deck ALL=(ALL) NOPASSWD: /usr/bin/libinput list-devices, /usr/bin/tee /sys/class/input/*/device/inhibited
# This allows programs on your computer to read extra hardware info and write to certain admin files named "inhibited"
# 3. update your Steam launch options to:
# ~/bin/no-touch.sh ; %command% ; ~/bin/no-touch.sh reset
# If you would put something else in launch options, it goes between the semicolons
TOUCH_DEVICE='FTS3528'
[ "$1" = "reset" ] && RESET=true
[ -z "$KDE_FULL_SESSION" ] && GAMING=true
# in desktop mode, turn the touchscreen off when starting, on when done
# in gaming mode, force the touchscreen on when starting, in case of prior failure
if [ -z "$GAMING" ]; then
[ -z "$RESET" ] && TOUCHOFF=true
[ -n "$RESET" ] && TOUCHON=true
else
[ -z "$RESET" ] && TOUCHON=true
fi
if [ -n "$TOUCHON" ] || [ -n "$TOUCHOFF" ]; then
# Finds the matching entry in libinput list-devies with the touch capability
# to select just the one touchscreen, replace the awk part of the pipeline with this:
# | awk 'BEGIN{RS="";FS="\n"} /^Device:\s+'$TOUCH_DEVICE_NAME'/ && /\nCapabilities:.*\stouch(\s|$)/' \
TOUCH_EVENT="$( sudo libinput list-devices \
| awk 'BEGIN{RS="";FS="\n"} /^Device:\s+'$TOUCH_DEVICE'/ && /\nCapabilities:.*\stouch(\s|$)/' \
| sed -En 's/Kernel:\s*(.*)/\1/p' )"
[ -n "$TOUCH_EVENT" ] && INHIBIT_FLAG="/sys/class/input/$(basename $TOUCH_EVENT)/device/inhibited"
[ -n "$INHIBIT_FLAG" ] && ( [ -n "$TOUCHON" ]; echo $? | sudo tee $INHIBIT_FLAG >/dev/null)
fi
@gmvi
Copy link
Author

gmvi commented Mar 8, 2026

This would be convenient as an mo2 python plugin so it doesn't need any changes to Steam launch options, but Proton has a hardened wine environment and I'd need a bridge mechanism to run the linux commands from within mo2.

@gmvi
Copy link
Author

gmvi commented Mar 10, 2026

Looks like SteamTinkerLaunch could be used trigger the script if you don't want to add more to your launch options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment