about summary refs log tree commit diff stats
path: root/hm/waybar/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'hm/waybar/default.nix')
-rw-r--r--hm/waybar/default.nix83
1 files changed, 72 insertions, 11 deletions
diff --git a/hm/waybar/default.nix b/hm/waybar/default.nix
index 18b659c..335bdc9 100644
--- a/hm/waybar/default.nix
+++ b/hm/waybar/default.nix
@@ -5,9 +5,19 @@
       mainBar = {
         layer = "top";
         position = "top";
-        modules-left = ["hyprland/workspaces" "clock"];
+        modules-left = [
+          "hyprland/workspaces"
+          "clock"
+        ];
         modules-center = ["hyprland/window"];
-        modules-right = ["pulseaudio" "network" "backlight" "battery" "tray"];
+        modules-right = [
+          "pulseaudio"
+          "network"
+          "backlight"
+          "battery"
+          "custom/notification"
+          "tray"
+        ];
 
         "hyprland/workspaces" = {
           disable-scroll = false;
@@ -27,7 +37,11 @@
         pulseaudio = {
           format = " {icon} ";
           format-muted = "ﱝ";
-          format-icons = ["奄" "奔" "墳"];
+          format-icons = [
+            "奄"
+            "奔"
+            "墳"
+          ];
           tooltip = true;
           tooltip-format = "{volume}%";
         };
@@ -43,7 +57,17 @@
         backlight = {
           device = "intel_backlight";
           format = "{icon}";
-          format-icons = ["" "" "" "" "" "" "" "" ""];
+          format-icons = [
+            ""
+            ""
+            ""
+            ""
+            ""
+            ""
+            ""
+            ""
+            ""
+          ];
           tooltip = true;
           tooltip-format = "{percent}%";
         };
@@ -53,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}%";
         };
@@ -71,15 +114,33 @@
           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 = {
-          icon-size = 21;
-          spacing = 10;
+          icon-size = 10;
+          spacing = 5;
+        };
+        "custom/notification" = {
+          tooltip = false;
+          format = "{icon}";
+          format-icons = {
+            notification = " ";
+            none = " ";
+            dnd-notification = " ";
+            dnd-none = " ";
+            inhibited-notification = " ";
+            inhibited-none = " ";
+            dnd-inhibited-notification = " ";
+            dnd-inhibited-none = " ";
+          };
+          return-type = "json";
+          exec-if = "which swaync-client";
+          exec = "swaync-client -swb";
+          on-click = "swaync-client -t -sw";
+          on-click-right = "swaync-client -d -sw";
+          escape = true;
         };
       };
     };