What can replace a simple AutoHotkey mouse-toggle script on Linux?

September 23, 2026 2 answers
Asked by bicycle_pump_
I'm looking for a Linux replacement for a small AutoHotkey script I used while gaming on Windows. When I hold Left Alt and click the left or right mouse button, that button should remain pressed until I click the same mouse button again. I'm running CachyOS on Arch Linux and would prefer a straightforward solution, possibly using a shell script or a lightweight extra tool. The original scripts were: LALT & LButton::Send % "{Click " . ( GetKeyState("LButton") ? "Up}" : "Down}" ) LALT & RButton::Send % "{Click right " . ( GetKeyState("RButton") ? "Up}" : "Down}" )

Answers

stock-taking day
Input Remapper is probably the easiest place to start. It supports macros involving both keyboard and mouse inputs, so you should be able to map Left Alt plus each mouse button and send the corresponding button-down or button-up event. On Arch-based systems, look for the input-remapper package or its binary AUR variant. Youโ€™ll likely need to experiment with conditional logic and held-button actions to reproduce the toggle behavior exactly.
Reply to this answer
!worth checking
Input Remapper can handle fairly involved macros, including keyboard and mouse actions together. Its macro syntax supports holding keys, sending button events, waiting briefly, and running actions in parallel, which should cover most of this use case. Exact replication may take some trial and error, since a simple key remap and a stateful mouse-button toggle are different kinds of mappings.
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions