Creating a script for key automation

Good evening Linux community…

I am a new user of the Linux system (Manjaro Distribution) and I am really enjoying it, it has served me very well.

However, I used an application on Windows that I could “program” certain events when pressing a keyboard key.

Example 1:
By pressing the “F1” key it sends letters “A” and “B”.

Example 2:
By pressing and holding the “F2” key it sends every 3 seconds (until I release the “F2” key), the “C” and “D” keys.

I searched the internet on how to make this determination function on my system in the simplest way possible, I found tools like AutoKey and xdotool.

My question is, do both programs allow me to do the certain function I would like?

And what is the “cleanest”, “fastest” and “efficient” way to do this particular function?

As an example, I have this piece of code in xdotool, in case I need to create a condition before it executes this command (keypress condition).
It’s possible?

while true
	# Do something to block while key isn't down

	xdotool keydown --window $winid "x"
	xdotool keyup --window $winid "x"

Thanks and sorry for English, it’s not my native language.

Perhaps the autokey-{qt|gtk} package - the qt and gtk gui depending on current toolkit (Plasma or Gnome)

I took a look at AutoKey, but I’m having trouble creating the script, I mentioned lxdotool because I’m more familiar with it, I’ve already done some commands.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.