fix: sni item fmt

This commit is contained in:
Alex 2024-09-13 09:40:35 +02:00
parent 1210bcd2b5
commit a4d31ab10d
3 changed files with 20 additions and 15 deletions

View File

@ -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();

View File

@ -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()));
}
}
@ -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);
@ -176,10 +179,12 @@ 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()));
}
}
@ -221,9 +226,9 @@ void Item::processUpdatedProperties(Glib::RefPtr<Gio::AsyncResult>& _result) {
this->updateImage();
} catch (const Glib::Error& err) {
spdlog::warn("Failed to update properties: {}", err.what());
spdlog::warn("Failed to update properties: {}", std::string(err.what()));
} catch (const std::exception& err) {
spdlog::warn("Failed to update properties: {}", err.what());
spdlog::warn("Failed to update properties: {}", std::string(err.what()));
}
update_pending_.clear();
}
@ -245,7 +250,7 @@ static const std::map<std::string_view, std::set<std::string_view>> signal2props
void Item::onSignal(const Glib::ustring& sender_name, const Glib::ustring& signal_name,
const Glib::VariantContainerBase& arguments) {
spdlog::trace("Tray item '{}' got signal {}", id, signal_name);
spdlog::trace("Tray item '{}' got signal {}", id, std::string(signal_name));
auto changed = signal2props.find(signal_name.raw());
if (changed != signal2props.end()) {
if (update_pending_.empty()) {

View File

@ -1,5 +1,5 @@
[wrap-file]
directory = gtk-layer-shell-0.8.2
source_filename = gtk-layer-shell-0.8.2.tar.gz
source_hash = 254dd246303127c5d5236ea640f01a82e35d2d652a48d139dd669c832a0f0dce
source_url = https://github.com/wmww/gtk-layer-shell/archive/v0.8.2/gtk-layer-shell-0.8.2.tar.gz
directory = gtk-layer-shell-0.9.0
source_filename = gtk-layer-shell-0.9.0.tar.gz
source_hash = 3809e5565d9ed02e44bb73787ff218523e8760fef65830afe60ea7322e22da1c
source_url = https://github.com/wmww/gtk-layer-shell/archive/v0.9.0/gtk-layer-shell-0.9.0.tar.gz