Fixed internal options 2 and 3 for the internal temperature block, and

added examples to the README and config. Also removed whitespace in
README.
This commit is contained in:
NBonaparte 2016-05-14 18:22:35 -07:00
parent a681a25e59
commit d49de2cccc
3 changed files with 19 additions and 15 deletions

View file

@ -255,6 +255,8 @@ Yabar has a growing set of useful blocks. You can try out the sampe config locat
exec: "YABAR_THERMAL";
internal-option1: "thermal_zone0"; #i.e. Replace `NAME` with your corresponding name
internal-option2: "70 0xFFFFFFFF 0xFFED303C"; #Critical Temperature, fg, bg
internal-option3: "58 0xFFFFFFFF 0xFFF4A345"; #Warning Temperature, fg, bg
interval: 1;
* Brightness: It checks out the brightness value in the file `/sys/class/backlight/NAME/brightness`. Example:

View file

@ -70,6 +70,8 @@ bar1:{
background-color-rgb:0x309292;
underline-color-rgb:0xE08E79;
internal-option1: "thermal_zone0"; #Get NAME from /sys/class/NAME/temp
internal-option2: "70 0xFFFFFFFF 0xFFED303C"; #Critical Temperature, fg, bg
internal-option3: "58 0xFFFFFFFF 0xFFF4A345"; #Warning Temperature, fg, bg
internal-prefix: " ";
#internal-spacing: true;
}

View file

@ -113,13 +113,13 @@ void ya_int_thermal(ya_block_t *blk) {
snprintf(fpath, 128, "/sys/class/thermal/%s/temp", blk->internal->option[0]);
if((blk->internal->option[1]==NULL) ||
(sscanf(blk->internal->option[1], "%d %u %u", &crttemp, &crtfg, &crtbg)!=3)) {
(sscanf(blk->internal->option[1], "%d %x %x", &crttemp, &crtfg, &crtbg)!=3)) {
crttemp = 70;
crtbg = 0xFFED303C;
crtfg = blk->fgcolor;
}
if((blk->internal->option[2]==NULL) ||
(sscanf(blk->internal->option[2], "%d %u %u", &wrntemp, &wrnfg, &wrnbg)!=3)) {
(sscanf(blk->internal->option[2], "%d %x %x", &wrntemp, &wrnfg, &wrnbg)!=3)) {
wrntemp = 58;
wrnbg = 0xFFF4A345;
wrnfg = blk->fgcolor;