I am a new Linux user and have settled on Ubuntu 24.04.3 LTS in Wayland. In Windows, I used AutoHotKey to automate the keyboard to type repetitive text strings with a hotkey e.g. pressing Alt+E to type my@email.com

I believe the solution in Linux is to install an application like dotool or ydotool and then create a custom shortcut command. The problem is I cannot get dotool and ydotool to work. I’ll document the issues I’m having with ydotool as there seems to be more awareness and support for this application.

I am following the instillation instructions here:

https://askubuntu.com/questions/1413829/how-can-i-install-and-use-the-latest-ydotool-keyboard-automation-tool-working-o

Everything seems to go fine until I get to this step and get the following error:

sudo systemctl enable ydotoold

Failed to enable unit: Unit file ydotoold.service does not exist.

I came across this issue which suggests it could be a permissions issue on /dev/uinput and tried to the solution provided in that post but I still can’t enable ydotoold after a reboot.

Running this command works:

ydotoold --version

v1.0.4-38-g708e96f

But I am stuck here and not sure how to troubleshoot or progress further. Any help would be appreciated, thank you!

    • DarkSpectrum@lemmy.worldOP
      link
      fedilink
      arrow-up
      1
      ·
      2 days ago

      That seems to have worked better, I can now run ydotool commands in terminal. Will a user level service have any specific limitations?

      When use this command as a custom keyboard shortcut:

      ydotool type abcde12345

      It will miss the first few characters and type:

      de12345

      When I try chaining shell commands to pause and wait before typing, it doesn’t work at all:

      sleep 2; ydotool type abcde12345

      Any ideas on how I could automate ydotool as a keyboard hotkey? Custom shortcut to run a bash script maybe?

      • bigpEE@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        2 days ago

        I think ydotoold has an equivalent to sleep built in. A good while back I wrote a quick ydotoold command to automate something like 100 keypresses with delays in between. Let me know in 12 hours if you haven’t gotten that figured out and I can find you the commands

        • DarkSpectrum@lemmy.worldOP
          link
          fedilink
          arrow-up
          1
          ·
          1 day ago

          Thanks, unfortunately ydotool has removed their sleep command stating ‘this should be your shell’s job’. I tried using the standard shell sleep command and used the semicolon to chain commands. Maybe thats not how to use the command field of the custom shortcut.

  • Overdraft@lemmy.ml
    link
    fedilink
    arrow-up
    1
    ·
    2 days ago

    Reading through the comments, it seems like you’ve got ydotool working, but it may not have all the capabilities you want. I created a tool that seems like it could do everything you need, it has a couple of prerequisites, but it runs as a python script and doesn’t require super user to work.

    If you wanted to give it a go, I’d be happy to help as much as I can; I use it daily on Debian 12 with Wayland, so I’m pretty confident it should work for you on Ubuntu. Admittedly, it’s still rough around the edges, but it can definitely handle mapping ‘Alt + E’ to type an email address.

    https://gitlab.com/sincere-untimely-yesterday-group/custom-input-remapping/-/tree/7d64cfd2cb70c5acc19ba7536b91f9558e69b9ce/

  • db2@lemmy.world
    link
    fedilink
    arrow-up
    1
    arrow-down
    3
    ·
    edit-2
    2 days ago

    Wayland doesn’t do any of the things you want here. X11 has problems but it’s also mature and works. You’d have xdotool and already be done.

  • vort3@lemmy.ml
    link
    fedilink
    arrow-up
    1
    arrow-down
    1
    ·
    2 days ago

    Not a solution you want, but consider custom compose key sequences for repetitive text.