consolidated update-bl and update-vol into update

This commit is contained in:
Josh Ashton
2024-02-12 12:27:06 -07:00
parent b7b93f7a43
commit a1820e4807
3 changed files with 84 additions and 44 deletions
-22
View File
@@ -1,22 +0,0 @@
#!/bin/zsh
tail -f ~/.config/xob/xobpipe | xob -s volume &
if [[ $# -eq 2 ]]; then
CHANGE=$1
TARGET_FILE=$2
elif [[ $# -eq 3 ]]; then
CHANGE=`expr 0 - $2`
TARGET_FILE=$3
else
echo "Improper usage. To increase a value in a file,\nupdate-bl [change] [target_file]."
echo "To decrease a value in a file,\nupdate-bl --decrease [change] [target_file]."
fi
OLDNUM=`cut -f1 $TARGET_FILE`
NEWNUM=`expr $OLDNUM + $CHANGE`
if [[ $NEWNUM -le 100 && $NEWNUM -ge 0 ]]; then
sed -i "s/$OLDNUM/$NEWNUM/g" $TARGET_FILE
brightnessctl set $NEWNUM%
echo $NEWNUM >> ~/.config/xob/xobpipe
fi