Files
Waybar/include/AIconLabel.hpp
T
Alex c5cefb5520 AIconLabel: make regex static and initialize label_contains_icon
Compile the icon-extraction std::regex objects once via static locals
instead of rebuilding them on every update() of every AIconLabel-derived
module (custom, mpris, ...). Also default-initialize label_contains_icon
to false at its declaration.
2026-07-03 22:10:16 +02:00

30 lines
722 B
C++

#pragma once
#include <gtkmm/box.h>
#include <gtkmm/image.h>
#include "ALabel.hpp"
namespace waybar {
class AIconLabel : public ALabel {
public:
AIconLabel(const Json::Value& config, const std::string& name, const std::string& id,
const std::string& format, uint16_t interval = 0, bool ellipsize = false,
bool enable_click = false, bool enable_scroll = false);
virtual ~AIconLabel() = default;
auto update() -> void override;
static std::tuple<std::string, std::string> extractIcon(const std::string& input);
protected:
Gtk::Image image_;
Gtk::Box box_;
unsigned app_icon_size_{24};
bool label_contains_icon{false};
bool iconEnabled() const;
};
} // namespace waybar