Skip to content

Commit

Permalink
Revert "ironbar: Add attempt at using volume module"
Browse files Browse the repository at this point in the history
The volume module currently has a bug that causes audio output to stop
working when plugging in new devices.

Upstream issue: JakeStanger/ironbar#673
  • Loading branch information
donovanglover committed Jul 22, 2024
1 parent eec082c commit a364b76
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 11 deletions.
2 changes: 1 addition & 1 deletion home/hyprland.nix
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ in
"${super}, S, swapactiveworkspaces, 0 1"
"${super}_SHIFT, S, movetoworkspace, special"
"${super}_SHIFT, A, exec, killall activate-linux || activate-linux -s 1.15 -x 412 -y 120 -c 1-1-1-0.05"
"${super}, O, exec, killall .ironbar-wrapper inotifywait || ironbar"
"${super}, O, exec, killall .ironbar-wrapper inotifywait pactl || ironbar"
"${super}_SHIFT, O, exec, eww close overlay || eww open overlay"
''${super}, comma, exec, playerctl -p mpv position "5-" && ${notifySend} "Minus 5 seconds" "$(playerctl -p mpv position)"''
''${super}, period, exec, playerctl -p mpv position "5+" && ${notifySend} "Plus 5 seconds" "$(playerctl -p mpv position)"''
Expand Down
43 changes: 33 additions & 10 deletions home/ironbar.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ let
inherit (builtins) toJSON;

mullvadScript = "ironbar/mullvad.fish";
volumeScript = "ironbar/volume.fish";
volumeGet = "ironbar/volume-get.fish";
in
{
home.packages = [ ironbar ];
Expand Down Expand Up @@ -46,8 +48,11 @@ in

end = [
{
type = "volume";
format = "{icon} {percentage}%";
type = "script";
cmd = "~/.config/${volumeScript}";
on_click_left = "swayosd-client --output-volume raise";
on_click_right = "swayosd-client --output-volume lower";
mode = "watch";
}
{
type = "upower";
Expand Down Expand Up @@ -98,14 +103,6 @@ in
padding-right: 0.7em;
}
slider {
background: #${base0D};
}
trough {
background: alpha(#${base04}, 0.4);
}
.upower {
padding-left: 0.2em;
padding-right: 0.2em;
Expand Down Expand Up @@ -245,4 +242,30 @@ in
end
'';
};

xdg.configFile.${volumeScript} = {
executable = true;
text = /* fish */ ''
#!/usr/bin/env fish
function get_volume
set VOLUME (wpctl get-volume @DEFAULT_AUDIO_SINK@ | choose 1)
echo "音量:$(math "$VOLUME * 100")%"
end
~/.config/${volumeGet}
pactl subscribe | grep --line-buffered -e "シンク" | xargs -L 1 ~/.config/${volumeGet}
'';
};

xdg.configFile.${volumeGet} = {
executable = true;
text = /* fish */ ''
#!/usr/bin/env fish
set VOLUME (wpctl get-volume @DEFAULT_AUDIO_SINK@ | choose 1)
echo "音量:$(math "$VOLUME * 100")%"
'';
};
}

0 comments on commit a364b76

Please sign in to comment.