30 lines
1.3 KiB
Nix
30 lines
1.3 KiB
Nix
{
|
|
config,
|
|
inputs,
|
|
pkgs,
|
|
...
|
|
}: {
|
|
services.udev = {
|
|
extraRules = let
|
|
inherit (inputs.hyprland.packages.${pkgs.system}) hyprland;
|
|
|
|
power_supply = pkgs.writeShellScript "on_power_supply" ''
|
|
${pkgs.asusctl}/bin/asusctl profile -P Performance
|
|
#${pkgs.supergfxctl}/bin/supergfxctl -m Hybrid
|
|
${config.boot.kernelPackages.cpupower}/bin/cpupower frequency-set -g performance
|
|
${hyprland}/bin/hyprctl keyword decoration:blur:enabled true
|
|
${hyprland}/bin/hyprctl keyword animations:enabled true
|
|
'';
|
|
battery = pkgs.writeShellScript "on_battery" ''
|
|
${pkgs.asusctl}/bin/asusctl profile -P Quiet
|
|
#${pkgs.supergfxctl}/bin/supergfxctl -m Integrated
|
|
${config.boot.kernelPackages.cpupower}/bin/cpupower frequency-set -g powersave
|
|
${hyprland}/bin/hyprctl keyword decoration:blur:enabled false
|
|
${hyprland}/bin/hyprctl keyword animations:enabled false
|
|
'';
|
|
in ''
|
|
SUBSYSTEM=="power_supply",ENV{POWER_SUPPLY_ONLINE}=="1",RUN+="${power_supply}"
|
|
SUBSYSTEM=="power_supply",ENV{POWER_SUPPLY_ONLINE}=="0",RUN+="${battery}"
|
|
'';
|
|
};
|
|
}
|