Anyone got ydotool working in kde plasma?

I’m trying to get ydotool to work without sudo.

I can get it to work if I start ydotoold with sudo and then call ydotool also with sudo.

But anything from my user is just a combination of

failed to bind socket: Address already in use
fish: Job 1, 'ydotoold --socket-path /tmp/ydo…' terminated by signal SIGABRT (Abort)


failed to connect socket: Permission denied
fish: Job 1, 'ydotool type hellp' terminated by signal SIGABRT (Abort)

the first occurs when I try to do the daemon from my own user and creating a custom socket path. The second is then when using it from there.

I figured it being packaged, it maybe would have come with it’s own thing? Do I need to create my own systemd service? I just am not sure the right combination of steps to get this to work.

On another note, I did get it to fully type out something when calling everything from sudo though…

Never mind. I figured it out after digging around in making my own service and socket path to ydotool.

For anyone doing this themselves in the future, here is what I did.

  • Make sure you user is a part of the uinput group.
  • Create a user systemd service that launches ydotoold with it’s own socket separate from the default place.
  • Make sure anything you run ydotool you set the environment variable YDOTOOL_SOCKET to your custom socket location. THEN profit?

Here is my systemd service = {
  ydotoold = {
    Unit = {
      Description = "An auto-input utility for wayland";
      Documentation = [ "man:ydotool(1)" "man:ydotoold(8)" ];
    Service = {
      ExecStart = "/run/current-system/sw/bin/ydotoold --socket-path /tmp/ydotools";

    Install = {
      WantedBy = [""];

I also have a bash script that I auto type info from. Put this at the top to make sure you get it right.

export YDOTOOL_SOCKET=/tmp/ydotools
1 Like

Don’t make daemons run any longer than they are needed.
As an example, here is my script to trigger a shortcut to turn of night collor in kde(I need this to turn it off on boot because if you want night color on demand you will need to turn on always on)

#! /bin/bash

# Toggle night collour
toggle_light () {
  ydotool key 29:1 42:1 49:1 29:0 42:0 49:0
  xdotool key ctrl+shift+n

# Turns off night light if its on
if [ $(qdbus-qt5 org.kde.KWin /ColorCorrect org.kde.kwin.ColorCorrect.inhibited) != true ]; then
  export YDOTOOL_SOCKET=/tmp/ydotools
  nohup ydotoold --socket-path /tmp/ydotools &
  sleep 5
  sleep 1
  pkill ydotool

if you incorporate sleep to give the daemon time to load and use nohup you can make the script alot cleaner

Hosted by Flying Circus.