From ce22e48484bbb8a1f3ac1ba042b1a170ff29cce1 Mon Sep 17 00:00:00 2001 From: Felix Van der Jeugt Date: Sun, 8 Mar 2015 22:16:03 +0100 Subject: [PATCH] xmobar - add quodlibet info/toggle and sound icon --- local/bin/quodinfo | 8 ++++++++ local/bin/soundinfo | 17 +++++++++++++++++ xmobar/icons/sound.xcf | Bin 0 -> 2284 bytes xmobar/icons/sound/high.xpm | 21 +++++++++++++++++++++ xmobar/icons/sound/low.xpm | 21 +++++++++++++++++++++ xmobar/icons/sound/medium.xpm | 21 +++++++++++++++++++++ xmobar/icons/sound/mute.xpm | 21 +++++++++++++++++++++ xmobar/icons/sound/none.xpm | 21 +++++++++++++++++++++ xmobarrc | 5 ++++- 9 files changed, 134 insertions(+), 1 deletion(-) create mode 100755 local/bin/quodinfo create mode 100755 local/bin/soundinfo create mode 100644 xmobar/icons/sound.xcf create mode 100644 xmobar/icons/sound/high.xpm create mode 100644 xmobar/icons/sound/low.xpm create mode 100644 xmobar/icons/sound/medium.xpm create mode 100644 xmobar/icons/sound/mute.xpm create mode 100644 xmobar/icons/sound/none.xpm diff --git a/local/bin/quodinfo b/local/bin/quodinfo new file mode 100755 index 0000000..beb56bd --- /dev/null +++ b/local/bin/quodinfo @@ -0,0 +1,8 @@ +#!/bin/bash + +status=$(quodlibet --status | cut -d' ' -f1) +case "$status" in + "playing") quodlibet --print-playing "" ;; + *) ;; +esac + diff --git a/local/bin/soundinfo b/local/bin/soundinfo new file mode 100755 index 0000000..4b1511e --- /dev/null +++ b/local/bin/soundinfo @@ -0,0 +1,17 @@ +#!/bin/bash + +if grep -q "\[on\]" <(amixer get Master); then + current="$(amixer get Master | sed -n '/%/s/.*\[\(.*\)%\].*/\1/p' | head -1)" + if (( current <= 25 )); then + echo "none" + elif (( current <= 50 )); then + echo "low" + elif (( current <= 75 )); then + echo "medium" + else + echo "high" + fi +else + echo "mute" +fi + diff --git a/xmobar/icons/sound.xcf b/xmobar/icons/sound.xcf new file mode 100644 index 0000000000000000000000000000000000000000..f442bab735329ccaadc71dae4cce4a9c2c22626a GIT binary patch literal 2284 zcmd5-y^hmB5FR_RV{!=`zd{0uEprkp;S}UELh_f&fk&Y#x>{=y!71eQYxQ-e; zc>_R-as#!GdJpxM#T0iF5g;|`f#l%e0wOY)@{)2rZEnsF{dziXtNoBwI zJ)qRH{A3>LREZhyg~szXqqR*psV;<0!?NDRG|{yIKF-u9OoqT>oZwOo->u6&!cE|MTr|$e{%pv^W$l6(m`hJ|9(s8=LdyfjK#Q$hP zjd%ZZ)8>Dn^~){qZIr+G>wYYOYcy|7nx*Ek?gF9w!@wGY+e8)$7mF7;xL=vr7Cff) ZLG^~v>+F_8=r@#X^m3a!{;(6V-vMbVoW1}6 literal 0 HcmV?d00001 diff --git a/xmobar/icons/sound/high.xpm b/xmobar/icons/sound/high.xpm new file mode 100644 index 0000000..c4fe06d --- /dev/null +++ b/xmobar/icons/sound/high.xpm @@ -0,0 +1,21 @@ +/* XPM */ +static char * high_xpm[] = { +"16 16 2 1", +" c None", +". c #FFFFFF", +" ", +" ", +" ", +" . . ", +" .. . . ", +" ... . . . ", +" ..... . . . ", +" ..... . . . ", +" ..... . . . ", +" ..... . . . ", +" ... . . . ", +" .. . . ", +" . . ", +" ", +" ", +" "}; diff --git a/xmobar/icons/sound/low.xpm b/xmobar/icons/sound/low.xpm new file mode 100644 index 0000000..201972a --- /dev/null +++ b/xmobar/icons/sound/low.xpm @@ -0,0 +1,21 @@ +/* XPM */ +static char * low_xpm[] = { +"16 16 2 1", +" c None", +". c #FFFFFF", +" ", +" ", +" ", +" . ", +" .. ", +" ... . ", +" ..... . ", +" ..... . ", +" ..... . ", +" ..... . ", +" ... . ", +" .. ", +" . ", +" ", +" ", +" "}; diff --git a/xmobar/icons/sound/medium.xpm b/xmobar/icons/sound/medium.xpm new file mode 100644 index 0000000..1c2bbb8 --- /dev/null +++ b/xmobar/icons/sound/medium.xpm @@ -0,0 +1,21 @@ +/* XPM */ +static char * medium_xpm[] = { +"16 16 2 1", +" c None", +". c #FFFFFF", +" ", +" ", +" ", +" . ", +" .. . ", +" ... . . ", +" ..... . . ", +" ..... . . ", +" ..... . . ", +" ..... . . ", +" ... . . ", +" .. . ", +" . ", +" ", +" ", +" "}; diff --git a/xmobar/icons/sound/mute.xpm b/xmobar/icons/sound/mute.xpm new file mode 100644 index 0000000..37305cb --- /dev/null +++ b/xmobar/icons/sound/mute.xpm @@ -0,0 +1,21 @@ +/* XPM */ +static char * mute_xpm[] = { +"16 16 2 1", +" c None", +". c #FFFFFF", +" ", +" ", +" ", +" . ", +" .. ", +" ... ", +" ..... . . ", +" ..... .. ", +" ..... .. ", +" ..... . . ", +" ... ", +" .. ", +" . ", +" ", +" ", +" "}; diff --git a/xmobar/icons/sound/none.xpm b/xmobar/icons/sound/none.xpm new file mode 100644 index 0000000..64d052b --- /dev/null +++ b/xmobar/icons/sound/none.xpm @@ -0,0 +1,21 @@ +/* XPM */ +static char * none_xpm[] = { +"16 16 2 1", +" c None", +". c #FFFFFF", +" ", +" ", +" ", +" . ", +" .. ", +" ... ", +" ..... ", +" ..... ", +" ..... ", +" ..... ", +" ... ", +" .. ", +" . ", +" ", +" ", +" "}; diff --git a/xmobarrc b/xmobarrc index 2bd8c29..a842c98 100644 --- a/xmobarrc +++ b/xmobarrc @@ -2,6 +2,7 @@ Config { font = "xft:Source Code Pro:size=9" , iconRoot = ".config/xmobar/icons" , commands = [ Run Date "%B, %a %0d, %l:%M" "date" 10 + --, Run Mpris2 "org.mpris.quodlibet" [] 100 , Run Battery [ "-t", "" , "--" @@ -32,7 +33,9 @@ Config { font = "xft:Source Code Pro:size=9" , "--load-icon-patterns", "" , "--load-icon-patterns", "" ] 50 + , Run Com "quodinfo" [] "quodlibet" 10 + , Run Com "soundinfo" [] "sound" 10 , Run StdinReader ] - , template = " %StdinReader% } %date% { %multicpu% %wlp7s0wi%%enp9s0%%bright%%battery% " + , template = " %StdinReader%} %date% {%quodlibet% %multicpu% %wlp7s0wi% %enp9s0% %bright% %battery% " }