diff --git a/src/ui/NhekoGlobalObject.cpp b/src/ui/NhekoGlobalObject.cpp
index a6f9abe7..8f410dae 100644
--- a/src/ui/NhekoGlobalObject.cpp
+++ b/src/ui/NhekoGlobalObject.cpp
@@ -5,16 +5,12 @@
#include "NhekoGlobalObject.h"
#include <QApplication>
+#include <QGuiApplication>
#include <QDesktopServices>
#include <QStyle>
#include <QUrl>
#include <QWindow>
-// for some reason that is not installed in our macOS env...
-#ifndef Q_OS_MAC
-#include <QtPlatformHeaders/QXcbWindowFunctions>
-#endif
-
#include "Cache_p.h"
#include "ChatPage.h"
#include "Logging.h"
@@ -22,6 +18,8 @@
#include "Utils.h"
#include "voip/WebRTCSession.h"
+#include <xcb/xproto.h>
+
Nheko::Nheko()
{
connect(
@@ -186,7 +184,21 @@ Nheko::createRoom(bool space,
void
Nheko::setWindowRole([[maybe_unused]] QWindow *win, [[maybe_unused]] QString newRole) const
{
-#ifndef Q_OS_MAC
- QXcbWindowFunctions::setWmWindowRole(win, newRole.toUtf8());
-#endif
+ const QNativeInterface::QX11Application *x11Interface = qGuiApp->nativeInterface<QNativeInterface::QX11Application>();
+
+ if (!x11Interface) return;
+
+ auto connection = x11Interface->connection();
+
+ auto role = newRole.toStdString();
+
+ char WM_WINDOW_ROLE[] = "WM_WINDOW_ROLE";
+ auto cookie = xcb_intern_atom(connection, false, std::size(WM_WINDOW_ROLE) - 1, WM_WINDOW_ROLE);
+ xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(connection, cookie, nullptr);
+ auto atom = reply ->atom;
+ free(reply);
+
+ xcb_change_property(connection, XCB_PROP_MODE_REPLACE, win->winId(),
+ atom, XCB_ATOM_STRING, 8,
+ role.size(), role.data());
}
|