Any way to make android ignore volume buttons? (for a rooted shell script)

I am tryna play games. and i thought it'd be cool if i rebinded the (unused) volume buttons to touch:

        #!/system_ext/bin/bash
        # hacky but im kinda lazy
        ktrack=0
        x=10
        y=10
        # 1 and 3 are EV_SYN events. ignore those
        getevent -lt /dev/input/event4 | while read -r line; do
               case "$ktrack" in
                       0) echo "down"
                          input motionevent down $x $y          
                               ktrack=$((ktrack+1));;
        
                       1)      ktrack=$((ktrack+1));;
                       2) echo "up"
                          input motionevent up $x $y
                               ktrack=$((ktrack+1));;
                       3)  ktrack=0;;
               esac
        
        done

Unfortunately. android increases the volume whenever i press the buttton! its expected but i want to disable this behavior temporarily. is there a way?

Posted Jan 18, 2025, 9:44 AM UTC

10
Loading comments…