mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
fix(Linux): specify application id (#154522)
This change sets the program name to the application ID, which helps various systems like GTK and desktop environments map this running application to its corresponding .desktop file. This ensures better integration by allowing the application to be recognized beyond its binary name. Notably, this is necessary on Wayland to map the running application window to the desktop file, and therefore apply the correct icon. I've tested that this works in both GNOME & KDE Wayland sessions. Partially addresses https://github.com/flutter/flutter/issues/53229 Resolves https://github.com/flutter/flutter/issues/154521 ## Icon Association ### Task switcher The task switcher shows the application's icon in the bottom-middle. Before it only showed a generic Wayland icon. | Before | After | |-------- |------- | |  | | ### Window Decorations KDE shows the application's icon on the window decorations, at the top-left. Before it only showed a generic Wayland icon. | Before | After | |-------- |------- | |  |  |
This commit is contained in:
parent
afaecd9bf0
commit
ea3c3e719e
@ -117,6 +117,12 @@ static void my_application_class_init(MyApplicationClass* klass) {
|
||||
static void my_application_init(MyApplication* self) {}
|
||||
|
||||
MyApplication* my_application_new() {
|
||||
// Set the program name to the application ID, which helps various systems
|
||||
// like GTK and desktop environments map this running application to its
|
||||
// corresponding .desktop file. This ensures better integration by allowing
|
||||
// the application to be recognized beyond its binary name.
|
||||
g_set_prgname(APPLICATION_ID);
|
||||
|
||||
return MY_APPLICATION(g_object_new(my_application_get_type(),
|
||||
"application-id", APPLICATION_ID,
|
||||
"flags", G_APPLICATION_NON_UNIQUE,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user