Using Autokey or alternative under Wayland?

Hello,

I’m relatively new to Linux desktop environments - I’ve mostly worked with headless systems so far. Now I’m planning to switch my main machine to EndeavourOS for daily use.

One of my tools is Autokey, which I use to insert frequently typed text snippets via custom keyboard shortcuts. These shortcuts work under X11, but do not work under Wayland. I think, this is due to Wayland’s stricter security settings.

My question is:
Is there any way to insert text snippets with shortcuts like Autokey does under Wayland?

Thanks in advance for your help.
Simon

Just this week I was looking for something like that, for a personal project. Probably not quite what you are looking for, but the only thing that came close that did work on my setup under Wayland:

diowtype [1].

All I needed was to be able to programmatically send keys (PgUp and PgDn) to the os when the user presses either of 2 tactile buttons, and send those keys to a text editor. That’s what diowtype can do without problem and with a very small footprint.

Edit: should have added that I use wlrctl to give focus to the text editor, to then send the emulated keypresses through diowtype.

[1] https://github.com/DiogenesN/diowtype

I use espanso-wayland, not exactly a 100% replacement, but good enough for me.

1 Like

Interesting! Will have a look soon.

If you only need text snippets, not macros or mouse clicks or anything, you should use wtype.

If you need something more elaborate, I recommend dotool https://superuser.com/a/1926939/340197

1 Like

Hi,

Please apologize my late reply. I was off due to migraine. Feel better now.
I just tried out espanso at first. I was following the manual compilation and it works.. kind of.

Iw as greeted with a welcome screen, after starting with espanso start. There the replacement didn’t work. After that I have configured the default.ymyand entered my locale keyboard and restarted the service. The built in example commands worked fine. Then I have added a own replacement. My replacement string has a few special characters. One of them triggered the capslock and wrot the rest of the string in caps. I have escaped them with unicode, like here described: https://espanso.org/docs/matches/basics/#special-characters

I have also noticed a window showing for a brief milliseconds and dissapearing. It had was colored like the color wheels, where you can pick a color. The window showed up every few seconds.

Unfortunately, I don’t remember, what exactly I did, but the window have stopped now apprearing all the time.

If I can solve the capslock issue, then espanso works for me.
Therefore, I currently looking at the other tools diowtype and Dotool.

Thank you for your kind help all.

Good luck with your investigation. I’d be interested if you do find a well working solution.

Sorry to read about your migraine :frowning:

That happens on startup (login), don´t know the purpose. Otherwise it works fine for several years now here. But it only happens once on startup, not several times.

Hi @SemLraug thank you much.

I just had success now.
The option force_clipboard: true solved the issue.

A few details, when I had not yet used the force_clipboard option:
The issue seems only occuring, when using mutliple special charsacters in sequence, like this: \x30\x2e. When I’m using the hex codes followed by a normal character, then it’s okay.

I have also played around with different variant options in default.yaml, like this, but it had no influence on the behavior.

keyboard_layout:
layout: “ch”
variant: “de_nodeadkeys”
1 Like

I am in the UK, so rarely need accented characters, so never had any issues. As @Schlaefer says, the coloured popup window appears at startup and whenever you change your config, I suppose it is a notification “on change”, pointless :smiley: