Skip to main content
condensed & clarified
Source Link

I just figured this out last night, and I'm sure my answer will be painfully simple to some, but it might be helpful to other noobs who are also looking forHere's a way to do really basic AHK stuff on Linux (i.e. control mouse movements & auto-type blocks of pre-written text via hotkeys).noob solution for noobs like me:

Most Desktop Environments (DE) include a custombuilt-in keyboard shortcut editor (usually under a system settings or similar menu). I'm currently using KDE, but I've used XFCE, and, from what I recall, the shortcut editors were similar. Anyway, usingUsing the shortcut editor, you can write custom bash scripts, console commands, etc. (i.e. stuff I can barely do, and only after scouring forums).

To get AHK-like functionality beyond what your DE makes possible via custom shortcuts, install xdotool (sudo apt install xdotool) and write your xdotool commands into thethe shortcut editor (if you're given options for several types of shortcuts, select the "command" option):

xdotool [command] 

(Enter man xdotool in the terminal to access the xdotool manual.)

For example, I often needIf you use xdotool to haveextend your custom shortcuts, it's a waygood idea to send blocks of prewritten text. To do this, I enter the following line into theyour command field in my shortcut editor:the terminal before setting it as a hotkey, just to make sure it works as expected.

xdotool type '[some text]' 

Here's a tip, though. It's a good idea to enter your command in the terminal before setting it as a hotkey, just to make sure it works. I ran into a case where some of the text I had entered contained characters that the program was trying to read as something other than printable text, and I didn't figure out why my text wasn't appearing until I ran the command in the terminal and got an error message. I have yet to figure out how to get AHK-like hotstrings in Linux, but I'll update if I discover a workable solution.

I just figured this out last night, and I'm sure my answer will be painfully simple to some, but it might be helpful to other noobs who are also looking for a way to do really basic AHK stuff on Linux (i.e. control mouse movements & auto-type blocks of pre-written text via hotkeys).

Most Desktop Environments include a custom keyboard shortcut editor (usually under a system settings or similar menu). I'm currently using KDE, but I've used XFCE, and, from what I recall, the shortcut editors were similar. Anyway, using the shortcut editor, you can write custom bash scripts, console commands, etc. (i.e. stuff I can barely do, and only after scouring forums).

To get AHK-like functionality, install xdotool (sudo apt install xdotool) and write your xdotool commands into the shortcut editor (if you're given options for several types of shortcuts, select the "command" option).

For example, I often need to have a way to send blocks of prewritten text. To do this, I enter the following line into the command field in my shortcut editor:

xdotool type '[some text]' 

Here's a tip, though. It's a good idea to enter your command in the terminal before setting it as a hotkey, just to make sure it works. I ran into a case where some of the text I had entered contained characters that the program was trying to read as something other than printable text, and I didn't figure out why my text wasn't appearing until I ran the command in the terminal and got an error message.

Here's a noob solution for noobs like me:

Most Desktop Environments (DE) include a built-in keyboard shortcut editor. Using the shortcut editor, you can write custom bash scripts, console commands, etc.

To get AHK-like functionality beyond what your DE makes possible via custom shortcuts, install xdotool (sudo apt install xdotool) and write your xdotool commands into the shortcut editor (if you're given options for several types of shortcuts, select the "command" option):

xdotool [command] 

(Enter man xdotool in the terminal to access the xdotool manual.)

If you use xdotool to extend your custom shortcuts, it's a good idea to enter your command in the terminal before setting it as a hotkey, just to make sure it works as expected.

I have yet to figure out how to get AHK-like hotstrings in Linux, but I'll update if I discover a workable solution.

Source Link

I just figured this out last night, and I'm sure my answer will be painfully simple to some, but it might be helpful to other noobs who are also looking for a way to do really basic AHK stuff on Linux (i.e. control mouse movements & auto-type blocks of pre-written text via hotkeys).

Most Desktop Environments include a custom keyboard shortcut editor (usually under a system settings or similar menu). I'm currently using KDE, but I've used XFCE, and, from what I recall, the shortcut editors were similar. Anyway, using the shortcut editor, you can write custom bash scripts, console commands, etc. (i.e. stuff I can barely do, and only after scouring forums).

To get AHK-like functionality, install xdotool (sudo apt install xdotool) and write your xdotool commands into the shortcut editor (if you're given options for several types of shortcuts, select the "command" option).

For example, I often need to have a way to send blocks of prewritten text. To do this, I enter the following line into the command field in my shortcut editor:

xdotool type '[some text]' 

Here's a tip, though. It's a good idea to enter your command in the terminal before setting it as a hotkey, just to make sure it works. I ran into a case where some of the text I had entered contained characters that the program was trying to read as something other than printable text, and I didn't figure out why my text wasn't appearing until I ran the command in the terminal and got an error message.