Skip to content

Commit

Permalink
Add/fix "get space_icon_strip"
Browse files Browse the repository at this point in the history
If no value given when calling `spacebar -m config space_icon_strip`,
print the current value.

Prints icon strip names delimited by spaces and surrounded with double
quotation marks, so it supports space names with spaces.
jraregris authored and cmacrae committed Nov 18, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 95ac5d7 commit e2a53e5
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/message.c
Original file line number Diff line number Diff line change
@@ -168,11 +168,20 @@ static void handle_domain_config(FILE *rsp, struct token domain, char *message)
} else if (token_equals(command, COMMAND_CONFIG_BAR_SPACE_STRIP)) {
char **icon_strip = NULL;
struct token token = get_token(&message);
while (token.text && token.length > 0) {
buf_push(icon_strip, token_to_string(token));
token = get_token(&message);

if(token.length==0){ // If no value given, print current value
fprintf(rsp, "\"%s\"", *g_bar_manager._space_icon_strip);
char **p = g_bar_manager._space_icon_strip;
for(int i = 1; i<buf_len(g_bar_manager.space_icon_strip);i++) {
fprintf(rsp, " \"%s\"", *++p);
}
} else { // Else, set value
while (token.text && token.length > 0) {
buf_push(icon_strip, token_to_string(token));
token = get_token(&message);
}
bar_manager_set_space_strip(&g_bar_manager, icon_strip);
}
bar_manager_set_space_strip(&g_bar_manager, icon_strip);
} else if (token_equals(command, COMMAND_CONFIG_BAR_POWER_STRIP)) {
char **icon_strip = NULL;
struct token token = get_token(&message);

0 comments on commit e2a53e5

Please sign in to comment.