dwmblocks script error
by charbelsako from LinuxQuestions.org on (#5A0EM)
I recently got dwmblocks and wrote 2 scripts for volume and brightness but I can't see the values in the status bar.
Here are the scripts
volume:
-------
#! /bin/bash
echo "hello"
exit
case $BLOCK_BUTTON in
1) pactl set-sink-mute 0 toggle
esac
vol=$(pactl list sinks | grep '^[[:space:]]Volume:' | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,')
printf "%s%%" "$vol"
brightness:
-----------
#! /bin/bash
brightness=$(xbacklight -get)
printf "%i%%" "$brightness"
the files work by themselves but don't show up in dwmblocks. I have also added the files' location to the PATH variable
Finally here's my blocks.h file
blocks.h:
---------
//Modify this file to change what commands output to your statusbar, and recompile using the make command.
static const Block blocks[] = {
/*Icon*//*Command*//*Update Interval*//*Update Signal*/
{"Mem:", "free -h | awk '/^Mem/ { print $3"/"$2 }' | sed s/i//g",30,0},
{"", "date '+%a %b %d %I:%M%p'",5,0},
{"VOL:", "volume", 1, 0},
{"Brightness: ", "brightness", 5, 0}
};
//sets delimeter between status commands. NULL character ('\0') means no delimeter.
static char delim[] = " | ";
static unsigned int delimLen = 5;
I also would like to know what values should I set for updateinterval and updatesignal as there is no documentation for them
If you want more info I do have an image of my status bar. Just tell me where i can upload it?


Here are the scripts
volume:
-------
#! /bin/bash
echo "hello"
exit
case $BLOCK_BUTTON in
1) pactl set-sink-mute 0 toggle
esac
vol=$(pactl list sinks | grep '^[[:space:]]Volume:' | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,')
printf "%s%%" "$vol"
brightness:
-----------
#! /bin/bash
brightness=$(xbacklight -get)
printf "%i%%" "$brightness"
the files work by themselves but don't show up in dwmblocks. I have also added the files' location to the PATH variable
Finally here's my blocks.h file
blocks.h:
---------
//Modify this file to change what commands output to your statusbar, and recompile using the make command.
static const Block blocks[] = {
/*Icon*//*Command*//*Update Interval*//*Update Signal*/
{"Mem:", "free -h | awk '/^Mem/ { print $3"/"$2 }' | sed s/i//g",30,0},
{"", "date '+%a %b %d %I:%M%p'",5,0},
{"VOL:", "volume", 1, 0},
{"Brightness: ", "brightness", 5, 0}
};
//sets delimeter between status commands. NULL character ('\0') means no delimeter.
static char delim[] = " | ";
static unsigned int delimLen = 5;
I also would like to know what values should I set for updateinterval and updatesignal as there is no documentation for them
If you want more info I do have an image of my status bar. Just tell me where i can upload it?