diff --git a/build-aux/flatpak/org.gtk.Demo.json b/build-aux/flatpak/org.gtk.Demo.json
index a0c50855911190a469d30459f91f38bb24893593..ca655a7bd654f1b33decc34fba3545a2a33b80a9 100644
--- a/build-aux/flatpak/org.gtk.Demo.json
+++ b/build-aux/flatpak/org.gtk.Demo.json
@@ -5,7 +5,6 @@
"sdk": "org.gnome.Sdk",
"command": "gtk4-demo",
"tags": ["devel", "development", "nightly"],
- "rename-desktop-file": "gtk4-demo.desktop",
"rename-icon": "gtk4-demo",
"desktop-file-name-prefix": "(Development) ",
"finish-args": [
diff --git a/build-aux/flatpak/org.gtk.WidgetFactory.json b/build-aux/flatpak/org.gtk.WidgetFactory.json
index c28acf426e45718a17ea1bbe1da09dbaae50119b..ea6aaa9938369e83f3f389c2a16ef77e6f3d9162 100644
--- a/build-aux/flatpak/org.gtk.WidgetFactory.json
+++ b/build-aux/flatpak/org.gtk.WidgetFactory.json
@@ -5,7 +5,6 @@
"sdk": "org.gnome.Sdk",
"command": "gtk4-widget-factory",
"tags": ["devel", "development", "nightly"],
- "rename-desktop-file": "gtk4-widget-factory.desktop",
"rename-icon": "gtk4-widget-factory",
"desktop-file-name-prefix": "(Development) ",
"finish-args": [
diff --git a/demos/gtk-demo/meson.build b/demos/gtk-demo/meson.build
index e626fae503f2edc1657546408c6c49d365eecba8..93c2902575c92a352896caf969e4331edbf6115e 100644
--- a/demos/gtk-demo/meson.build
+++ b/demos/gtk-demo/meson.build
@@ -129,7 +129,7 @@ foreach icon_size: [ '16x16', '22x22', '24x24', '32x32', '48x48', '256x256', ]
endforeach
# desktop file
-install_data('gtk4-demo.desktop', install_dir: gtk_applicationsdir)
+install_data('org.gtk.Demo.desktop', install_dir: gtk_applicationsdir)
# GSettings
install_data('org.gtk.Demo.gschema.xml', install_dir: gtk_schemasdir)
diff --git a/demos/gtk-demo/gtk4-demo.desktop b/demos/gtk-demo/org.gtk.Demo.desktop
similarity index 100%
rename from demos/gtk-demo/gtk4-demo.desktop
rename to demos/gtk-demo/org.gtk.Demo.desktop
diff --git a/demos/icon-browser/meson.build b/demos/icon-browser/meson.build
index 95b1c0f4e410fd2a163989b1d2bc30aaee079ec9..fcaca82d8d3615f3bbece86a512e03f7aa5e5e27 100644
--- a/demos/icon-browser/meson.build
+++ b/demos/icon-browser/meson.build
@@ -17,4 +17,4 @@ executable('gtk4-icon-browser',
link_args: extra_demo_ldflags,
install: true)
-install_data('gtk4-icon-browser.desktop', install_dir: gtk_applicationsdir)
+install_data('org.gtk.IconBrowser.desktop', install_dir: gtk_applicationsdir)
diff --git a/demos/icon-browser/gtk4-icon-browser.desktop b/demos/icon-browser/org.gtk.IconBrowser.desktop
similarity index 100%
rename from demos/icon-browser/gtk4-icon-browser.desktop
rename to demos/icon-browser/org.gtk.IconBrowser.desktop
diff --git a/demos/widget-factory/meson.build b/demos/widget-factory/meson.build
index 2050d2e7507cc231cc217d56100955cf02c22996..be7b5db57a2fdfc9ba7c6dffb2ef98e8e86f4a45 100644
--- a/demos/widget-factory/meson.build
+++ b/demos/widget-factory/meson.build
@@ -13,7 +13,7 @@ executable('gtk4-widget-factory',
install: true)
# desktop file
-install_data('gtk4-widget-factory.desktop', install_dir: gtk_applicationsdir)
+install_data('org.gtk.WidgetFactory.desktop', install_dir: gtk_applicationsdir)
# icons
icontheme_dir = join_paths(gtk_datadir, 'icons/hicolor')
diff --git a/demos/widget-factory/gtk4-widget-factory.desktop b/demos/widget-factory/org.gtk.WidgetFactory.desktop
similarity index 100%
rename from demos/widget-factory/gtk4-widget-factory.desktop
rename to demos/widget-factory/org.gtk.WidgetFactory.desktop
diff --git a/docs/reference/gtk/getting_started.xml b/docs/reference/gtk/getting_started.xml
index 036b9f471cfe798f1575138936bea0051a922552..18085134196ce406a90382d02008dd401614e367 100644
--- a/docs/reference/gtk/getting_started.xml
+++ b/docs/reference/gtk/getting_started.xml
@@ -388,7 +388,7 @@
- MISSING XINCLUDE CONTENT
+ MISSING XINCLUDE CONTENT
Note that @bindir@ needs to be replaced
diff --git a/docs/reference/gtk/migrating-3to4.xml b/docs/reference/gtk/migrating-3to4.xml
index cd113bb79b013af534b25f5b3090352e77d02eea..6532974d3c1cb3f9c25cbfc0cc0cddf7560f77dc 100644
--- a/docs/reference/gtk/migrating-3to4.xml
+++ b/docs/reference/gtk/migrating-3to4.xml
@@ -177,6 +177,22 @@
+
+ Set a proper app_id
+
+ In GTK+4 we want the application's #GApplication
+ 'application-id' (and therefore the D-Bus name), the desktop
+ file basename and Wayland's xdg-shell app_id to match. In
+ order to achieve this with GTK+3 call g_set_prgname() with the same
+ application id you passed to #GtkApplication. Rename your
+ desktop files to match the application id if needed.
+
+
+ The call to g_set_prgname() can be removed once you fully migrated
+ to GTK+4.
+
+
+
diff --git a/examples/application1/README b/examples/application1/README
index 4c4e75c4d9f7d212c2380530a7a3d3956eec5acb..739ecd967d5723cfb4727f22bde0bd786c0faf7b 100644
--- a/examples/application1/README
+++ b/examples/application1/README
@@ -2,8 +2,8 @@ To make gnome-shell use the desktop file and icon for this example
while running it uninstalled, do the following:
mkdir -p ~/.local/share/applications
-sed -e "s#@bindir@#$PWD#" exampleapp.desktop \
- > ~/.local/share/applications/lt-exampleapp.desktop
+sed -e "s#@bindir@#$PWD#" org.gtk.exampleapp.desktop \
+ > ~/.local/share/applications/org.gtk.exampleapp.desktop
mkdir -p ~/.local/share/icons/hicolor/48x48/apps
cp exampleapp.png ~/.local/share/icons/hicolor/48x48/apps
diff --git a/examples/application1/exampleapp.desktop b/examples/application1/org.gtk.exampleapp.desktop
similarity index 100%
rename from examples/application1/exampleapp.desktop
rename to examples/application1/org.gtk.exampleapp.desktop
diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c
index 51eca561df1c629514cb1eb304f54d5208030b55..af5881007d9d6468e563991e900a1cce68a0dd3e 100644
--- a/gdk/wayland/gdksurface-wayland.c
+++ b/gdk/wayland/gdksurface-wayland.c
@@ -1515,7 +1515,9 @@ gdk_wayland_surface_create_xdg_toplevel (GdkSurface *surface)
impl->initial_fullscreen_output = NULL;
- app_id = g_get_prgname ();
+ app_id = impl->application.application_id;
+ if (app_id == NULL)
+ app_id = g_get_prgname ();
if (app_id == NULL)
app_id = "GTK+ Application";