mirror of
https://github.com/FelixKratz/SketchyBar
synced 2024-11-23 03:43:02 +00:00
Add/fix "get space_icon_strip"
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.
This commit is contained in:
parent
95ac5d7164
commit
e2a53e513b
1 changed files with 13 additions and 4 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue