dotfiles

Configuration for the software I use.
git clone https://git.sr.ht/~jbauer/dotfiles
Log | Files | Refs | README | LICENSE

commit 194e6795f1ca4570b76789cadcc7d7122dddc64c
parent 1a87f3ee98aa87111a47ad02b89c9d3d1d50a85b
Author: Jake Bauer <jbauer@paritybit.ca>
Date:   Fri, 21 May 2021 00:32:04 -0400

Overhaul change-volume for OpenBSD

Diffstat:
M.local/bin/change-volume | 25++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/.local/bin/change-volume b/.local/bin/change-volume @@ -5,13 +5,28 @@ msgId="509842" # Set the volume based on args given -amixer set Master "$@" > /dev/null +if [ "$1" = "up" ]; then + sndioctl output.level=+0.05 +elif [ "$1" = "down" ]; then + sndioctl output.level=-0.05 +elif [ "$(sndioctl output.mute | cut -d= -f2)" -eq 0 ]; then + sndioctl output.mute=1 + muted=1 +else + sndioctl output.mute=0 +fi + +volume=$(sndioctl output.level | cut -d= -f2) -# Query amixer for the current volume and whether or not the speaker is muted -volume="$(amixer get Master | tail -1 | awk '{print $5}' | sed 's/[^0-9]*//g')" -online="$(amixer get Master | tail -1 | awk '{print $NF}' | sed 's/[^a-z]*//g')" +if [ "$volume" = "1.000" ]; then + volume=100 +else + volume=$(echo "$volume" | cut -d. -f2) + volume=$(($volume/10)) + echo "$volume" +fi -if [ "$volume" -eq 0 ] || [ "$online" = "off" ]; then +if [ "$muted" -eq 1 ]; then # Show the sound muted notification dunstify -a "changeVolume" -u low -i audio-volume-muted -r "$msgId" \ "Volume muted"