From e763b564f0ac73ba5f6bfbb911447a56190cbc89 Mon Sep 17 00:00:00 2001 From: kiana-S Date: Thu, 13 Jun 2024 16:29:23 -0400 Subject: [PATCH] Add mute indicator to volume bar --- home-manager/wayland/hyprland.nix | 20 ++++++++++---------- home-manager/wayland/scripts/multimedia | 4 ++-- home-manager/wayland/wltools.nix | 9 +++++++-- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/home-manager/wayland/hyprland.nix b/home-manager/wayland/hyprland.nix index 7a06f9b..62eab56 100644 --- a/home-manager/wayland/hyprland.nix +++ b/home-manager/wayland/hyprland.nix @@ -16,7 +16,14 @@ in { plugins = with pkgs.hyprlandPlugins; [ hy3 ]; - settings = { + settings = let + # Volume using pamixer + audio-disp = "${scripts}/multimedia Volume $(pamixer --get-mute) pamixer $(pamixer --get-volume)"; + audio = cmd: "pamixer ${cmd} && ${audio-disp}"; + # Brightness using brightnessctl + brightness-disp = ''${scripts}/multimedia Brightness "" brightnessctl $(brightnessctl -e -m | cut -d, -f4 | tr -d "%")''; + brightness = x: "brightnessctl -e set ${x} && ${brightness-disp}"; + in { "$mod" = modifier; "$terminal" = terminal; "$menu" = "rofi -show drun"; @@ -152,7 +159,7 @@ in { bindl = [ # XF86 key bindings - ", XF86AudioMute, exec, pamixer --toggle-mute" + ", XF86AudioMute, exec, ${audio "--toggle-mute"}" ", XF86AudioMicMute, exec, pactl set-source-mute @DEFAULT_SOURCE@ toggle" ", XF86AudioPlay, exec, playerctl play-pause" ", XF86AudioNext, exec, playerctl next" @@ -163,14 +170,7 @@ in { "Shift, Print, exec, ${scripts}/screenshot-slurp" ]; - bindle = let - # Volume using pamixer - audio-disp = "${scripts}/multimedia Volume pamixer $(pamixer --get-volume)"; - audio = cmd: "pamixer ${cmd} && ${audio-disp}"; - # Brightness using brightnessctl - brightness-disp = ''${scripts}/multimedia Brightness brightnessctl $(brightnessctl -e -m | cut -d, -f4 | tr -d "%")''; - brightness = x: "brightnessctl -e set ${x} && ${brightness-disp}"; - in [ + bindle = [ # XF86 key bindings ", XF86AudioRaiseVolume, exec, ${audio "-i 2"}" ", XF86AudioLowerVolume, exec, ${audio "-d 2"}" diff --git a/home-manager/wayland/scripts/multimedia b/home-manager/wayland/scripts/multimedia index 82233b6..d55c3e4 100755 --- a/home-manager/wayland/scripts/multimedia +++ b/home-manager/wayland/scripts/multimedia @@ -1,4 +1,4 @@ #!/usr/bin/env bash -notify-send "$1" -c multimedia -a "$2" \ +notify-send "$1" "$2" -c multimedia -a "$3" \ $(makoctl list | jaq -r 'first(.data[][]|select(.category.data=="multimedia")|.id.data|["-r",.])[]') \ - -h "INT:value:$3" + -h "INT:value:$4" diff --git a/home-manager/wayland/wltools.nix b/home-manager/wayland/wltools.nix index c449328..7926f26 100644 --- a/home-manager/wayland/wltools.nix +++ b/home-manager/wayland/wltools.nix @@ -104,7 +104,7 @@ background-color=#1e0909d0 border-color=#ce7284 progress-color=source #bc5469 - border-size=3 + border-size=2 default-timeout=0 ignore-timeout=1 @@ -126,11 +126,16 @@ border-size=1 default-timeout=2000 - [category=multimedia app-name=pamixer] + [category=multimedia app-name=pamixer body=false] background-color=#111111c0 border-color=#787c99 progress-color=source #474f6f + [category=multimedia app-name=pamixer body=true] + background-color=#111111c0 + border-color=#ce7284 + progress-color=source #bc5469 + [category=multimedia app-name=brightnessctl] background-color=#111111c0 border-color=#ffea63