nixy/zremap: add udev triggered service
This commit is contained in:
parent
d1da1f149b
commit
0e58c0a65f
@ -174,24 +174,18 @@
|
|||||||
# List services that you want to enable:
|
# List services that you want to enable:
|
||||||
systemd = {
|
systemd = {
|
||||||
services = {
|
services = {
|
||||||
"zremap" = {
|
"zremap@" = {
|
||||||
description = "Intercepts keyboard udev events";
|
enable = true;
|
||||||
wants = ["systemd-udevd.service"];
|
restartIfChanged = true;
|
||||||
wantedBy = ["multi-user.target"];
|
|
||||||
serviceConfig.Nice = -20;
|
serviceConfig.Nice = -20;
|
||||||
script = ''
|
unitConfig = {
|
||||||
sleep 1
|
Description = "zremap on %I";
|
||||||
KBD1="/dev/input/by-path/platform-i8042-serio-0-event-kbd"
|
ConditionPathExists = "%I";
|
||||||
KBD2="/dev/input/by-path/pci-0000:07:00.3-usbv2-0:1.1.3.2:1.1-event-kbd"
|
};
|
||||||
if [ -L "$KBD1" ]; then
|
serviceConfig = {
|
||||||
${zremap.defaultPackage.${system}}/bin/zremap "$KBD1" &
|
Type = "simple";
|
||||||
fi
|
ExecStart = "${zremap.defaultPackage.${system}}/bin/zremap %I";
|
||||||
if [ -L "$KBD2" ]; then
|
};
|
||||||
${zremap.defaultPackage.${system}}/bin/zremap "$KBD2" &
|
|
||||||
fi
|
|
||||||
|
|
||||||
wait
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -243,6 +237,9 @@
|
|||||||
|
|
||||||
#Arduino UNO r4
|
#Arduino UNO r4
|
||||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2341", MODE:="0666"
|
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2341", MODE:="0666"
|
||||||
|
|
||||||
|
#zremap on new keyboard
|
||||||
|
ACTION=="add", SUBSYSTEM=="input", ATTRS{phys}!="", KERNEL=="event[0-9]*", ENV{ID_INPUT_KEY}=="1", ENV{ID_INPUT_KEYBOARD}=="1", TAG+="systemd", ENV{SYSTEMD_WANTS}+="zremap@$env{DEVNAME}.service"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user