perf(label): skip redundant markup updates

This commit is contained in:
Alexey Ivanov
2026-06-04 15:18:43 -07:00
parent 05945748dc
commit 2190871a68
4 changed files with 35 additions and 6 deletions
+9
View File
@@ -4,6 +4,8 @@
#include <gtkmm/label.h>
#include <json/json.h>
#include <optional>
#include "AModule.hpp"
namespace waybar {
@@ -25,12 +27,19 @@ class ALabel : public AModule {
bool alt_ = false;
std::string default_format_;
bool setLabelMarkup(const Glib::ustring& markup);
bool setTooltipMarkup(const Glib::ustring& markup);
bool handleToggle(GdkEventButton* const& e) override;
virtual std::string getState(uint8_t value, bool lesser = false);
std::map<std::string, GtkMenuItem*> submenus_;
std::map<std::string, std::string> menuActionsMap_;
static void handleGtkMenuEvent(GtkMenuItem* menuitem, gpointer data);
private:
std::optional<Glib::ustring> last_label_markup_;
std::optional<Glib::ustring> last_tooltip_markup_;
};
} // namespace waybar