From 7b473511a1c30b0507c6b8326cc45906fcad9a1c Mon Sep 17 00:00:00 2001 From: Alexander Rosenberg Date: Sat, 24 Aug 2024 16:49:55 -0700 Subject: [PATCH] Update sound and brightness scripts --- brightness-control.sh | 8 ++++++++ sound-control.sh | 4 +--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/brightness-control.sh b/brightness-control.sh index f6f6011..19565b4 100755 --- a/brightness-control.sh +++ b/brightness-control.sh @@ -2,7 +2,10 @@ SAVE_FILE="${HOME}/.cache/brightness-control-cache" +let really_notify=1 + notify-brightness() { + ((${really_notify})) || return brightness="$(brightnessctl -m | sed 's/,/ /g' | awk '{print $4}' | tr -d '\n' | tr -d '%')" notify-send -h string:x-canonical-private-synchronous:brightness-control-sh -t 4000 -u normal -a "Brightness" -h int:value:"$brightness" "$brightness%" } @@ -30,6 +33,11 @@ if [ "$#" -lt 1 ]; then print-usage fi +if [[ "${1}" == -n ]]; then + really_notify=0 + shift 1 +fi + ammount='5%' value='50%' if [ "${#}" -gt 1 ]; then diff --git a/sound-control.sh b/sound-control.sh index af7545f..593e963 100755 --- a/sound-control.sh +++ b/sound-control.sh @@ -19,9 +19,7 @@ function print_help { let notify=1 function notify_vol { - if ! ((${notify})); then - return - fi + ((${notify})) || return let vol="$(pamixer --get-volume)" local icon if [[ "$(pamixer --get-mute)" == 'true' ]]; then