waybar: battery tweaks

This commit is contained in:
Vinzenz Schroeter 2025-11-13 12:52:14 +01:00
parent 1e05616712
commit 3115711564

View file

@ -112,12 +112,50 @@
battery = { battery = {
format = "{capacity}% {icon}"; format = "{capacity}% {icon}";
format-icons = [ format-icons = [
"" "󰂎" # 0%
"" "󰁺" # 10%
"" "󰁻" # 20%
"" "󰁼" # 30%
"" "󰁽" # 40%
"󰁾" # 50%
"󰁿" # 60%
"󰂀" # 70%
"󰂁" # 80%
"󰂂" # 90%
"󱟢" # 100%
]; ];
states = {
warning = 25;
critical = 15;
};
events =
let
mkNotifySendCommand =
{
summary,
urgency ? null,
body ? null,
icon ? null,
}:
let
body-part = if body != null then "'${body}'" else "";
urgency-part = if urgency != null then "--urgency ${urgency}" else "";
icon-part = if icon != null then "--icon ${icon}" else "";
in
"${lib.getBin pkgs.libnotify}/bin/notify-send ${urgency-part} ${icon-part} '${summary}' ${body-part}";
in
{
on-discharging-warning = mkNotifySendCommand {
summary = "Low Battery";
icon = "battery-caution";
};
on-discharging-critical = mkNotifySendCommand {
urgency = "critical";
summary = "Very Low Battery";
body = "Connect to power <i>now</i>!";
icon = "battery-low";
};
};
}; };
backlight = { backlight = {
device = "intel_backlight"; device = "intel_backlight";