Hello! on x11 I am able to
qwindow->fromWinId(wid);
qwindow->hide();
to hide any window. On wayland this is no more possible, as there is no such thing as windowId. I’m trying the to use Kwin through dbus:
QStringList DbusKwin::runScript(const QString filename){
QDateTime datetime_now = QDateTime::currentDateTime();
QString since = datetime_now.toString(Qt::ISODateWithMs).replace("T", " ");
QProcess *kwin = new QProcess;
//QString filename = QCoreApplication::applicationDirPath() + "/listWindows.js";
kwin->setProgram("dbus-send");
kwin->setArguments(QStringList() << "--print-reply" << "--dest=org.kde.KWin" << "/Scripting" << "org.kde.kwin.Scripting.loadScript" << "string:" + filename);
kwin->start();
kwin->waitForFinished();
QString output = QString::fromLocal8Bit(kwin->readAllStandardOutput());
QString script_number = output.trimmed().split(" ").constLast();
kwin->setArguments(QStringList() << "--print-reply" << "--dest=org.kde.KWin" << "/" + script_number << "org.kde.kwin.Script.run");
kwin->start();
kwin->waitForFinished();
kwin->setArguments(QStringList() << "--print-reply" << "--dest=org.kde.KWin" << "/" + script_number << "org.kde.kwin.Script.stop");
kwin->start();
kwin->waitForFinished();
kwin->setProgram("journalctl");
kwin->setArguments(QStringList() << "/usr/bin/kwin_x11" << "--since" << since);
kwin->start();
kwin->waitForFinished();
QRegularExpression regex("^.*: js: >", QRegularExpression::MultilineOption);
QStringList res = QString::fromLocal8Bit(kwin->readAllStandardOutput()).trimmed().replace(regex, "").split("\n");
kwin->deleteLater();
return res;
}
so I only need a kwin script able to hide a specified window, but I can’t seem to find anything about it: running
console.log(Object.getOwnPropertyNames(workspace))
client = workspace.clientList()[3] // this will return a KWin::XdgToplevelWindow
console.log(Object.getOwnPropertyNames(client))
I only see the readonly property hidden
, but no methods to actually change the hidden state. Is there a way to do so? If there are no other options I’ll just minimize it and remove it from task manager, window switcher etc, but a hide() method would be way way better.
thanks in advance for any tip!
PS: why do the docs are missing anything about KWin::XdgToplevelWindow?