mirror of
https://github.com/donovanglover/nix-config.git
synced 2025-01-24 14:48:37 +01:00
ironbar: Replace volume polling with watch script
Makes changes instantaneous and avoids polling.
This commit is contained in:
parent
a83409f8e6
commit
e0606c4590
@ -8,6 +8,8 @@ let
|
|||||||
|
|
||||||
mullvadScript = "ironbar/mullvad.fish";
|
mullvadScript = "ironbar/mullvad.fish";
|
||||||
mullvadNotification = "ironbar/mullvad-notification.fish";
|
mullvadNotification = "ironbar/mullvad-notification.fish";
|
||||||
|
volumeScript = "ironbar/volume.fish";
|
||||||
|
volumeGet = "ironbar/volume-get.fish";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
home.packages = [ ironbar ];
|
home.packages = [ ironbar ];
|
||||||
@ -51,9 +53,8 @@ in
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
type = "script";
|
type = "script";
|
||||||
cmd = "fish -c 'echo \"音量:$(math \"$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | choose 1) * 100\")%\"'";
|
cmd = "~/.config/${volumeScript}";
|
||||||
mode = "poll";
|
mode = "watch";
|
||||||
interval = 2500;
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
type = "clock";
|
type = "clock";
|
||||||
@ -239,4 +240,30 @@ in
|
|||||||
end
|
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")%"
|
||||||
|
'';
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user