From 2334faa7fd4593b0f15c3b83d9f50dc523b04be8 Mon Sep 17 00:00:00 2001 From: czadowanie Date: Tue, 28 Nov 2023 19:39:08 +0100 Subject: [PATCH 1/3] upower: show-icon config option --- include/modules/upower/upower.hpp | 1 + src/modules/upower/upower.cpp | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/modules/upower/upower.hpp b/include/modules/upower/upower.hpp index 9c1a18309..eda8ab050 100644 --- a/include/modules/upower/upower.hpp +++ b/include/modules/upower/upower.hpp @@ -72,6 +72,7 @@ class UPower : public AModule { std::unique_ptr upower_tooltip; std::string lastStatus; bool showAltText; + bool showIcon = true; bool upowerRunning; guint upowerWatcher_id; std::string nativePath_; diff --git a/src/modules/upower/upower.cpp b/src/modules/upower/upower.cpp index e3b3981af..3554d43ba 100644 --- a/src/modules/upower/upower.cpp +++ b/src/modules/upower/upower.cpp @@ -18,7 +18,15 @@ UPower::UPower(const std::string& id, const Json::Value& config) m_Mutex(), client(), showAltText(false) { - box_.pack_start(icon_); + // Show icon only when "show-icon" isn't set to false + if (config_["show-icon"].isBool()) { + showIcon = config_["show-icon"].asBool(); + } + + if (showIcon) { + box_.pack_start(icon_); + } + box_.pack_start(label_); box_.set_name(name_); event_box_.add(box_); From 44f309678bc36ca4cccda25e1daf35c96dba7fcc Mon Sep 17 00:00:00 2001 From: czadowanie Date: Mon, 4 Dec 2023 21:28:37 +0100 Subject: [PATCH 2/3] man: document upower/show-icon --- man/waybar-upower.5.scd | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/man/waybar-upower.5.scd b/man/waybar-upower.5.scd index 5ccda07cc..df28d7430 100644 --- a/man/waybar-upower.5.scd +++ b/man/waybar-upower.5.scd @@ -57,6 +57,11 @@ compatible devices in the tooltip. typeof: string ++ Command to execute when clicked on the module. +*show-icon*: ++ + typeof: bool ++ + default: true ++ + Option to disable battery icon + # FORMAT REPLACEMENTS *{percentage}*: The battery capacity in percentage @@ -93,6 +98,15 @@ depending on the charging state. "tooltip": true, "tooltip-spacing": 20 } +``` +``` +"upower": { + "show-icon": false, + "hide-if-empty": true, + "tooltip": true, + "tooltip-spacing": 20 +} + ``` # STYLE From 4283195803e7ce83014f95e26659935784e0659c Mon Sep 17 00:00:00 2001 From: czadowanie Date: Mon, 4 Dec 2023 21:32:08 +0100 Subject: [PATCH 3/3] man: add dot in upower/show-icon --- man/waybar-upower.5.scd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/waybar-upower.5.scd b/man/waybar-upower.5.scd index df28d7430..5e2a8eb85 100644 --- a/man/waybar-upower.5.scd +++ b/man/waybar-upower.5.scd @@ -60,7 +60,7 @@ compatible devices in the tooltip. *show-icon*: ++ typeof: bool ++ default: true ++ - Option to disable battery icon + Option to disable battery icon. # FORMAT REPLACEMENTS