marsqing / libinput-three-finger-drag

Three-finger-drag support for libinput
MIT License
87 stars 11 forks source link

Trying to create a systemd sevice: "Can't open display: (null)" #11

Closed ghost closed 1 year ago

ghost commented 1 year ago

Kubuntu 22.04 LTS (x86_64) here, and I'm trying to create a systemd service for libinput-three-finger-drag. I compiled it from the source code and then placed it in /usr/local/bin/libinput-three-finger-drag. If I manually run the command in Konsole, it works fine.

My created service looks like this:

[Unit]
Description=Three finger drag.

[Service]
Restart=always
User=root
ExecStart=/usr/local/bin/libinput-three-finger-drag

[Install]
WantedBy=multi-user.target

But when I try to run it, I get this:

libinput-three-finger-drag.service - Three finger drag.
     Loaded: loaded (/etc/systemd/system/libinput-three-finger-drag.service; disabled; vendor preset: enabled)
     Active: active (running) since Sun 2022-07-31 00:34:39 EEST; 4s ago
   Main PID: 6283 (libinput-three-)
      Tasks: 4 (limit: 18930)
     Memory: 1.9M
        CPU: 104ms
     CGroup: /system.slice/libinput-three-finger-drag.service
             ├─6283 /usr/local/bin/libinput-three-finger-drag
             └─6284 libinput-debug-events

July 31 00:34:39 (computer's name) systemd[1]: Started Three finger drag..
July 31 00:34:39 (computer's name) libinput-three-finger-drag[6283]: Error: Can't open display: (null)
July 31 00:34:39 (computer's name) libinput-three-finger-drag[6283]: thread '<unnamed>' panicked at 'can not initialize libxdo: Ffi', src/xdo_handler.rs:29:34
July 31 00:34:39 (computer's name) libinput-three-finger-drag[6283]: note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Alongside the errors above, I also used to get one that said Authorization required, but no authorization protocol specified, but I managed to fix it. However, I still have no idea how to fix this display error.

I had Manjaro installed earlier today before I did a fresh install of Kubuntu, though the error there was exactly the same. Could it be a problem with KDE? Or am I simply creating the startup service the wrong way?

dohsimpson commented 3 months ago

Also run into this issue. I was able to solve it by adding my user to input group (running id should show input in your groups). Running with root user or with sudo won't work.