add(nixos): mouse-wakeup
This commit is contained in:
@@ -40,6 +40,13 @@
|
|||||||
wallpaper = "firewatch.png";
|
wallpaper = "firewatch.png";
|
||||||
kb_options = "";
|
kb_options = "";
|
||||||
};
|
};
|
||||||
|
wakeup = {
|
||||||
|
mouse = {
|
||||||
|
disable = true;
|
||||||
|
vendor = "3710";
|
||||||
|
product = "5406";
|
||||||
|
};
|
||||||
|
};
|
||||||
firefox = {
|
firefox = {
|
||||||
bookmarks = [
|
bookmarks = [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
./kernel.nix
|
./kernel.nix
|
||||||
./nix.nix
|
./nix.nix
|
||||||
./power.nix # TODO: this one has to be optional
|
./power.nix # TODO: this one has to be optional
|
||||||
|
./mouse-wakeup.nix
|
||||||
./programs.nix
|
./programs.nix
|
||||||
./security.nix
|
./security.nix
|
||||||
./services.nix
|
./services.nix
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
{ lib, myConfig, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = myConfig.wakeup.mouse or {};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
config = mkIf (cfg.disable or false && cfg.vendor != null && cfg.product != null) {
|
||||||
|
services.udev.extraRules = ''
|
||||||
|
# Disable wakeup for mouse configured in config.nix
|
||||||
|
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="${cfg.vendor}", ATTRS{idProduct}=="${cfg.product}", ATTR{power/wakeup}="disabled"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
+3
-20
@@ -1,21 +1,4 @@
|
|||||||
{pkgs, ...}: {
|
{
|
||||||
# USB wakeup configuration
|
# This file is intentionally left blank.
|
||||||
# Disabling USB wakeups to prevent accidental wakeups from mouse/keyboard/bluetooth
|
# USB wakeup is now handled by modules/nixos/mouse-wakeup.nix
|
||||||
systemd.services.disable-usb-wakeups = {
|
|
||||||
description = "Disable USB wakeup triggers";
|
|
||||||
wantedBy = ["multi-user.target" "post-resume.target"];
|
|
||||||
after = ["post-resume.target"];
|
|
||||||
serviceConfig = {
|
|
||||||
Type = "oneshot";
|
|
||||||
ExecStart = pkgs.writeShellScript "disable-usb-wakeups" ''
|
|
||||||
for device in XHC0 XHC1 XHC2 XH00 GPP0 GPP7; do
|
|
||||||
if grep -q "$device.*enabled" /proc/acpi/wakeup; then
|
|
||||||
echo "Disabling wakeup for $device"
|
|
||||||
echo "$device" > /proc/acpi/wakeup
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
'';
|
|
||||||
RemainAfterExit = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user