From 52b0261f2c738344d2a71ed0ec07f04746f7c9e5 Mon Sep 17 00:00:00 2001
From: Frost-Phoenix <67cyril6767@gmail.com>
Date: Sat, 13 Apr 2024 18:27:49 +0200
Subject: [PATCH] add battery indicator
---
modules/home/waybar/settings.nix | 16 +++++++++++++++-
modules/home/waybar/style.nix | 6 +++++-
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/modules/home/waybar/settings.nix b/modules/home/waybar/settings.nix
index 1aaeeeb..2a16dd8 100644
--- a/modules/home/waybar/settings.nix
+++ b/modules/home/waybar/settings.nix
@@ -21,11 +21,12 @@
"memory"
"disk"
"pulseaudio"
+ "battery"
"network"
];
clock= {
calendar = {
- format = { today = "{}"; };
+ format = { today = "{}"; };
};
format = " {:%H:%M}";
tooltip= "true";
@@ -91,6 +92,19 @@
scroll-step= 5;
on-click= "pamixer -t";
};
+ battery = {
+ format = "{icon} {capacity}% - {time}";
+ format-icons = ["" "" "" "" ""];
+ format-time = "{H}h{M}m";
+ format-charging = " {icon} {capacity}%";
+ format-full = " {icon} {capacity}%";
+ interval = 30;
+ states = {
+ warning = 20;
+ critical = 5;
+ };
+ tooltip-format = "Connected to {essid} {ifname} via {gwaddr}";
+ };
"custom/launcher"= {
format= "";
on-click= "pkill wofi || wofi --show drun";
diff --git a/modules/home/waybar/style.nix b/modules/home/waybar/style.nix
index db32a12..f34fd6b 100644
--- a/modules/home/waybar/style.nix
+++ b/modules/home/waybar/style.nix
@@ -45,7 +45,7 @@ in
color: #b4befe;
}
- #tray, #pulseaudio, #network, #cpu, #memory, #disk, #clock {
+ #tray, #pulseaudio, #network, #cpu, #memory, #disk, #clock, #battery {
font-size: ${custom.font_size};
color: ${custom.text_color};
}
@@ -74,6 +74,10 @@ in
padding-right: 9px;
margin-left: 7px;
}
+ #battery {
+ padding-left: 9px;
+ padding-right: 9px;
+ }
#network {
padding-left: 9px;
padding-right: 15px;