From c216f079596273490f4603cdac83fe9d80d053a2 Mon Sep 17 00:00:00 2001 From: Sweetbread Date: Wed, 15 Jul 2026 20:55:21 +0300 Subject: [PATCH] fixup! fixup! fixup! fixup! fixup! Inaho: new host --- host/modules/thinkpad.nix | 2 +- user/sweetbread/modules/waybar.nix | 57 +++++++++++++++++++++++++++--- 2 files changed, 53 insertions(+), 6 deletions(-) diff --git a/host/modules/thinkpad.nix b/host/modules/thinkpad.nix index 98b5912..a2f65f8 100644 --- a/host/modules/thinkpad.nix +++ b/host/modules/thinkpad.nix @@ -53,7 +53,7 @@ # Preserve batteries when the laptop is usually on AC. # Raise STOP_* to 100 if maximum autonomy matters more than battery wear. START_CHARGE_THRESH_BAT0 = 70; - STOP_CHARGE_THRESH_BAT0 = 85; + STOP_CHARGE_THRESH_BAT0 = 95; START_CHARGE_THRESH_BAT1 = 70; STOP_CHARGE_THRESH_BAT1 = 85; RESTORE_THRESHOLDS_ON_BAT = 1; diff --git a/user/sweetbread/modules/waybar.nix b/user/sweetbread/modules/waybar.nix index 9098de0..c11ded4 100644 --- a/user/sweetbread/modules/waybar.nix +++ b/user/sweetbread/modules/waybar.nix @@ -3,13 +3,16 @@ playerctl cava pulsemixer + libnotify monocraft font-awesome nerd-fonts.symbols-only ]; - programs.waybar = { + programs.waybar = let + multibat = osConfig.networking.hostName == "Inaho"; + in { enable = true; systemd.enable = true; @@ -31,7 +34,7 @@ "tray" "group/system" "pulseaudio" - "battery" + ( if multibat then "group/bat" else "battery" ) "clock" ]; @@ -71,6 +74,19 @@ dynamic-order = [ "title" "artist" "album" ]; }; + "group/bat" = lib.mkIf multibat { + orientation = "inherit"; + drawer = { + transition-duration = 500; + transition-left-to-right = false; + }; + modules = [ + "battery" + "battery#int" + "battery#ext" + ]; + }; + battery = { interval = 5; states = { @@ -82,6 +98,33 @@ default = ["󰂎" "󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"]; charging = ["󰢟" "󰢜" "󰂆" "󰂇" "󰂈" "󰢝" "󰂉" "󰢞" "󰂊" "󰂋" "󰂅"]; }; + events = { + on-discharging-warning = "notify-send -u normal 'Low Battery'"; + on-discharging-critical = "notify-send -u critical 'Very Low Battery'"; + }; + }; + + "battery#int" = lib.mkIf multibat { + bat = "BAT0"; + interval = 5; + states = { + warning = 30; + critical = 15; + }; + format = "I: {capacity}%"; + }; + + "battery#ext" = lib.mkIf multibat { + bat = "BAT1"; + interval = 5; + states = { + warning = 30; + critical = 15; + }; + format = "E: {capacity}%"; + events = { + on-discharging-0 = "notify-send -u normal 'External battery died'"; + }; }; "keyboard-state" = { @@ -249,8 +292,9 @@ } } - #system .drawer-child > * { - margin-right: 4px + #system, + #bat { + & .drawer-child > * { margin-right: 4px } } #keyboard-state label.locked { @@ -259,7 +303,6 @@ } #battery { - &.plugged { color: ${colors.base0D}; } &.charging { color: ${accent}; } &:not(.charging) { &.warning { @@ -280,6 +323,10 @@ color: ${colors.base00}; background: ${accent}; } + &.plugged { + color: ${colors.base00}; + background: ${colors.base0D}; + } } @keyframes blink {