diff --git a/linux/my_application.cc b/linux/my_application.cc index de89898..b2bd8d1 100644 --- a/linux/my_application.cc +++ b/linux/my_application.cc @@ -7,6 +7,11 @@ #include "flutter/generated_plugin_registrant.h" +#include + +using namespace std; +using namespace std::filesystem; + struct _MyApplication { GtkApplication parent_instance; char** dart_entrypoint_arguments; @@ -20,6 +25,12 @@ static void my_application_activate(GApplication* application) { GtkWindow* window = GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); + // custom icon + const string iconFilename = "assets/icon.png"; + path execDir = canonical(read_symlink("/proc/self/exe")).parent_path(); + path iconPath = execDir / "data/flutter_assets" / iconFilename; + gtk_window_set_icon_from_file(GTK_WINDOW(window), iconPath.c_str(), NULL); + // Use a header bar when running in GNOME as this is the common style used // by applications and is the setup most users will be using (e.g. Ubuntu // desktop). diff --git a/pubspec.yaml b/pubspec.yaml index fbe19b9..0198a15 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -35,6 +35,7 @@ flutter: uses-material-design: true assets: + - assets/icon.png - assets/userdata-empty.dat flutter_launcher_icons: