#!/bin/bash # Start the loop in the background ( while true; do python /home/kuba/sdl-enable.py sleep 1 done ) & loop_pid=$! # Capture all arguments as the command cmd=("$@") # Run the provided command as the hidraw user who can access /dev/hidraw* #sudo setfacl -R -m u:hidraw:rw $XDG_RUNTIME_DIR #sudo -E -u hidraw WAYLAND_DISPLAY=$WAYLAND_DISPLAY \ # XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR \ # QT_QPA_PLATFORM=wayland \ "${cmd[@]}" "$@" cmd_status=$? # Kill the background loop once the command is done kill $loop_pid 2>/dev/null