kde-plasma - 如何列出每个 KDE/Plasma5 事件的窗口

标签 kde-plasma

我正在尝试编写一个脚本,如果应用程序未运行则启动该应用程序,或者如果该窗口在当前事件中可见则激活该窗口。

使用 xdotoolwmctrl 我能够获取窗口列表并激活它们。如果它们没有打开,那么我可以启动它们。但问题来自于 KDE 事件。这些工具列出所有事件的窗口,即使它们在当前事件中不可见。

我正在研究各种 qdbus 方法,但没有找到任何接近的方法。

有人创建过这样的脚本吗?如何获得有关事件的窗口可见性?

编辑: 如下图所示,我能够看到窗口附加到的事件 ID。但是我找不到任何方法以编程方式获取它。

enter image description here

最佳答案

给出了另一种方法 in kde forum .但是否能帮助解决您的问题尚不完全清楚。

推荐如下:

On the activity level you can make use of URI > Activity relations and query dbus for further scripting. For example:

  1. Link a directory to an activity in dolphin.
  2. Add an application "dolphin-directive" to application launcher and make it run a custom script to conditionally start dolphin instances.
  3. Set "dolphin-directive" as default filemanager

A similar workflow is possible for each filetype via File Association Settings

据我通过实验发现,不可能通过 ActivityManager 将窗口链接到事件和查询关系。我猜 multiple-screen-workspace-uri-activity-window-rule 架构应该设置工作流以更全面的方式解决问题。但希望有人能在这里给出更好的答案。

I wrote a script正则表达式检查整个 session 总线树的相关和有用的方法。您可以通过 ./query-dbus.py --pattern "^.*activit.*$" 简单地使用它。所以答案还在进行中。

编辑:一些服务确实有方法 isMonitorActivity, isOnActivity

"org.kde.konsole": {
    "/Sessions/1": {
      "org.kde.konsole.Session": {
          "method": [
            "setMonitorActivity",
            "isMonitorActivity"
          ]
      }
    }
}
    

"org.kde.kate": {
    "/MainApplication": {
      "org.kde.Kate.Application": {
          "method": [
            "isOnActivity"
          ]
      }
    }
  }
}

您是否已提交功能请求?

关于kde-plasma - 如何列出每个 KDE/Plasma5 事件的窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62863205/

相关文章:

python - PyQt4-QNativeImage : Unable to attach to shared memory segment

bash - 在解锁时运行脚本?

python - 用python获取窗口标题?

printing - 用于打印 PDF 的 KDE Dolphin 服务菜单

python - 如何使用 Python 检查哪个窗口管理器正在运行?

linux - Qt 应用程序需要 KDE 吗?

linux - native KDE 寻找 Qt 5 应用程序

c++ - CMake:将库链接到 KDE4 库时 undefined reference

linux - 安装 Steam 后系统监视器不显示 CPU 历史记录、网络历史记录?

linux - 关于 c/c++ [ubuntu] gnome 或 kde 中的鼠标控制???大概