Skip to content

Commit

Permalink
fix: sni item fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexays committed Sep 13, 2024
1 parent 1210bcd commit 34d3f98
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/modules/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ auto waybar::modules::Image::update() -> void {
int scaled_icon_size = size_ * image_.get_scale_factor();
pixbuf = Gdk::Pixbuf::create_from_file(path_, scaled_icon_size, scaled_icon_size);

auto surface =
Gdk::Cairo::create_surface_from_pixbuf(pixbuf, image_.get_scale_factor(), image_.get_window());
auto surface = Gdk::Cairo::create_surface_from_pixbuf(pixbuf, image_.get_scale_factor(),
image_.get_window());
image_.set(surface);
image_.show();

Expand Down
19 changes: 13 additions & 6 deletions src/modules/sni/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,11 @@ void Item::proxyReady(Glib::RefPtr<Gio::AsyncResult>& result) {
this->updateImage();

} catch (const Glib::Error& err) {
spdlog::error("Failed to create DBus Proxy for {} {}: {}", bus_name, object_path, err.what());
spdlog::error("Failed to create DBus Proxy for {} {}: {}", bus_name, object_path, std
: string(err.what()));
} catch (const std::exception& err) {
spdlog::error("Failed to create DBus Proxy for {} {}: {}", bus_name, object_path, err.what());
spdlog::error("Failed to create DBus Proxy for {} {}: {}", bus_name, object_path, std
: string(err.what()));
}
}

Expand All @@ -124,14 +126,15 @@ ToolTip get_variant<ToolTip>(const Glib::VariantBase& value) {
result.text = get_variant<Glib::ustring>(container.get_child(2));
auto description = get_variant<Glib::ustring>(container.get_child(3));
if (!description.empty()) {
result.text = fmt::format("<b>{}</b>\n{}", result.text, description);
result.text = fmt::format("<b>{}</b>\n{}", std::string(result.text), std::string(description));
}
return result;
}

void Item::setProperty(const Glib::ustring& name, Glib::VariantBase& value) {
try {
spdlog::trace("Set tray item property: {}.{} = {}", id.empty() ? bus_name : id, name, value);
spdlog::trace("Set tray item property: {}.{} = {}", id.empty() ? bus_name : id,
std::string(name), get_variant<std::string>(value));

if (name == "Category") {
category = get_variant<std::string>(value);
Expand Down Expand Up @@ -176,10 +179,14 @@ void Item::setProperty(const Glib::ustring& name, Glib::VariantBase& value) {
}
} catch (const Glib::Error& err) {
spdlog::warn("Failed to set tray item property: {}.{}, value = {}, err = {}",
id.empty() ? bus_name : id, name, value, err.what());
id.empty() ? bus_name : id, std
: string(name), get_variant<std::string>(value), std
: string(err.what()));
} catch (const std::exception& err) {
spdlog::warn("Failed to set tray item property: {}.{}, value = {}, err = {}",
id.empty() ? bus_name : id, name, value, err.what());
id.empty() ? bus_name : id, std
: string(name), get_variant<std::string>(value), std
: string(err.what()));
}
}

Expand Down

0 comments on commit 34d3f98

Please sign in to comment.