Skip to content

Commit addf44d

Browse files
committed
test
1 parent e92b0a8 commit addf44d

File tree

1 file changed

+27
-28
lines changed

1 file changed

+27
-28
lines changed

src/modules/wlr/taskbar.cpp

+27-28
Original file line numberDiff line numberDiff line change
@@ -383,39 +383,38 @@ std::string Task::state_string(bool shortened) const {
383383
}
384384

385385
void Task::handle_title(const char* title) {
386-
title_ = title;
387-
hide_if_ignored();
386+
if (title_.empty()) {
387+
spdlog::debug(fmt::format("Task ({}) setting title to {}", id_, title_));
388+
} else {
389+
spdlog::debug(fmt::format("Task ({}) overwriting title '{}' with '{}'", id_, title_, title));
390+
}
391+
title_ = title;
392+
hide_if_ignored();
388393

389-
// Skip if we already have app info or no title
390-
if (app_info_ || title_.empty()) {
391-
return;
392-
}
394+
if (!with_icon_ && !with_name_ || app_info_) {
395+
return;
396+
}
393397

394-
// Try exact title match
395-
app_info_ = get_desktop_app_info(title_);
398+
set_app_info_from_app_id_list(title_);
399+
name_ = app_info_ ? app_info_->get_display_name() : title;
396400

397-
// Try lowercase version if still needed
398-
if (!app_info_) {
399-
std::string lower_title = title_;
400-
std::transform(lower_title.begin(), lower_title.end(), lower_title.begin(), ::tolower);
401-
app_info_ = get_desktop_app_info(lower_title);
402-
}
401+
if (!with_icon_) {
402+
return;
403+
}
403404

404-
// If we found a match, update name and icon
405-
if (app_info_) {
406-
name_ = app_info_->get_display_name();
407-
spdlog::info("Found desktop file via title fallback: {}", name_);
408-
409-
if (with_icon_) {
410-
const int icon_size = config_["icon-size"].isInt() ? config_["icon-size"].asInt() : 16;
411-
for (auto& icon_theme : tbar_->icon_themes()) {
412-
if (image_load_icon(icon_, icon_theme, app_info_, icon_size)) {
413-
icon_.show();
414-
break;
415-
}
416-
}
417-
}
405+
int icon_size = config_["icon-size"].isInt() ? config_["icon-size"].asInt() : 16;
406+
bool found = false;
407+
for (auto &icon_theme : tbar_->icon_themes()) {
408+
if (image_load_icon(icon_, icon_theme, app_info_, icon_size)) {
409+
found = true;
410+
break;
418411
}
412+
}
413+
414+
if (found)
415+
icon_.show();
416+
else
417+
spdlog::debug("Couldn't find icon for {}", title_);
419418
}
420419

421420
void Task::set_minimize_hint() {

0 commit comments

Comments
 (0)