我需要在 KDE 中将焦点设置为 VirtualBox,为此我编写了一个 KWin 脚本,但我不知道如何从控制台运行它。
我尝试过的:
此 KWin 脚本可在桌面 Shell 脚本控制台中运行
如何打开桌面 Shell 脚本控制台:
按Alt+ F2,输入
运行 wm 控制台
剧本:
// Main reference: http://techbase.kde.org/Development/Tutorials/KWin/Scripting
// API: https://techbase.kde.org/Development/Tutorials/KWin/Scripting/API_4.9
// Sets focus to VirtualBox
var clients = workspace.clientList();
for (var i=0; i<clients.length; i++) {
print(clients[i].caption);
var cap = clients[i].caption;
if (cap.indexOf("- Oracle VM VirtualBox") != -1) {
workspace.activeClient = clients[i];
}
}
Run Code Online (Sandbox Code Playgroud)
但是当我尝试在 Bash 中运行它时(根据这个方法)脚本似乎没有设置,因为我收到这些错误:
Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.kde.kwin.Scripting was not provided by any …
Run Code Online (Sandbox Code Playgroud)