You are not logged in.
So I'm trying to configure i3 with conky and want to know if my volume is on or not. The JSON I'm using is
{"full_text": ${if_match ${exec amixer get Master | grep "%" | cut -d' ' -f8}=[off]}"OFF" ,"color":"\#dc322f"},
{"full_text": "${else}"},
{"full_text": ${if_match ${exec amixer get Master | grep "%" | cut -d' ' -f8}=[on]}"ON" ,"color":"\#dc322f"},
{"full_text": "${endif}${endif}"},But no matter what the value is the first satement (OFF) is only showed. What am I doing wrong with the if satement?
SOLUTION:
from man conky:
... if_match expression ... stringArgument is enclosed in quotation marks (") Valid operands are: '>', '<', '>=', '<=', '==', '!='. ...so the ${if_match} statement in your code should look like this:
${if_match "${exec amixer get Master | sed -n '/%/s/^.*\[\(.*\)\]$/\1/gp'}" == "off"} ... ${else} ${if_match "${exec amixer get Master | sed -n '/%/s/^.*\[\(.*\)\]$/\1/gp'}" == "on"} ... ${endif} ${endif}HTH.
Last edited by Mapl3 (2015-01-27 00:20:43)
Offline
from man conky:
...
if_match expression
...
stringArgument is enclosed in quotation marks (")
Valid operands are: '>', '<', '>=', '<=', '==', '!='.
...so the ${if_match} statement in your code should look like this:
${if_match "${exec amixer get Master | sed -n '/%/s/^.*\[\(.*\)\]$/\1/gp'}" == "off"}
...
${else}
${if_match "${exec amixer get Master | sed -n '/%/s/^.*\[\(.*\)\]$/\1/gp'}" == "on"}
...
${endif}
${endif}HTH.
Last edited by saf1 (2015-01-26 22:08:05)
Offline
from man conky:
... if_match expression ... stringArgument is enclosed in quotation marks (") Valid operands are: '>', '<', '>=', '<=', '==', '!='. ...so the ${if_match} statement in your code should look like this:
${if_match "${exec amixer get Master | sed -n '/%/s/^.*\[\(.*\)\]$/\1/gp'}" == "off"} ... ${else} ${if_match "${exec amixer get Master | sed -n '/%/s/^.*\[\(.*\)\]$/\1/gp'}" == "on"} ... ${endif} ${endif}HTH.
Worked like a charm. Though I did try with '=='.
Offline