Merge pull request #4772 from szbmrk/feat-hyprland-submap-icon-handling

feat(hyprland/submap): add config option to specify different icons for submaps
This commit is contained in:
Alexis Rouillard
2026-07-04 00:41:11 +02:00
committed by GitHub
3 changed files with 33 additions and 4 deletions
+20 -1
View File
@@ -21,6 +21,18 @@ Submap::Submap(const std::string& id, const Bar& bar, const Json::Value& config)
// register for hyprland ipc
m_ipc.registerForIPC("submap", this);
dp.emit();
if (config["icons"].isObject()) {
const Json::Value& icons = config["icons"];
for (const std::string& key : icons.getMemberNames()) {
const Json::Value& value = icons[key];
if (value.isString()) {
icons_[key] = value.asString();
}
}
}
}
Submap::~Submap() {
@@ -58,7 +70,8 @@ auto Submap::update() -> void {
if (submap_.empty()) {
event_box_.hide();
} else {
label_.set_markup(fmt::format(fmt::runtime(format_), submap_));
label_.set_markup(
fmt::format(fmt::runtime(format_), fmt::arg("submap", submap_), fmt::arg("icon", icon_)));
if (tooltipEnabled()) {
label_.set_tooltip_markup(submap_);
}
@@ -84,6 +97,12 @@ void Submap::onEvent(const std::string& ev) {
submap_ = submapName;
if (!icons_[submap_].empty()) {
icon_ = icons_[submap_];
} else {
icon_ = "";
}
if (submap_.empty() && always_on_) {
submap_ = default_submap_;
}