wcm icon indicating copy to clipboard operation
wcm copied to clipboard

Don't show 'not found' icon for plugins without an icon

Open NamorNiradnug opened this issue 1 year ago • 4 comments

NamorNiradnug avatar Jun 19 '24 21:06 NamorNiradnug

I'm also thinking about a fallback icon. Although I'm not sure if it's better than no icon at all.

NamorNiradnug avatar Jun 19 '24 21:06 NamorNiradnug

I'm also thinking about a fallback icon. Although I'm not sure if it's better than no icon at all.

Yes, I think it is a fine idea.

soreau avatar Jun 19 '24 23:06 soreau

Well... I tried... Tbh I don't really like how it looks like, but I don't know how to make it better.

NamorNiradnug avatar Jun 20 '24 17:06 NamorNiradnug

Well... I tried... Tbh I don't really like how does it look like, but I don't know how to make it better.

Ok, thanks. I'll have a look when I have some time.

soreau avatar Jun 20 '24 17:06 soreau

@NamorNiradnug How about reusing the wcm.svg icon (that is the wayfire badge) like this?

diff --git a/src/wcm.cpp b/src/wcm.cpp
index 3624912..3db1d66 100644
--- a/src/wcm.cpp
+++ b/src/wcm.cpp
@@ -1128,10 +1128,18 @@ MainPage::Category::Category(const Glib::ustring & name,
 
 void Plugin::init_widget()
 {
+    const auto icon_path = WCM::get_instance()->find_icon("plugin-" + name + ".svg");
+    if (std::filesystem::exists(icon_path))
+    {
+        icon.set(icon_path);
+    } else
+    {
+        icon.set_from_icon_name("wcm", Gtk::ICON_SIZE_DND);
+    }
+
+    button_layout.pack_start(icon);
     label.set_text(disp_name);
     label.set_ellipsize(Pango::ELLIPSIZE_END);
-    icon.set(WCM::get_instance()->find_icon("plugin-" + name + ".svg"));
-    button_layout.pack_start(icon);
     button_layout.pack_start(label);
     button_layout.set_halign(Gtk::ALIGN_START);
     button.set_tooltip_markup(tooltip);
wcm-missing-icons

soreau avatar Aug 08 '25 05:08 soreau

Yeah, I think it looks better like this. I'll update the PR later today.

NamorNiradnug avatar Aug 08 '25 11:08 NamorNiradnug

Thanks!

soreau avatar Aug 08 '25 22:08 soreau