-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I3bar json #1690
I3bar json #1690
Conversation
block->short_text = short_text ? | ||
strdup(json_object_get_string(short_text)) : NULL; | ||
if (color) { | ||
block->color = malloc(sizeof(uint32_t)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allocating a single uint32_t?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah cause it can be NULL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0 != NULL in this case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think an accompanying "is_valid" bool would be more appropriate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nack
swaybar/i3bar.c
Outdated
json_object_object_add(event_json, "x", json_object_new_int(x)); | ||
json_object_object_add(event_json, "y", json_object_new_int(y)); | ||
|
||
char event_buf[1024]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could rid of the need for this by using dprintf instead.
dprintf(write_fd, "%s\n", json_object_to_json_string(event_json));
Crashes with my config:
|
Your config? |
i3status config: https://sr.ht/PHIw.config |
The blocks are printed in the reverse order. There's also this weird bug: when I put a space right after a FontAwesome icon, it prints an invalid 0x0020 codepoint. Any other character is fine. |
That 0x0020 thing is actually this bug https://bugs.archlinux.org/task/56899 |
woot |
Build failed |
Build unfailed |
Test plan:
Bonus: test click events by running the bar manually with
-d
and it'll log each block that's clicked.