Add mute indicator to volume bar

This commit is contained in:
Kiana Sheibani 2024-06-13 16:29:23 -04:00
parent adebb3f76d
commit e763b564f0
3 changed files with 19 additions and 14 deletions

View file

@ -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"}"

View file

@ -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"

View file

@ -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