From 47b6742a0b5a28defd0834d259e74fe0d6d321fc Mon Sep 17 00:00:00 2001 From: Riyyi Date: Fri, 3 May 2019 02:16:19 +0200 Subject: [PATCH] Add brightnesscontrol getbrightness --- .scripts/brightnesscontrol.sh | 3 +++ .scripts/panel/brightness.sh | 5 ++--- .scripts/panel/volume.sh | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.scripts/brightnesscontrol.sh b/.scripts/brightnesscontrol.sh index d8974d7..f977304 100755 --- a/.scripts/brightnesscontrol.sh +++ b/.scripts/brightnesscontrol.sh @@ -29,6 +29,8 @@ ${B}COMMANDS${N} ${B}d*, down ${N} ${B}s*, set ${N} + + ${B}g*, getbrightness${N} EOF } @@ -36,5 +38,6 @@ case "$1" in u*) brightnessctl -q s +"$NUM"% ; $RELOAD ;; d*) brightnessctl -q s "$NUM"%- ; $RELOAD ;; s*) brightnessctl -q s "$NUM"% ; $RELOAD ;; + g*) brightnessctl | awk '/%/ {print substr($4, 2, length($4) - 3)}' ;; *) help ;; esac diff --git a/.scripts/panel/brightness.sh b/.scripts/panel/brightness.sh index 8868b0f..ab5ffe5 100755 --- a/.scripts/panel/brightness.sh +++ b/.scripts/panel/brightness.sh @@ -7,8 +7,7 @@ R="A3:$BRIGHTNESS_CONTROL s 30:" U="A4:$BRIGHTNESS_CONTROL u 10:" D="A5:$BRIGHTNESS_CONTROL d 10:" -PERCENTAGE=$(brightnessctl \ - | awk '/\([0-9]+%\)/ { print substr($4, 2, length($4) - 3) }') +PERCENTAGE=$($BRIGHTNESS_CONTROL getbrightness) if [ "$PERCENTAGE" -ge "75" ]; then ICON="" # f111 elif [ "$PERCENTAGE" -ge "25" ]; then @@ -20,6 +19,6 @@ fi INPUT="%{$R}%{$U}%{$D}" END="%{A}%{A}%{A}" -PIPE="$($(dirname $0)/lemonbar.sh getpipe)" +PIPE="$("$(dirname "$0")"/lemonbar.sh getpipe)" printf "%s\n" "brightness$INPUT$ICON $PERCENTAGE%$END" > "$PIPE" & diff --git a/.scripts/panel/volume.sh b/.scripts/panel/volume.sh index 256cf57..6fafc39 100755 --- a/.scripts/panel/volume.sh +++ b/.scripts/panel/volume.sh @@ -30,6 +30,6 @@ fi INPUT="%{$L}%{$S}%{$R}%{$U}%{$D}" END="%{A}%{A}%{A}%{A}%{A}" -PIPE="$($(dirname $0)/lemonbar.sh getpipe)" +PIPE="$("$(dirname "$0")"/lemonbar.sh getpipe)" printf "%s\n" "volume%{F$COLOR}$INPUT$SYMBOL $VOLUME%$END%{F-}" > "$PIPE" &