[rc] add volume-info script for displaying volume in bar
authorAmin Bandali <amin@aminb.org>
Tue, 24 Jul 2018 21:13:58 +0000 (17:13 -0400)
committerAmin Bandali <amin@aminb.org>
Tue, 24 Jul 2018 21:13:58 +0000 (17:13 -0400)
rc.org

diff --git a/rc.org b/rc.org
index de4435a..e787d8b 100644 (file)
--- a/rc.org
+++ b/rc.org
@@ -772,6 +772,11 @@ borders_color=#3D9970
 #title=<span weight='heavy' fgcolor='#01FF70'> </span>
 #borders_color=#01FF70
 
 #title=<span weight='heavy' fgcolor='#01FF70'> </span>
 #borders_color=#01FF70
 
+[volume]
+command=volume-info
+title=<span weight='heavy' fgcolor='#7FDBFF'></span>
+borders_color=#7FDBFF
+
 [battery]
 preset=BAT
 command=battery-percentage-time
 [battery]
 preset=BAT
 command=battery-percentage-time
@@ -5039,6 +5044,21 @@ import gnomekeyring as gk
 gk.unlock_sync('Default_keyring',gk.item_get_info_sync('login',1L).get_secret())
 #+end_src
 
 gk.unlock_sync('Default_keyring',gk.item_get_info_sync('login',1L).get_secret())
 #+end_src
 
+** volume-info
+:PROPERTIES:
+:header-args+: :tangle ~/.local/bin/volume-info :shebang "#!/bin/sh"
+:END:
+
+#+begin_src sh
+cur_vol=$(pamixer --get-volume)
+
+if [ $(pamixer --get-mute) = true ]; then
+  printf 'mt \n' "$cur_vol"
+else
+  printf '%02d \n' "$cur_vol"
+fi
+#+end_src
+
 ** wp
 
 My little wallpaper changer script.
 ** wp
 
 My little wallpaper changer script.