aboutsummaryrefslogtreecommitdiffstats
path: root/modules/volume
diff options
context:
space:
mode:
authorLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2022-02-26 20:31:12 +0530
committerLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2022-02-26 20:31:12 +0530
commit85ae438fbc238fe56bcb1c10a12ec52365053cb6 (patch)
tree7aa2c802739657f22fd8de735207b27fc6e7e8a9 /modules/volume
downloaddwmbar-85ae438fbc238fe56bcb1c10a12ec52365053cb6.tar.gz
dwmbar-85ae438fbc238fe56bcb1c10a12ec52365053cb6.tar.bz2
dwmbar-85ae438fbc238fe56bcb1c10a12ec52365053cb6.zip
dwmbar dotfiles
Diffstat (limited to 'modules/volume')
-rwxr-xr-xmodules/volume20
1 files changed, 20 insertions, 0 deletions
diff --git a/modules/volume b/modules/volume
new file mode 100755
index 0000000..6b5b96e
--- /dev/null
+++ b/modules/volume
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+# Prints out the volume percentage
+
+VOLUME_ON_ICON=''
+VOLUME_MUTED_ICON=''
+
+get_volume(){
+ curStatus=$(pactl get-sink-mute @DEFAULT_SINK@)
+ volume=$(pactl get-sink-volume @DEFAULT_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