#!/bin/bash # Prints out the volume percentage VOLUME_ON_ICON='' VOLUME_MUTED_ICON='' get_volume(){ active_sink=$(pactl list short sinks | sed -e 's,^\([0-9][0-9]*\)[^0-9].*,\1,' | head -n 1) curStatus=$(pactl get-sink-mute $active_sink) volume=$(pactl get-sink-volume $active_sink | tail -n 2 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,' | head -n 1) if [ "${curStatus}" = 'Mute: yes' ] then echo "$VOLUME_MUTED_ICON $volume%" else echo "$VOLUME_ON_ICON $volume%" fi } get_volume