mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 23:53:58 +02:00
Set _KDE_NET_WM_DESKTOP_FILE on X11
This commit is contained in:
parent
cf8e1cfd0f
commit
c6dcc57c5e
1 changed files with 37 additions and 0 deletions
|
@ -133,6 +133,39 @@ void XCBSkipTaskbar(QWindow *window, bool skip) {
|
||||||
| XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY,
|
| XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY,
|
||||||
reinterpret_cast<const char*>(&xev));
|
reinterpret_cast<const char*>(&xev));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void XCBSetDesktopFileName(QWindow *window) {
|
||||||
|
const auto connection = base::Platform::XCB::GetConnectionFromQt();
|
||||||
|
if (!connection) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto desktopFileAtom = base::Platform::XCB::GetAtom(
|
||||||
|
connection,
|
||||||
|
"_KDE_NET_WM_DESKTOP_FILE");
|
||||||
|
|
||||||
|
const auto utf8Atom = base::Platform::XCB::GetAtom(
|
||||||
|
connection,
|
||||||
|
"UTF8_STRING");
|
||||||
|
|
||||||
|
if (!desktopFileAtom.has_value() || !utf8Atom.has_value()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto filename = QGuiApplication::desktopFileName()
|
||||||
|
.chopped(8)
|
||||||
|
.toUtf8();
|
||||||
|
|
||||||
|
xcb_change_property(
|
||||||
|
connection,
|
||||||
|
XCB_PROP_MODE_REPLACE,
|
||||||
|
window->winId(),
|
||||||
|
*desktopFileAtom,
|
||||||
|
*utf8Atom,
|
||||||
|
8,
|
||||||
|
filename.size(),
|
||||||
|
filename.data());
|
||||||
|
}
|
||||||
#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION
|
#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||||
|
|
||||||
void SkipTaskbar(QWindow *window, bool skip) {
|
void SkipTaskbar(QWindow *window, bool skip) {
|
||||||
|
@ -683,6 +716,10 @@ void MainWindow::initHook() {
|
||||||
}
|
}
|
||||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||||
|
|
||||||
|
#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||||
|
XCBSetDesktopFileName(windowHandle());
|
||||||
|
#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||||
|
|
||||||
LOG(("System tray available: %1").arg(Logs::b(trayAvailable())));
|
LOG(("System tray available: %1").arg(Logs::b(trayAvailable())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue