From 0b66454d5c9cf526b889d16cd656cd2c4834c7ee Mon Sep 17 00:00:00 2001 From: Robin Ebert Date: Wed, 20 Oct 2021 11:11:49 +0200 Subject: [PATCH 1/3] Add spacing config option This option allows to add spaces between the modules. It uses Gtk:Box's spacing property. --- src/bar.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/bar.cpp b/src/bar.cpp index 7d763599..54e487de 100644 --- a/src/bar.cpp +++ b/src/bar.cpp @@ -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"); 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 width = config["width"].isUInt() ? config["width"].asUInt() : 0; From 7669029bfece53d171eead18baff0520a52859fb Mon Sep 17 00:00:00 2001 From: Robin Ebert Date: Wed, 20 Oct 2021 11:15:49 +0200 Subject: [PATCH 2/3] Add man documentation for spacing config option --- man/waybar.5.scd.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/man/waybar.5.scd.in b/man/waybar.5.scd.in index 997a48d8..eaa8d783 100644 --- a/man/waybar.5.scd.in +++ b/man/waybar.5.scd.in @@ -64,6 +64,10 @@ Also a minimal example configuration can be found on the at the bottom of this m typeof: integer ++ Margins value without units. +*spacing* ++ + typeof: integer ++ + Size of gaps in between of the different modules. + *name* ++ typeof: string ++ Optional name added as a CSS class, for styling multiple waybars. From 01bfbc46560bf2daac3317b9541b46196e6673fd Mon Sep 17 00:00:00 2001 From: Robin Ebert Date: Wed, 20 Oct 2021 11:23:57 +0200 Subject: [PATCH 3/3] Use spacing in config --- resources/config | 1 + resources/style.css | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/config b/resources/config index b3157212..063393b0 100644 --- a/resources/config +++ b/resources/config @@ -3,6 +3,7 @@ // "position": "bottom", // Waybar position (top|bottom|left|right) "height": 30, // Waybar height (to be removed for auto height) // "width": 1280, // Waybar width + "spacing": 4, // Gaps between modules (4px) // Choose the order of the modules "modules-left": ["sway/workspaces", "sway/mode", "custom/media"], "modules-center": ["sway/window"], diff --git a/resources/style.css b/resources/style.css index c0d4d9b9..0235942b 100644 --- a/resources/style.css +++ b/resources/style.css @@ -80,7 +80,6 @@ window#waybar.chromium { #idle_inhibitor, #mpd { padding: 0 10px; - margin: 0 4px; color: #ffffff; }