From 00a2ebf00d9bf80033d489431888778268d736ee Mon Sep 17 00:00:00 2001 From: Keloran Date: Fri, 18 Nov 2022 13:09:38 +0000 Subject: [PATCH 1/6] added onclick to upower --- include/modules/upower/upower.hpp | 1 + man/waybar-upower.5.scd | 4 ++++ src/modules/upower/upower.cpp | 5 +---- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/modules/upower/upower.hpp b/include/modules/upower/upower.hpp index 2724443f..e19315f8 100644 --- a/include/modules/upower/upower.hpp +++ b/include/modules/upower/upower.hpp @@ -8,6 +8,7 @@ #include #include "ALabel.hpp" +#include "AButton.hpp" #include "glibconfig.h" #include "gtkmm/box.h" #include "gtkmm/image.h" diff --git a/man/waybar-upower.5.scd b/man/waybar-upower.5.scd index dae974dd..a6ba4df0 100644 --- a/man/waybar-upower.5.scd +++ b/man/waybar-upower.5.scd @@ -47,6 +47,10 @@ compatible devices in the tooltip. default: 4 ++ Defines the spacing between the tooltip window edge and the tooltip content. +*on-click*: ++ + typeof: string ++ + Command to execute when clicked on the module. + # FORMAT REPLACEMENTS *{percentage}*: The battery capacity in percentage diff --git a/src/modules/upower/upower.cpp b/src/modules/upower/upower.cpp index 41fc362b..6b8a2029 100644 --- a/src/modules/upower/upower.cpp +++ b/src/modules/upower/upower.cpp @@ -250,10 +250,7 @@ const std::string UPower::getDeviceStatus(UpDeviceState& state) { } bool UPower::handleToggle(GdkEventButton* const& event) { - std::lock_guard guard(m_Mutex); - showAltText = !showAltText; - dp.emit(); - return true; + return AModule::handleToggle(event); } std::string UPower::timeToString(gint64 time) { From d9cc995405a90bcc97a0fb6199f65a696c86a138 Mon Sep 17 00:00:00 2001 From: Keloran Date: Fri, 18 Nov 2022 13:10:04 +0000 Subject: [PATCH 2/6] added onclick to upower --- include/modules/upower/upower.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/include/modules/upower/upower.hpp b/include/modules/upower/upower.hpp index e19315f8..2724443f 100644 --- a/include/modules/upower/upower.hpp +++ b/include/modules/upower/upower.hpp @@ -8,7 +8,6 @@ #include #include "ALabel.hpp" -#include "AButton.hpp" #include "glibconfig.h" #include "gtkmm/box.h" #include "gtkmm/image.h" From a2751cfcd6b8d23afeff7ded170b18833c508ce9 Mon Sep 17 00:00:00 2001 From: Keloran Date: Fri, 18 Nov 2022 14:25:16 +0000 Subject: [PATCH 3/6] alt text readded --- src/modules/upower/upower.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/modules/upower/upower.cpp b/src/modules/upower/upower.cpp index 6b8a2029..e9850074 100644 --- a/src/modules/upower/upower.cpp +++ b/src/modules/upower/upower.cpp @@ -250,6 +250,9 @@ const std::string UPower::getDeviceStatus(UpDeviceState& state) { } bool UPower::handleToggle(GdkEventButton* const& event) { + std::lock_guard guard(m_Mutex); + showAltText = !showAltText; + dp.emit(); return AModule::handleToggle(event); } From 456e06c4b5827cd42004863d3435b4dd6c65160d Mon Sep 17 00:00:00 2001 From: Keloran Date: Mon, 21 Nov 2022 09:46:57 +0000 Subject: [PATCH 4/6] exact opposite, lol --- src/modules/upower/upower.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/modules/upower/upower.cpp b/src/modules/upower/upower.cpp index e9850074..a1df3809 100644 --- a/src/modules/upower/upower.cpp +++ b/src/modules/upower/upower.cpp @@ -250,10 +250,14 @@ const std::string UPower::getDeviceStatus(UpDeviceState& state) { } bool UPower::handleToggle(GdkEventButton* const& event) { + bool clickHandled = AModule::handleToggle(event); + if (clickHandled) { + return clickHandled; + } std::lock_guard guard(m_Mutex); showAltText = !showAltText; dp.emit(); - return AModule::handleToggle(event); + return true } std::string UPower::timeToString(gint64 time) { From 3acd31c3e948d7f925b152e0550dadc9246b0265 Mon Sep 17 00:00:00 2001 From: Keloran Date: Mon, 21 Nov 2022 09:48:41 +0000 Subject: [PATCH 5/6] syntax issue --- src/modules/upower/upower.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/upower/upower.cpp b/src/modules/upower/upower.cpp index a1df3809..2dc426fe 100644 --- a/src/modules/upower/upower.cpp +++ b/src/modules/upower/upower.cpp @@ -257,7 +257,7 @@ bool UPower::handleToggle(GdkEventButton* const& event) { std::lock_guard guard(m_Mutex); showAltText = !showAltText; dp.emit(); - return true + return true; } std::string UPower::timeToString(gint64 time) { From e63e3a0ca96fc2f8d397638c86a55c5873a75e86 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 25 Nov 2022 09:03:27 +0100 Subject: [PATCH 6/6] Update upower.cpp --- src/modules/upower/upower.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/modules/upower/upower.cpp b/src/modules/upower/upower.cpp index 2dc426fe..eb29913e 100644 --- a/src/modules/upower/upower.cpp +++ b/src/modules/upower/upower.cpp @@ -250,14 +250,9 @@ const std::string UPower::getDeviceStatus(UpDeviceState& state) { } bool UPower::handleToggle(GdkEventButton* const& event) { - bool clickHandled = AModule::handleToggle(event); - if (clickHandled) { - return clickHandled; - } std::lock_guard guard(m_Mutex); showAltText = !showAltText; - dp.emit(); - return true; + return AModule::handleToggle(event); } std::string UPower::timeToString(gint64 time) {