1
0
mirror of https://github.com/alrayyes/dotfiles/ synced 2023-11-14 15:56:30 +00:00
dotfiles/deadd/.local/bin/volume

36 lines
882 B
Plaintext
Raw Normal View History

#!/usr/bin/env bash
# This is a very hacky way of doing this. Default sink for desktop is 0 and for laptop is 3. Kies de eerste de beste die werkt
if pamixer --list-sinks | grep -q "^0"; then
sink=0
elif pamixer --list-sinks | grep -q "^3"; then
sink=3
fi
if [ "$1" == "inc" ]; then
pactl -- set-sink-volume "$sink" +5%
fi
if [ "$1" == "dec" ]; then
pactl -- set-sink-volume "$sink" -5%
fi
if [ "$1" == "mute" ]; then
pactl -- set-sink-mute "$sink" toggle
fi
VOLUME=$(pamixer --sink "$sink" --get-volume)
if [ "$(pamixer --sink "$sink" --get-mute)" == "true" ]; then
ICON=audio-volume-muted
elif [ "$VOLUME" -le 20 ]; then
ICON=audio-volume-low
elif [ "$VOLUME" -le 60 ]; then
ICON=audio-volume-medium
else
ICON=audio-volume-high
fi
notify-send.py "Volume" "$VOLUME/100" \
--hint string:image-path:$ICON boolean:transient:true \
--replaces-process "volume-popup" &