#!/bin/bash # Launches a yad window to change the brightness (or volume, not in use) panel_fifo="/tmp/i3_lemonbar1_${USER}" panel_commands="/tmp/i3_lemonbar2_${USER}" if [ "$1" == "-b" ]; then CLASS="YADWINBR" ICON='☼' COLOR='yellow' elif [ "$1" == "-v" ]; then CLASS="YADWINV" ICON='🔈' COLOR='white' else exit 1 fi LEVEL=$(bc <<< "scale=0; $(brillo -G)/1") [[ "$3" == "-t" ]] && TIMER="--timeout=1" declare -a YADARGS=("--sticky" "--undecorated" "--on-top" "--class=$CLASS" "--scale" "--text='$ICON'" "--value" "$LEVEL" "--no-buttons" "--geometry=15x150" "--vertical" "--text-align" "center" "$TIMER" "--print-partial") YARGS=${YADARGS[@]} FIFO="$2" (echo "kill_unfocus $BASHPID" > $FIFO; exec sh -c "yad $YARGS") | \ while read out; do ~/.i3/scripts/level.sh -b set $out done