You are not logged in.

#1 2022-05-01 11:30:35

Erubi
Member
Registered: 2021-06-16
Posts: 40

How to send a command repeatedly while a key is being held down

I'm playing a game that requires a particular key to be mashed quite often. I'd like to be able to just hold the key instead of having to mash it to reduce finger strain.

I know that you can use xdotool to send keystrokes, and it does have a repeat option for repeated keystrokes. I also know how to bind commands to keys using xbindkeys, but it only sends them once.

Does anyone here know how to bind a key to send a command multiple times until I stop holding the key? Or alternatively, any packages that allow for rapid fire keystrokes directly?

Offline

#2 2022-05-01 14:42:25

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,691

Re: How to send a command repeatedly while a key is being held down

while xinput query-state <device name here> | grep "key\[37\]=down"; do xdotool keyup ctrl keydown ctrl sleep 0.5; done

Obviously kc 37 is (left) control, assuming that's the non-autorepeating key you're looking for.

Offline

Board footer

Powered by FluxBB