Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Set Linux window icon programmatically for direct binary launch

Prateek Sunal3324076b3f95
diff --git a/mobile/apps/auth/linux/my_application.cc b/mobile/apps/auth/linux/my_application.cc
index d47ed2a5db..aa1919e856 100644
--- a/mobile/apps/auth/linux/my_application.cc
+++ b/mobile/apps/auth/linux/my_application.cc
@@ -83,6 +83,19 @@ static void my_application_activate(GApplication *application)
}
gtk_window_set_default_size(window, 1280, 720);
+
+ // Set window icon from bundled asset for when running without .desktop file
+ g_autoptr(GError) icon_error = nullptr;
+ gchar *exe_path = g_file_read_link("/proc/self/exe", nullptr);
+ if (exe_path != nullptr) {
+ gchar *exe_dir = g_path_get_dirname(exe_path);
+ gchar *icon_path = g_build_filename(exe_dir, "data", "flutter_assets", "assets", "icons", "auth-icon.png", nullptr);
+ gtk_window_set_icon_from_file(window, icon_path, &icon_error);
+ g_free(icon_path);
+ g_free(exe_dir);
+ g_free(exe_path);
+ }
+
gtk_widget_show(GTK_WIDGET(window));
g_autoptr(FlDartProject) project = fl_dart_project_new();