diff --git a/linux/runner/CMakeLists.txt b/linux/runner/CMakeLists.txt index e97dabc..21f5b4e 100644 --- a/linux/runner/CMakeLists.txt +++ b/linux/runner/CMakeLists.txt @@ -24,3 +24,5 @@ target_link_libraries(${BINARY_NAME} PRIVATE flutter) target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") + +target_compile_features(${BINARY_NAME} PUBLIC cxx_std_17) diff --git a/linux/runner/my_application.cc b/linux/runner/my_application.cc index 652d58a..ea8f4a8 100644 --- a/linux/runner/my_application.cc +++ b/linux/runner/my_application.cc @@ -5,6 +5,10 @@ #include #endif +#include +using namespace std; +using namespace std::filesystem; + #include "flutter/generated_plugin_registrant.h" struct _MyApplication { @@ -25,6 +29,15 @@ static void my_application_activate(GApplication* application) { MyApplication* self = MY_APPLICATION(application); GtkWindow* window = GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); + const string iconFilename = "assets/icon/1.png"; + path execDir = canonical(read_symlink("/proc/self/exe")).parent_path(); + path iconPath = execDir / "data/flutter_assets" / iconFilename; + + gtk_window_set_icon_from_file( + window, + iconPath.c_str(), + nullptr + ); // 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