Auto: cleanup-2026-06-13T20-10-24Z

This commit is contained in:
2026-06-13 22:10:43 +02:00
parent 2585a88780
commit 4f3a74b741
7 changed files with 45 additions and 38 deletions
+32 -29
View File
@@ -1,8 +1,9 @@
{self, inputs, ...}: {
flake.nixosModules.battery-laptop = {
pkgs,
...
}:
{
self,
inputs,
...
}: {
flake.nixosModules.battery-laptop = {pkgs, ...}:
# https://discourse.nixos.org/t/what-is-the-best-option-for-power-management/63406/2
# we just activate tlp unconditonally
#let
@@ -21,7 +22,8 @@
# };
# config = lib.mkIf cfg.battery.enable {
/*powerManagement.powertop.enable = true; # enable powertop auto tuning on startup.
/*
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
@@ -29,7 +31,8 @@
${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 = false; # Enable thermald, the temperature management daemon. (only necessary if on Intel CPUs)
services.power-profiles-daemon.enable = false; # Disable GNOMEs power management
@@ -49,9 +52,9 @@
STOP_CHARGE_THRESH_BAT1 = 80;
};
};
environment.systemPackages = [
self.packages.${pkgs.system}.custom-performance
];
environment.systemPackages = [
self.packages.${pkgs.system}.custom-performance
];
};
perSystem = {pkgs, ...}: let
NotifySound = ../../assets/battery_notify.mp3;
@@ -344,21 +347,21 @@
];
text = ''
STATE="$HOME/.cache/hypr-battery-saver"
enable() {
mkdir -p "$(dirname "$STATE")"
echo "Enabling battery saver mode..."
# Save brightness
brightnessctl get > "''${STATE}.brightness" 2>/dev/null || true
# Kill heavy UI components
pkill -f caelestia-shell || true
pkill -f caelestia || true
pkill shell || true
pkill -f custom-wallpaper || true
# Start lightweight notifications
pkill swaync || true
swaync & disown
@@ -366,10 +369,10 @@
# Start lightweight waybar
pkill waybar || true
waybar & disown
# Lower refresh rate (BIGGEST win)
hyprctl keyword monitor "eDP-1,2560x1600@60,0x0,1"
# Core performance toggles
hyprctl --batch "\
keyword animations:enabled 0;\
@@ -384,45 +387,45 @@
keyword decoration:active_opacity 1;\
keyword decoration:inactive_opacity 1;\
keyword misc:vfr true"
# Lower brightness
brightnessctl set 5% 2>/dev/null || true
touch "$STATE"
notify-send "Battery Saver" "Enabled"
}
disable() {
echo "Disabling battery saver mode..."
# Restore refresh rate
hyprctl keyword monitor "eDP-1,2560x1600@165,0x0,1"
# Restore Caelestia
pkill swaync || true
pkill waybar || true
caelestia shell -d >/dev/null 2>&1 &
disown
# Restart wallpaper
custom-wallpaper >/dev/null 2>&1 &
disown
# Restore full UI via reload (safe here on exit)
hyprctl reload
# Restore brightness
if [[ -f "''${STATE}.brightness" ]]; then
brightnessctl set "$(cat "''${STATE}.brightness")" 2>/dev/null || true
fi
rm -f "$STATE" "''${STATE}.brightness"
notify-send "Battery Saver" "Disabled"
}
if [[ -f "$STATE" ]]; then
disable
else