Here is a script that works in X11.. Shibby! You must set it to grep your keyboard name in xinput list.
#!/bin/bash
KBD_ID=$(xinput list | grep -i "G910" | grep -oP 'id=\K[0-9]+')
echo "G910 at id=$KBD_ID"
echo "Alt+F1 toggles turbo | Escape = panic stop"
# Keycodes: Space=65, Alt=64, F1=67, Escape=9
TURBO_ENABLED=true
TURBO_PID=""
ALT_HELD=false
# Tweak these:
TURBO_DELAY=10 # milliseconds between presses (10ms = ~100/sec)
TURBO_REPEAT=99999 # high cap, effectively infinite while held
enable_turbo() {
TURBO_ENABLED=true
xset -r 65
echo "[Turbo] ENABLED — ${TURBO_DELAY}ms delay (~$((1000 / TURBO_DELAY))/sec)"
}
disable_turbo() {
TURBO_ENABLED=false
[ -n "$TURBO_PID" ] && kill "$TURBO_PID" 2>/dev/null
pkill -f 'xdotool key --repeat' 2>/dev/null
TURBO_PID=""
xset r 65
echo "[Turbo] DISABLED — Space works normally"
}
cleanup() {
disable_turbo
echo "[Turbo] Exiting cleanly."
exit 0
}
trap cleanup SIGINT SIGTERM
enable_turbo # boot state: ON — swap to disable_turbo to boot OFF
while read -r line; do
# Track Alt held state
if echo "$line" | grep -q "key press *64$"; then
ALT_HELD=true
elif echo "$line" | grep -q "key release *64$"; then
ALT_HELD=false
# Alt+F1 → toggle turbo
elif echo "$line" | grep -q "key press *67$"; then
if [ "$ALT_HELD" = true ]; then
if [ "$TURBO_ENABLED" = true ]; then
disable_turbo
else
enable_turbo
fi
fi
# Space press → start turbo
elif echo "$line" | grep -q "key press *65$"; then
if [ "$TURBO_ENABLED" = true ]; then
xdotool key --repeat $TURBO_REPEAT --delay $TURBO_DELAY space &
TURBO_PID=$!
fi
# Space release → stop turbo
elif echo "$line" | grep -q "key release *65$"; then
[ -n "$TURBO_PID" ] && kill "$TURBO_PID" 2>/dev/null
pkill -f 'xdotool key --repeat' 2>/dev/null
TURBO_PID=""
# Escape → panic
elif echo "$line" | grep -q "key press *9$"; then
cleanup
fi
done < <(xinput test "$KBD_ID")