From d331ae4e92aaafdd8871eb2b0a20ef393289876e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Fri, 5 Jul 2024 12:16:07 +0200 Subject: [PATCH] Fix volume interval waybar --- home/hyprland/waybar/default.nix | 175 ++++++++++++++++--------------- 1 file changed, 91 insertions(+), 84 deletions(-) diff --git a/home/hyprland/waybar/default.nix b/home/hyprland/waybar/default.nix index a63ba7b..494fe5b 100644 --- a/home/hyprland/waybar/default.nix +++ b/home/hyprland/waybar/default.nix @@ -156,91 +156,98 @@ in } ''; settings = [ - ({ - "layer" = "top"; - "position" = "top"; - modules-left = [ "custom/flakestat" ]; - modules-center = [ "hyprland/workspaces" ]; - modules-right = - [ - (lib.mkIf (withArrhist) "custom/arrhist") - "pulseaudio" - "pulseaudio#microphone" - "memory" - "cpu" - (lib.mkIf (withBattery) "battery") - "clock" - "tray" - ]; - "hyprland/workspaces" = { - "format" = "{name}"; - "on-click" = "activate"; - "on-scroll-up" = "hyprctl dispatch workspace e+1"; - "on-scroll-down" = "hyprctl dispatch workspace e-1"; - }; - "pulseaudio" = { - "scroll-step" = 5; - "format" = "{icon} {volume}%"; - "format-muted" = ""; - "format-icons" = { "default" = [ "" "" "" ]; }; - "on-click" = "pamixer -t"; - }; - "pulseaudio#microphone" = { - "format" = "{format_source}"; - "format-source" = " {volume}%"; - "format-source-muted" = ""; - "on-click" = "pamixer --default-source -t"; - "on-scroll-up" = "pamixer --default-source -i 5"; - "on-scroll-down" = "pamixer --default-source -d 5"; - "scroll-step" = 5; - "on-click-right" = "pavucontrol"; - }; - "clock" = { - "interval" = 1; - "format" = "{:%H:%M %A %b %d}"; - "tooltip" = true; - }; - "memory" = { - "interval" = 3; - "format" = " {percentage}%"; - "states" = { "warning" = 85; }; - }; - "cpu" = { - "interval" = 3; - "format" = " {usage}%"; - }; - "tray" = { - "icon-size" = 15; - "spacing" = 6; - }; - "battery" = { - "interval" = 60; - "states" = { - "warning" = 20; - "critical" = 5; + ( + let + volInterval = if (osConfig.system.name == "gunter") then "5" else "1"; + in + { + "layer" = "top"; + "position" = "top"; + modules-left = [ "custom/flakestat" ]; + modules-center = [ "hyprland/workspaces" ]; + modules-right = + [ + (lib.mkIf (withArrhist) "custom/arrhist") + "pulseaudio" + "pulseaudio#microphone" + "memory" + "cpu" + (lib.mkIf (withBattery) "battery") + "clock" + "tray" + ]; + "hyprland/workspaces" = { + "format" = "{name}"; + "on-click" = "activate"; + "on-scroll-up" = "hyprctl dispatch workspace e+1"; + "on-scroll-down" = "hyprctl dispatch workspace e-1"; }; - "format" = "{icon} {capacity}%"; - "format-icons" = [ - "" - "" - "" - "" - "" - ]; - }; - "custom/flakestat" = { - "exec" = "${flakestat}/bin/flakestat"; - "format" = " {}"; - "return-type" = "json"; - "interval" = 600; - }; - } // lib.optionalAttrs (withArrhist) { - "custom/arrhist" = { - "exec" = "${arrhist}/bin/arrhist"; - "return-type" = "json"; - "interval" = 600; - }; - }) + "pulseaudio" = { + "scroll-step" = 5; + "format" = "{icon} {volume}%"; + "format-muted" = ""; + "format-icons" = { "default" = [ "" "" "" ]; }; + "on-scroll-up" = "pamixer -i ${volInterval}"; + "on-scroll-down" = "pamixer -d ${volInterval}"; + "on-click" = "pamixer -t"; + }; + "pulseaudio#microphone" = { + "format" = "{format_source}"; + "format-source" = " {volume}%"; + "format-source-muted" = ""; + "on-click" = "pamixer --default-source -t"; + "on-scroll-up" = "pamixer --default-source -i ${volInterval}"; + "on-scroll-down" = "pamixer --default-source -d ${volInterval}"; + "scroll-step" = 5; + "on-click-right" = "pavucontrol"; + }; + "clock" = { + "interval" = 1; + "format" = "{:%H:%M %A %b %d}"; + "tooltip" = true; + }; + "memory" = { + "interval" = 3; + "format" = " {percentage}%"; + "states" = { "warning" = 85; }; + }; + "cpu" = { + "interval" = 3; + "format" = " {usage}%"; + }; + "tray" = { + "icon-size" = 15; + "spacing" = 6; + }; + "battery" = { + "interval" = 60; + "states" = { + "warning" = 20; + "critical" = 5; + }; + "format" = "{icon} {capacity}%"; + "format-icons" = [ + "" + "" + "" + "" + "" + ]; + }; + "custom/flakestat" = { + "exec" = "${flakestat}/bin/flakestat"; + "format" = " {}"; + "return-type" = "json"; + "interval" = 600; + }; + } // lib.optionalAttrs (withArrhist) { + "custom/arrhist" = { + "exec" = "${arrhist}/bin/arrhist"; + "return-type" = "json"; + "interval" = 600; + }; + } + ) ]; }; }