diff --git a/gajim/common/app.py b/gajim/common/app.py
index 3c02570f9f299a90c2bf76bdfcded201d3636841..41cae94b706e88a37dd6617e2d842d1f8b806f91 100644
--- a/gajim/common/app.py
+++ b/gajim/common/app.py
@@ -39,11 +39,13 @@ from distutils.version import LooseVersion as V
 from collections import namedtuple
 
 import nbxmpp
+from gi.repository import Gdk
 
 import gajim
 from gajim.common import config as c_config
 from gajim.common import configpaths
 from gajim.common import ged as ged_module
+from gajim.common.const import Display
 from gajim.common.contacts import LegacyContactsAPI
 from gajim.common.events import Events
 from gajim.common.types import NetworkEventsControllerT  # pylint: disable=unused-import
@@ -193,6 +195,18 @@ def is_installed(dependency):
 def is_flatpak():
     return gajim.IS_FLATPAK
 
+def is_display(display):
+    # XWayland reports as Display X11, so try with env var
+    is_wayland = os.environ.get('XDG_SESSION_TYPE') == 'wayland'
+    if is_wayland and display == Display.WAYLAND:
+        return True
+
+    default = Gdk.Display.get_default()
+    if default is None:
+        log('gajim').warning('Could not determine window manager')
+        return False
+    return default.__class__.__name__ == display.value
+
 def disable_dependency(dependency):
     _dependencies[dependency] = False
 
diff --git a/gajim/common/const.py b/gajim/common/const.py
index ee4099444913de00e465bbc521901b0591f43b89..7d676265e29ba99d46b01e75bc14a2546c4f8b30 100644
--- a/gajim/common/const.py
+++ b/gajim/common/const.py
@@ -193,6 +193,13 @@ class SyncThreshold(IntEnum):
         return str(self.value)
 
 
+class Display(Enum):
+    X11 = 'X11Display'
+    WAYLAND = 'GdkWaylandDisplay'
+    WIN32 = 'GdkWin32Display'
+    QUARTZ = 'GdkQuartzDisplay'
+
+
 ACTIVITIES = {
     'doing_chores': {
         'category': _('Doing Chores'),