make i3bar work with tree branch again (current_workspace is a string now)
This commit is contained in:
parent
a88f7fb392
commit
3de12beef6
|
@ -11,6 +11,7 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <i3/ipc.h>
|
||||
#include <yajl/yajl_parse.h>
|
||||
|
||||
|
@ -102,6 +103,22 @@ static int outputs_integer_cb(void *params_, long val) {
|
|||
static int outputs_string_cb(void *params_, const unsigned char *val, unsigned int len) {
|
||||
struct outputs_json_params *params = (struct outputs_json_params*) params_;
|
||||
|
||||
if (!strcmp(params->cur_key, "current_workspace")) {
|
||||
char *copy = malloc(sizeof(const unsigned char) * (len + 1));
|
||||
strncpy(copy, (const char*) val, len);
|
||||
copy[len] = '\0';
|
||||
|
||||
char *end;
|
||||
errno = 0;
|
||||
long parsed_num = strtol(copy, &end, 10);
|
||||
if (errno == 0 &&
|
||||
(end && *end == '\0'))
|
||||
params->outputs_walk->ws = parsed_num;
|
||||
free(copy);
|
||||
FREE(params->cur_key);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (strcmp(params->cur_key, "name")) {
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue