Switch to SwayFX
This commit is contained in:
parent
6571feaff7
commit
c310042564
41 changed files with 1450 additions and 294 deletions
65
hosts/totsugeki/home-manager/scripts/volumectl.nix
Normal file
65
hosts/totsugeki/home-manager/scripts/volumectl.nix
Normal file
|
@ -0,0 +1,65 @@
|
|||
{ pkgs }:
|
||||
pkgs.writeShellApplication {
|
||||
name = "volumectl";
|
||||
runtimeInputs = with pkgs; [ dunst pamixer ];
|
||||
text = ''
|
||||
VOLUME_REGEX="^(-*|\+*)[0-9]+$"
|
||||
volume=""
|
||||
|
||||
if [ "$1" == "output" ]; then
|
||||
if [[ "$2" =~ $VOLUME_REGEX ]]; then
|
||||
if [ "$(pamixer --get-mute)" == "true" ]; then
|
||||
pamixer --unmute > /dev/null
|
||||
fi
|
||||
if [ "''${2:0:1}" == "-" ]; then
|
||||
pamixer --allow-boost -d "''${2:1}" > /dev/null
|
||||
elif [ "''${2:0:1}" == "+" ]; then
|
||||
pamixer --allow-boost -i "''${2:1}" > /dev/null
|
||||
fi
|
||||
volume="$(pamixer --get-volume-human)"
|
||||
message=" $volume"
|
||||
elif [ "$2" == "toggle-mute" ]; then
|
||||
if [ "$(pamixer --get-mute)" == "true" ]; then
|
||||
pamixer --unmute > /dev/null
|
||||
volume="$(pamixer --get-volume-human)"
|
||||
message=" $volume"
|
||||
else
|
||||
pamixer --mute > /dev/null
|
||||
message=" Silenciado"
|
||||
fi
|
||||
else
|
||||
message="volumectl error: Unknown second argument"
|
||||
fi
|
||||
elif [ "$1" == "input" ]; then
|
||||
if [[ "$2" =~ $VOLUME_REGEX ]]; then
|
||||
if [ "$(pamixer --default-source --get-mute)" == "true" ]; then
|
||||
pamixer --default-source --unmute > /dev/null
|
||||
fi
|
||||
if [ "''${2:0:1}" == "-" ];then
|
||||
pamixer --default-source --allow-boost -d "''${2:1}" > /dev/null
|
||||
elif [ "''${2:0:1}" == "+" ]; then
|
||||
pamixer --default-source --allow-boost -i "''${2:1}" > /dev/null
|
||||
fi
|
||||
volume="$(pamixer --default-source --get-volume-human)"
|
||||
message=" $volume"
|
||||
elif [ "$2" == "toggle-mute" ]; then
|
||||
if [ "$(pamixer --default-source --get-mute)" == "true" ]; then
|
||||
pamixer --default-source --unmute > /dev/null
|
||||
volume="$(pamixer --default-source --get-volume-human)"
|
||||
message=" $volume"
|
||||
else
|
||||
pamixer --default-source --mute > /dev/null
|
||||
message=" Silenciado"
|
||||
fi
|
||||
else
|
||||
message="volumectl error: Unknown second argument"
|
||||
fi
|
||||
else
|
||||
message="volumectl error: Unknown first argument"
|
||||
fi
|
||||
|
||||
volume="$(echo "$volume" | tr -d "%")"
|
||||
|
||||
dunstify --appname "volumectl" --replace 9001 --urgency low --timeout 1250 --hints "int:value:$volume" "$message"
|
||||
'';
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue