diff --git a/src/Fl_Window.cxx b/src/Fl_Window.cxx
index d5a82a41b..593622071 100644
--- a/src/Fl_Window.cxx
+++ b/src/Fl_Window.cxx
@@ -241,9 +241,12 @@ void Fl_Window::default_xclass(const char *xc)
and the second one if the first is 'x'. Thus "foo" turns into "foo, Foo",
and "xprog.1" turns into "xprog, XProg".
+ Under Wayland, this is used to set the "application identifier" of toplevel,
+ bordered windows. If not set, the executable name is used.
+
Under Microsoft Windows, this string is used as the name of the
- WNDCLASS structure, though it is not clear if this can have any
- visible effect.
+ WNDCLASS structure. The user should avoid names that may collide with
+ system-reserved window class names (e.g., anything beginning with "edit").
\since FLTK 1.3 the passed string is copied. You can use a local
variable or free the string immediately after this call. Note that
diff --git a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
index 3382bf609..8549ccf44 100644
--- a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
@@ -1458,7 +1458,8 @@ void Fl_Wayland_Window_Driver::makeWindow()
new_window->frame = libdecor_decorate(scr_driver->libdecor_context, new_window->wl_surface,
&libdecor_frame_iface, new_window);
// appears in the Gnome desktop menu bar
- libdecor_frame_set_app_id(new_window->frame, get_prog_name());
+ const char *appid = pWindow->xclass() ? pWindow->xclass() : get_prog_name();
+ libdecor_frame_set_app_id(new_window->frame, appid);
libdecor_frame_set_title(new_window->frame, pWindow->label()?pWindow->label():"");
if (!is_resizable()) {
libdecor_frame_unset_capabilities(new_window->frame, LIBDECOR_ACTION_RESIZE);