Daemon is running, but still fail on KDE/Wayland (And internal SyntaxWarning)
Running keyd-application-mapper on Arch Linux with KDE Plasma on Wayland produces two issues:
1. SyntaxWarning
/usr/bin/keyd-application-mapper:476: SyntaxWarning: invalid escape sequence '\W'
return re.sub('[\W_]+', '-', s).strip('-').lower()
2. Socket connection failure under KDE/Wayland
ERROR: Failed to connect to "/var/run/keyd.socket", make sure the daemon is running and you have permission to access the socket.
Occurs even though the keyd daemon is active and the user is a member of the keyd group.
● keyd.service - key remapping daemon
Loaded: loaded (/usr/lib/systemd/system/keyd.service; enabled; preset: disabled)
Active: active (running) since Sun 2025-08-31 10:24:40 EEST; 9min ago
Main PID: 13712 (keyd)
Tasks: 1 (limit: 18841)
Memory: 508K (peak: 1.8M)
CPU: 460ms
CGroup: /system.slice/keyd.service
└─13712 /usr/bin/keyd
Steps to Reproduce
- Install
keydandkeyd-application-mapperand dependencies:
sudo pacman -S keyd python python-dbus python-xlib
- Start and enable the daemon:
sudo systemctl enable --now keyd
- Create a simple per-app config:
# ~/.config/keyd/app.conf
[kitty]
pageup = delete
- Run the mapper:
keyd-application-mapper
Environment / System Info
- OS: Arch Linux
- Desktop Environment: KDE Plasma
- Display Server: Wayland
- Python version: 3.13 (tried 3.11.9)
- keyd version: 2.5.0
- Full log:
❯ keyd-application-mapper
/usr/bin/keyd-application-mapper:476: SyntaxWarning: invalid escape sequence '\W'
return re.sub('[\W_]+', '-', s).strip('-').lower()
kde detected
ERROR: Failed to connect to "/var/run/keyd.socket", make sure the daemon is running and you have permission to access the socket.
ERROR: Failed to connect to "/var/run/keyd.socket", make sure the daemon is running and you have permission to access the socket.
ERROR: Failed to connect to "/var/run/keyd.socket", make sure the daemon is running and you have permission to access the socket.
ERROR: Failed to connect to "/var/run/keyd.socket", make sure the daemon is running and you have permission to access the socket.
ERROR: Failed to connect to "/var/run/keyd.socket", make sure the daemon is running and you have permission to access the socket.
^CTraceback (most recent call last):
File "/usr/bin/keyd-application-mapper", line 506, in <module>
mon.run()
~~~~~~~^^
File "/usr/bin/keyd-application-mapper", line 171, in run
gi.repository.GLib.MainLoop().run()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/lib/python3.13/site-packages/gi/overrides/GLib.py", line 495, in run
with register_sigint_fallback(self.quit):
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
File "/usr/lib/python3.13/contextlib.py", line 148, in __exit__
next(self.gen)
~~~~^^^^^^^^^^ File "/usr/lib/python3.13/site-packages/gi/_ossighelper.py", line 239, in register_sigint_fallback signal.default_int_handler(signal.SIGINT, None)
~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^ KeyboardInterrupt
Same is happening to me.
Same is happening to me.
For the /var/run/keyd.socket error I just had to restart my computer after adding my user to the keyd group.
For the invalid escape sequence '\W' I modified the keyd-application-mapper python file to include an extra backslash like this: \\W, then compiled keyd from source (very easy as keyd don't need too much dependencies).
And with that it should work on arch+KDE+kwin as window manager.
If anyone don't use kwin but dwm (as me) they need an extra step, they not only need to patch the \\W line, but also several other lines in the keyd-application-mapper.
@Majoramari
first check weather the keyd is running or not by running this
systemctl status keyd
if its not running enable the service by this command sudo systemctl enable --now keyd
if its running then check if the socket is persistent or not by running this command and you should see some thing like this,
ls -l /var/run/keyd.socket
srw-rw---- 1 root keyd 0 Nov 3 00:08 /var/run/keyd.socket
if not than add youself to keyd's group as this program fundamentally controls this input so the devloper has made this not to be used by everyone sudo usermod -aG keyd $USER
now check you should not get this ERROR: Failed to connect to "/var/run/keyd.socket"