{config, ...}: { home.file.".config/battery_notify/notify_if_on_battery.sh" = { text = '' #!/usr/bin/env bash AC_PATH="/sys/class/power_supply/AC/online" # evtl. anpassen if [ -f "$AC_PATH" ]; then AC_STATUS=$(cat "$AC_PATH") if [ "$AC_STATUS" -eq 0 ]; then notify-send -u normal "🔋 Du bist nicht am Strom!" fi else notify-send -u critical "⚠️ AC-Status nicht gefunden" fi ''; executable = true; }; systemd.user.services.notify-on-battery = { Unit.Description = "Notify when on battery"; Service = { Type = "oneshot"; ExecStart = "${config.home.homeDirectory}/.config/battery_notify/notify_if_on_battery.sh"; }; }; systemd.user.timers.notify-on-battery = { Unit.Description = "Check battery status every 2 minutes"; Timer = { OnBootSec = "30s"; OnUnitActiveSec = "5min"; }; Install.WantedBy = [ "default.target" ]; }; }