From 52e7b6148b834e60e13332b2259208eb8ac23ece Mon Sep 17 00:00:00 2001 From: Alexis Date: Wed, 15 Aug 2018 14:58:55 +0200 Subject: [PATCH] feat(workspaces): add class to button when label is a icon --- resources/style.css | 6 +++--- src/modules/workspaces.cpp | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/resources/style.css b/resources/style.css index aecf96bb..0778a894 100644 --- a/resources/style.css +++ b/resources/style.css @@ -12,14 +12,14 @@ window { } #workspaces button { - padding: 0 8px; + padding: 0 5px; background: transparent; color: white; border-bottom: 3px solid transparent; } -#workspaces button label { - font-size: 12px; +#workspaces button.icon label { + font-size: 10px; } #workspaces button.current { diff --git a/src/modules/workspaces.cpp b/src/modules/workspaces.cpp index b8f61866..bd11c5cb 100644 --- a/src/modules/workspaces.cpp +++ b/src/modules/workspaces.cpp @@ -67,9 +67,11 @@ auto waybar::modules::Workspaces::update() -> void void waybar::modules::Workspaces::_addWorkspace(Json::Value node) { - auto pair = _buttons.emplace(node["num"].asInt(), - _getIcon(node["name"].asString())); + auto icon = _getIcon(node["name"].asString()); + auto pair = _buttons.emplace(node["num"].asInt(), icon); auto &button = pair.first->second; + if (icon != node["name"].asString()) + button.get_style_context()->add_class("icon"); _box.pack_start(button, false, false, 0); button.set_relief(Gtk::RELIEF_NONE); button.signal_clicked().connect([this, pair] {