diff --git a/apps/app_seeds/linux/runner/my_application.cc b/apps/app_seeds/linux/runner/my_application.cc index 68e8b57..2ff1284 100644 --- a/apps/app_seeds/linux/runner/my_application.cc +++ b/apps/app_seeds/linux/runner/my_application.cc @@ -19,6 +19,24 @@ static void first_frame_cb(MyApplication* self, FlView* view) { gtk_widget_show(gtk_widget_get_toplevel(GTK_WIDGET(view))); } +// GTK does not pick up an icon from the Flutter bundle; load the packaged app +// icon so the window/taskbar shows it (X11; on Wayland the icon comes from an +// installed .desktop file matching APPLICATION_ID). +static void set_window_icon(GtkWindow* window) { + g_autofree gchar* exe_path = g_file_read_link("/proc/self/exe", nullptr); + if (exe_path == nullptr) { + return; + } + g_autofree gchar* exe_dir = g_path_get_dirname(exe_path); + g_autofree gchar* icon_path = g_build_filename( + exe_dir, "data", "flutter_assets", "assets", "icon.png", nullptr); + g_autoptr(GError) error = nullptr; + if (!gtk_window_set_icon_from_file(window, icon_path, &error)) { + g_warning("Failed to set window icon from %s: %s", icon_path, + error->message); + } +} + // Implements GApplication::activate. static void my_application_activate(GApplication* application) { MyApplication* self = MY_APPLICATION(application); @@ -53,6 +71,7 @@ static void my_application_activate(GApplication* application) { } gtk_window_set_default_size(window, 1280, 720); + set_window_icon(window); g_autoptr(FlDartProject) project = fl_dart_project_new(); fl_dart_project_set_dart_entrypoint_arguments( diff --git a/apps/app_seeds/pubspec.yaml b/apps/app_seeds/pubspec.yaml index 2845d42..e0ae702 100644 --- a/apps/app_seeds/pubspec.yaml +++ b/apps/app_seeds/pubspec.yaml @@ -98,6 +98,8 @@ flutter: assets: - assets/catalog/species.json - assets/logo.png + # Bundled so the Linux runner can use it as the GTK window icon. + - assets/icon.png fonts: # Custom seed-themed icon glyphs (chars a–k). See docs/mockups/seedks-glyphs.png. - family: seedks