Skip to content

Commit

Permalink
fix: use app_identifier itself in AAppIconLabel if it's an absolute path
Browse files Browse the repository at this point in the history
  • Loading branch information
ThatOneCalculator committed Sep 16, 2024
1 parent 0d02f68 commit 7750adb
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/AAppIconLabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ std::optional<std::string> getDesktopFilePath(const std::string& app_identifier,
if (app_identifier.empty()) {
return {};
}

const auto data_dirs = Glib::get_system_data_dirs();
for (const auto& data_dir : data_dirs) {
const auto data_app_dir = data_dir + "/applications/";
Expand Down Expand Up @@ -154,6 +154,16 @@ void AAppIconLabel::updateAppIcon() {
update_app_icon_ = false;
if (app_icon_name_.empty()) {
image_.set_visible(false);
}
else if (app_icon_name_.front() == '/') {
auto pixbuf = Gdk::Pixbuf::create_from_file(app_icon_name_);
int scaled_icon_size = app_icon_size_ * image_.get_scale_factor();
pixbuf = Gdk::Pixbuf::create_from_file(app_icon_name_, scaled_icon_size, scaled_icon_size);

auto surface = Gdk::Cairo::create_surface_from_pixbuf(pixbuf, image_.get_scale_factor(),
image_.get_window());
image_.set(surface);
image_.set_visible(true);
} else {
image_.set_from_icon_name(app_icon_name_, Gtk::ICON_SIZE_INVALID);
image_.set_visible(true);
Expand Down

0 comments on commit 7750adb

Please sign in to comment.