Merge pull request #1297 from Molytho/master

Add spacing config option
This commit is contained in:
Alex 2021-10-22 11:02:53 +02:00 committed by GitHub
commit 562e4157c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 1 deletions

View File

@ -64,6 +64,10 @@ Also a minimal example configuration can be found on the at the bottom of this m
typeof: integer ++ typeof: integer ++
Margins value without units. Margins value without units.
*spacing* ++
typeof: integer ++
Size of gaps in between of the different modules.
*name* ++ *name* ++
typeof: string ++ typeof: string ++
Optional name added as a CSS class, for styling multiple waybars. Optional name added as a CSS class, for styling multiple waybars.

View File

@ -3,6 +3,7 @@
// "position": "bottom", // Waybar position (top|bottom|left|right) // "position": "bottom", // Waybar position (top|bottom|left|right)
"height": 30, // Waybar height (to be removed for auto height) "height": 30, // Waybar height (to be removed for auto height)
// "width": 1280, // Waybar width // "width": 1280, // Waybar width
"spacing": 4, // Gaps between modules (4px)
// Choose the order of the modules // Choose the order of the modules
"modules-left": ["sway/workspaces", "sway/mode", "custom/media"], "modules-left": ["sway/workspaces", "sway/mode", "custom/media"],
"modules-center": ["sway/window"], "modules-center": ["sway/window"],

View File

@ -80,7 +80,6 @@ window#waybar.chromium {
#idle_inhibitor, #idle_inhibitor,
#mpd { #mpd {
padding: 0 10px; padding: 0 10px;
margin: 0 4px;
color: #ffffff; color: #ffffff;
} }

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;