feat: work configuration

This commit is contained in:
aduhayon 2022-07-20 09:14:11 +02:00
parent 4fe55fe2e1
commit 4e1425e61d
23 changed files with 1150 additions and 71 deletions

View file

@ -1,21 +1,25 @@
#!/usr/bin/bash
#!/bin/bash
set -e
CUR="$(pactl get-sink-volume 0 | awk '$1 == "Volume:" {print substr($5, 1, length($5) - 1)}')"
SHIFT="${1}"
CUR_FILE=/var/tmp/current_volume
set +e
CUR="$(cat "$CUR_FILE" || echo 50)"
set -e
case "${1:0:1}" in
'')
exit 1
;;
'+'|'-')
NEW="$((CUR - CUR % SHIFT + SHIFT))"
NEW="$((CUR + "$1"))"
;;
*)
NEW="$1"
;;
esac
[ "$NEW" -lt 0 ] && NEW=0
[ "$NEW" -gt 100 ] && NEW=100
pactl set-sink-volume 0 "$NEW"%