Add spacing config option

This option allows to add spaces between the modules. It uses Gtk:Box's spacing property.
This commit is contained in:
Robin Ebert 2021-10-20 11:11:49 +02:00
parent 6eb9606f23
commit 0b66454d5c
No known key found for this signature in database
GPG Key ID: 8B6531570DC10850
1 changed files with 7 additions and 0 deletions

View File

@ -438,6 +438,13 @@ waybar::Bar::Bar(struct waybar_output* w_output, const Json::Value& w_config)
center_.get_style_context()->add_class("modules-center"); center_.get_style_context()->add_class("modules-center");
right_.get_style_context()->add_class("modules-right"); right_.get_style_context()->add_class("modules-right");
if (config["spacing"].isInt()) {
int spacing = config["spacing"].asInt();
left_.set_spacing(spacing);
center_.set_spacing(spacing);
right_.set_spacing(spacing);
}
uint32_t height = config["height"].isUInt() ? config["height"].asUInt() : 0; uint32_t height = config["height"].isUInt() ? config["height"].asUInt() : 0;
uint32_t width = config["width"].isUInt() ? config["width"].asUInt() : 0; uint32_t width = config["width"].isUInt() ? config["width"].asUInt() : 0;