Skip to content
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

Fix some colour settings in swaybar #965

Merged
merged 4 commits into from
Nov 3, 2016

Conversation

thejan2009
Copy link
Contributor

This should fix #932 - if binding_mode colours are not defined, use urgent_workspace colours as a fallback.

Three missing settings were also implemented: focused_(workspace|statusline|separator)
They provide different colours for swaybar on the focused output.

D.B added 2 commits November 2, 2016 18:58
If these aren't defined in config, color settings without 'focused_'
prefix are used as a fallback.

bool has_binding_mode_border;
bool has_binding_mode_bg;
bool has_binding_mode_text;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any way we could encode these into the char arrays? i.e. "inherit" or something.

json_object_object_add(colors, "binding_mode_border", json_object_new_string(bar->colors.binding_mode_border));
} else {
json_object_object_add(colors, "binding_mode_border", json_object_new_string(bar->colors.urgent_workspace_border));
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does i3 do this, or why would you fall back to urgent_workspace_border ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit removes has_* booleans from bar color struct. It also
generalizes of functions in commands/bar/colors.c.
// every color has 9 characters plus \0
*name = malloc(10);
strcpy(*name, value);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about just using strdup everywhere instead of this function?

@minus7
Copy link
Contributor

minus7 commented Nov 3, 2016

Why not keep the static buffers? Is there any need for them to be dynamically allocated? color[0] == '\0' could be used as sentinel and it would still be possible to make it generic.

@ddevault
Copy link
Contributor

ddevault commented Nov 3, 2016

Putting them on the heap is a bit cleaner imo

@ddevault ddevault merged commit e9ac049 into swaywm:master Nov 3, 2016
@thejan2009 thejan2009 deleted the swaybar-colours branch November 5, 2016 10:52
@ddevault ddevault mentioned this pull request Dec 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Resize indicator looks different from i3
4 participants