nix-dotfiles/scripts/changevolume.sh
vorboyvo 1c96195117 Edited changebrightness script to use new quasilinear (64 exp, 128 lin)
scale
Also added prototype changevolume script (not functional yet) and backup
changebrightness script because i've just left them out of the repo for
ages
2024-03-12 13:00:38 -04:00

24 lines
854 B
Bash

#!/bin/bash
# Usage: changevolume.sh <device> <-1|0|1>
# First argument: device as in wpctl, e.g. @DEFAULT_AUDIO_SINK@ or @DEFAULT_AUDIO_SOURCE@
# Second argument: reduce (-1), toggle mute (0), increase (1)
if [[ $2 -eq 0 ]] then
wpctl set-mute $1 toggle
if [[ -f $(which dunstify) ]] then
dunstify -a "changevolume.sh" -u low -i weather-clear -h string:x-dunst-stack-tag:changebrightness "Device $1 mute toggled"
fi
exit 0
fi
if [[ $2 -eq 1 ]] then
wpctl set-volume $1 0.05+
if [[ -f $(which dunstify) ]] then
dunstify -a "changevolume.sh" -u low -i weather-clear -h string:x-dunst-stack-tag:changebrightness "Device $1 mute toggled"
fi
fi
if [[ -f $(which dunstify) ]] then
dunstify -a "changevolume.sh" -u low -i audio-volume-medium -h string:x-dunst-stack-tag:changevolume $(wpctl get-volume $1)
fi