xsession: add xplugd service to accompany setxkbmap (#2450)

This fixes #1638; xplugd will restart setxkbmap if a new keyboard is
plugged in to ensure it is also configured correctly.
This commit is contained in:
ckie 2021-12-23 22:38:44 +02:00 committed by GitHub
parent 1b03a8ab7a
commit 3b9c625b64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -126,6 +126,29 @@ in {
in "${pkgs.xorg.setxkbmap}/bin/setxkbmap ${toString args}";
};
};
xplugd = {
Unit = {
Description = "Rerun setxkbmap.service when I/O is changed";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
Type = "forking";
ExecStart = let
script = pkgs.writeShellScript "xplugrc" ''
case "$1,$3" in
keyboard,connected)
systemctl --user restart setxkbmap.service
;;
esac
'';
in "${pkgs.xplugd}/bin/xplugd ${script}";
};
};
};
targets = {