Browse Source

Add brightnesscontrol getbrightness

master
Riyyi 6 years ago
parent
commit
47b6742a0b
  1. 3
      .scripts/brightnesscontrol.sh
  2. 5
      .scripts/panel/brightness.sh
  3. 2
      .scripts/panel/volume.sh

3
.scripts/brightnesscontrol.sh

@ -29,6 +29,8 @@ ${B}COMMANDS${N}
${B}d*, down <amount>${N}
${B}s*, set <volume>${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

5
.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" &

2
.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" &

Loading…
Cancel
Save