From 70f39d017bff6cf124ed38048239757656e53aeb Mon Sep 17 00:00:00 2001 From: Anthony Rodriguez Date: Sat, 16 Nov 2024 23:00:45 +0100 Subject: [PATCH] home/programs/ironbar: add swaync --- home/programs/ironbar/default.nix | 133 +++++++++++++++++++++++++++--- 1 file changed, 121 insertions(+), 12 deletions(-) diff --git a/home/programs/ironbar/default.nix b/home/programs/ironbar/default.nix index a45edc8..3bfce4f 100644 --- a/home/programs/ironbar/default.nix +++ b/home/programs/ironbar/default.nix @@ -1,36 +1,145 @@ -{inputs, ...}: { +{ + lib, + inputs, + pkgs, + ... +}: let + inherit (lib) mkForce; + icon_size = 28; +in { imports = [inputs.ironbar.homeManagerModules.default]; + home.packages = [pkgs.procps]; + services.swaync = { + enable = true; + settings = { + positionX = "right"; + positionY = "top"; + layer = "overlay"; + control-center-layer = "top"; + layer-shell = true; + cssPriority = "application"; + control-center-margin-top = 0; + control-center-margin-bottom = 0; + control-center-margin-right = 0; + control-center-margin-left = 0; + notification-2fa-action = true; + notification-inline-replies = false; + notification-icon-size = 64; + notification-body-image-height = 100; + notification-body-image-width = 200; + }; + }; + + systemd.user.services.swaync = { + Install.WantedBy = mkForce ["graphical-session.target"]; + Unit.ConditionEnvironment = mkForce ""; + Unit.PartOf = lib.mkForce ["graphical-session.target"]; + }; + programs.ironbar = { enable = true; systemd = true; config = { position = "top"; anchor_to_edges = true; + start = [ + { + bar = [ + { + label = ""; + name = "power-btn"; + on_click = "popup:toggle"; + type = "button"; + } + ]; + class = "power-menu"; + popup = [ + { + orientation = "vertical"; + type = "box"; + widgets = [ + { + label = "Power menu"; + name = "header"; + type = "label"; + } + { + type = "box"; + widgets = [ + { + class = "power-btn"; + label = ""; + on_click = "!shutdown now"; + type = "button"; + } + { + class = "power-btn"; + label = ""; + on_click = "!reboot"; + type = "button"; + } + ]; + } + { + label = "Uptime: {{30000:uptime -p | cut -d ' ' -f2-}}"; + name = "uptime"; + type = "label"; + } + ]; + } + ]; + tooltip = "Up: {{30000:uptime -p | cut -d ' ' -f2-}}"; + type = "custom"; + } + ]; center = [ { + inherit icon_size; type = "focused"; show_icon = true; show_title = true; - icon_size = 20; truncate = "end"; } ]; end = [ - {type = "volume";} + { + type = "upower"; + format = "{percentage}%"; + } + { + type = "volume"; + format = "{icon} {percentage}%"; + max_volume = 100; + icons = { + volume_high = "󰕾"; + volume_medium = "󰖀"; + volume_low = "󰕿"; + muted = "󰝟"; + }; + } {type = "clock";} - {type = "tray";} + { + type = "tray"; + inherit icon_size; + } + { + type = "notifications"; + "show_count" = true; + icons = { + "closed_none" = "󰍥"; + "closed_some" = "󱥂"; + "closed_dnd" = "󱅯"; + "open_none" = "󰍡"; + "open_some" = "󱥁"; + "open_dnd" = "󱅮"; + }; + } ]; }; style = '' - .tray { - margin-top: 5px; - padding: 10px; - border-radius: 50px; - } .tray .item { - border-radius: 50px; - min-height: 25px; - padding: 0; + min-width: 40px; + } ''; }; }