{...}: { home-manager.users."main" = { pkgs, lib, ... }: let script = pkgs.writeShellScript "inputplug.sh" '' mkdir -p $HOME/.cache/inputplug set -x _event_type="$1" _device_id="$2" _device_type="$3" _device_name="$4" _keyboard_id=$(xinput list | grep "AT Translated Set 2 keyboard" | cut -f 2 -d $'\t' | cut -f 2 -d '=') _property_id=$(xinput list-props 16 | grep "Device Enabled" | cut -f 2 | sed -E 's/^[^(]+\(([[:digit:]]*)\):$/\1/') cat <> "$HOME/.cache/inputplug/$_device_id" xinput set-int-prop $_keyboard_id $_property_id 8 0 fi ;; *) ;; esac ;; *) ;; esac ;; *) ;; esac ''; in { systemd.user.services."inputplug" = { Unit = { After = ["graphical-session-pre.target"]; PartOf = ["graphical-session.target"]; }; Service = { Type = "simple"; ExecStart = ''${lib.getExe pkgs.bash} -l -c "${lib.getExe pkgs.inputplug} -d -c ${script}"''; }; Install = {WantedBy = ["graphical-session.target"];}; }; }; }