bin: move function from volume to helpers, add notifications to brightness
This commit is contained in:
parent
b95cfc47a4
commit
8708e3f6f5
3 changed files with 33 additions and 21 deletions
|
@ -11,22 +11,6 @@ VOL1="●"
|
|||
# echo -e '\u25cc'
|
||||
VOL2="◌"
|
||||
|
||||
function getProgressString() {
|
||||
ITEMS="$1" # The total number of items(the width of the bar)
|
||||
FILLED_ITEM="$2" # The look of a filled item
|
||||
NOT_FILLED_ITEM="$3" # The look of a not filled item
|
||||
STATUS="$4" # The current progress status in percent
|
||||
|
||||
# calculate how many items need to be filled and not filled
|
||||
FILLED_ITEMS=$(echo "((${ITEMS} * ${STATUS})/100 + 0.5) / 1" | bc)
|
||||
NOT_FILLED_ITEMS=$(echo "$ITEMS - $FILLED_ITEMS" | bc)
|
||||
|
||||
# Assemble the bar string
|
||||
msg=$(printf "%${FILLED_ITEMS}s" | sed "s| |${FILLED_ITEM}|g")
|
||||
msg=${msg}$(printf "%${NOT_FILLED_ITEMS}s" | sed "s| |${NOT_FILLED_ITEM}|g")
|
||||
echo "$msg"
|
||||
}
|
||||
|
||||
function notify() {
|
||||
VOLUME=$(pactl list sinks | grep "Name: $SINK" -A 8 | grep -oE '[0-9]*%' | head -n 1 | sed 's/%//')
|
||||
MUTE=$(pactl list sinks | grep "Name: $SINK" -A 8 | grep 'Mute:' | cut -d " " -f 2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue