From 73d1bf60ce1d06eaf7ddfc333a250fa86f0de674 Mon Sep 17 00:00:00 2001 From: Tomas Rivera Date: Tue, 28 Apr 2026 14:55:25 +0200 Subject: [PATCH] fix: random keypress stuck --- hostsModules/laptop/nixos/battery.nix | 13 ++++++++++++- hostsModules/laptop/nixos/udev.nix | 8 ++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/hostsModules/laptop/nixos/battery.nix b/hostsModules/laptop/nixos/battery.nix index 1e2080e..1cacc63 100644 --- a/hostsModules/laptop/nixos/battery.nix +++ b/hostsModules/laptop/nixos/battery.nix @@ -1,5 +1,8 @@ # https://discourse.nixos.org/t/what-is-the-best-option-for-power-management/63406/2 -{...}: +{ + lib, + config, + ...}: # we just activate tlp unconditonally #let # cfg = config.custom; @@ -18,6 +21,14 @@ # config = lib.mkIf cfg.battery.enable { powerManagement.powertop.enable = true; # enable powertop auto tuning on startup. + # Acording to https://community.frame.work/t/solved-keys-stick-and-repeat-after-being-released/51153/12 + # Some powertop bug is responsable for the problem of the random keypress being stuck + # fix: from https://git.gabbie.blue/blue/nixconf/src/commit/2d1bc6dad4684c019b6b3e894408e76e2734806c/hosts/gabbielaptop/configuration.nix#L68 + powerManagement.powertop.postStart = '' + ${lib.getExe' config.systemd.package "udevadm"} trigger -c bind -s usb -a idVendor=32ac -a idProduct=0018 + # Retrigger macropad udev rules + ${lib.getExe' config.systemd.package "udevadm"} trigger -c bind -s usb -a idVendor=32ac -a idProduct=0013 + ''; services.system76-scheduler.settings.cfsProfiles.enable = true; # Better scheduling for CPU cycles - thanks System76!!! services.thermald.enable = true; # Enable thermald, the temperature management daemon. (only necessary if on Intel CPUs) services.power-profiles-daemon.enable = false; # Disable GNOMEs power management diff --git a/hostsModules/laptop/nixos/udev.nix b/hostsModules/laptop/nixos/udev.nix index cfae078..b89c224 100644 --- a/hostsModules/laptop/nixos/udev.nix +++ b/hostsModules/laptop/nixos/udev.nix @@ -12,5 +12,13 @@ # taken from here SUBSYSTEMS=="usb", ATTRS{idVendor}=="32ac", ATTRS{idProduct}=="0013", TAG+="uaccess" SUBSYSTEMS=="usb", ATTRS{idVendor}=="32ac", ATTRS{idProduct}=="0018", TAG+="uaccess" + + # acording to https://community.frame.work/t/solved-keys-stick-and-repeat-after-being-released/51153/12 + # the random keypress stuck comes from conflict between powertop and udev + # fix from: https://git.gabbie.blue/blue/nixconf/src/commit/2d1bc6dad4684c019b6b3e894408e76e2734806c/hosts/gabbielaptop/configuration.nix#L68 + # disable USB auto suspend for framework keyboard + ACTION=="bind", SUBSYSTEM=="usb", ATTR{idVendor}=="32ac", ATTR{idProduct}=="0018", TEST=="power/control", ATTR{power/control}="on" + # disable USB auto suspend for framework macropad + ACTION=="bind", SUBSYSTEM=="usb", ATTR{idVendor}=="32ac", ATTR{idProduct}=="0013", TEST=="power/control", ATTR{power/control}="on" ''; }