2019-12-16 08:54:46 +01:00
|
|
|
{ pkgs, ... }:
|
2020-01-04 06:06:31 +01:00
|
|
|
let inherit (pkgs) alsaUtils bash gnugrep volnoti;
|
2020-06-17 22:23:37 +02:00
|
|
|
in pkgs.writeScript "volnoti.sh" ''
|
2019-12-16 08:54:46 +01:00
|
|
|
#!${bash}/bin/bash
|
|
|
|
|
|
|
|
declare -i current=$(${alsaUtils}/bin/amixer get Master | ${gnugrep}/bin/grep -m1 -Po "[0-9]+(?=%)")
|
|
|
|
if [[ $current -gt 100 ]]; then
|
|
|
|
current=100
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if ${alsaUtils}/bin/amixer get Master | ${gnugrep}/bin/grep -Fq "[off]"; then
|
|
|
|
${volnoti}/bin/volnoti-show -m $current
|
|
|
|
else
|
|
|
|
${volnoti}/bin/volnoti-show $current
|
|
|
|
fi
|
|
|
|
''
|