diff options
author | Silas Schöffel <sils@sils.li> | 2025-08-24 15:41:29 +0200 |
---|---|---|
committer | Silas Schöffel <sils@sils.li> | 2025-08-24 15:45:14 +0200 |
commit | 49e4942d4124ca791ee007ecf0e43c598ab8a9e0 (patch) | |
tree | 86aca21fb22289a94b940098cdf739e137ca3ad8 | |
parent | poweralertd: init (diff) | |
download | nix-config-49e4942d4124ca791ee007ecf0e43c598ab8a9e0.zip |
waybar: add events to execute on low battery
-rw-r--r-- | hm/waybar/default.nix | 50 | ||||
l--------- | result-man | 1 |
2 files changed, 43 insertions, 8 deletions
diff --git a/hm/waybar/default.nix b/hm/waybar/default.nix index 0569fce..335bdc9 100644 --- a/hm/waybar/default.nix +++ b/hm/waybar/default.nix @@ -5,7 +5,10 @@ mainBar = { layer = "top"; position = "top"; - modules-left = ["hyprland/workspaces" "clock"]; + modules-left = [ + "hyprland/workspaces" + "clock" + ]; modules-center = ["hyprland/window"]; modules-right = [ "pulseaudio" @@ -34,7 +37,11 @@ pulseaudio = { format = " {icon} "; format-muted = "ﱝ"; - format-icons = ["奄" "奔" "墳"]; + format-icons = [ + "奄" + "奔" + "墳" + ]; tooltip = true; tooltip-format = "{volume}%"; }; @@ -50,7 +57,17 @@ backlight = { device = "intel_backlight"; format = "{icon}"; - format-icons = ["" "" "" "" "" "" "" "" ""]; + format-icons = [ + "" + "" + "" + "" + "" + "" + "" + "" + "" + ]; tooltip = true; tooltip-format = "{percent}%"; }; @@ -60,10 +77,29 @@ warning = 30; critical = 15; }; + events = { + on-discharging-warning = "${pkgs.libnotify}/bin/notify-send -u normal 'Low Battery'"; + on-discharging-critical = "${pkgs.libnotify}/bin/notify-send -u critical 'Very Low Battery' 'Hibernating soon'"; + on-discharging-11 = "${pkgs.libnotify}/bin/notify-send -u critical 'Very Low Battery' 'Hibernating now'"; + on-discharging-10 = "${pkgs.systemd}/bin/systemctl hibernate --check-inhibitors=no"; + }; format = "{capacity}% {icon}"; format-charging = ""; format-plugged = ""; - format-icons = ["" "" "" "" "" "" "" "" "" "" "" ""]; + format-icons = [ + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + ]; tooltip = true; tooltip-format = "{capacity}%"; }; @@ -78,10 +114,8 @@ tooltip-format = '' <big>{:%Y %B}</big> <tt><small>{calendar}</small></tt>''; - format-alt = '' - {:%d %m %Y}''; - format = '' - {:%H %M}''; + format-alt = ''{:%d %m %Y}''; + format = ''{:%H %M}''; }; tray = { diff --git a/result-man b/result-man new file mode 120000 index 0000000..6bd4f75 --- /dev/null +++ b/result-man @@ -0,0 +1 @@ +/nix/store/rw3a44jhk6jm0742yh56kpcl7f9kv4cb-libnotify-0.8.6-man \ No newline at end of file |