nixos-config/modules/workspace/i3blocks/scripts/sound.nix

33 lines
745 B
Nix
Raw Normal View History

2020-08-04 22:52:30 +04:00
{ pamixer, lxqt, iconfont, config, lib, ... }: ''
2020-02-17 17:00:59 +04:00
case $BLOCK_BUTTON in
2) ${pamixer}/bin/pamixer -t;;
4) ${pamixer}/bin/pamixer -i 5;;
5) ${pamixer}/bin/pamixer -d 5;;
esac
code=0
if [[ `${pamixer}/bin/pamixer --get-mute` = "true" ]]
then
volume=""
end=""
2020-07-27 01:16:19 +04:00
icon=""
2020-02-17 17:00:59 +04:00
else
volume=`${pamixer}/bin/pamixer --get-volume`
end="%"
if [[ $volume -lt 33 ]]
then
2020-07-27 01:16:19 +04:00
icon=""
2020-02-17 17:00:59 +04:00
else
if [[ $volume -lt 66 ]]
then
2020-07-27 01:16:19 +04:00
icon="奔"
2020-02-17 17:00:59 +04:00
else
2020-07-27 01:16:19 +04:00
icon=""
2020-02-17 17:00:59 +04:00
code=33
fi
fi
fi
2020-08-04 22:52:30 +04:00
${lib.optionalString (! config.deviceSpecific.bigScreen) "[[ -n $BLOCK_BUTTON ]] &&"} text=" $volume$end"
2020-02-17 17:00:59 +04:00
echo "<span font='${iconfont}'>$icon</span>$text"
exit $code
''