【问题标题】:How to get the pid of the focused window on GNOME (Wayland)How to get the pid of the focused window on GNOME (Wayland)
【发布时间】:2022-12-19 04:33:40
【问题描述】:
xdotool getactivewindow getwindowpid

I tried this. But it's not working on Wayland. As far as i know. There is no focus window concept on Wayland. So can I get it from Mutter or GNOME-Shell?

【问题讨论】:

  • I wish that ability too. My current best is using Looking Glass. "[Alt+F2] lg [Enter]" to open it. It does not tell pid but it shows app name, which I can then search in System Monitor and not have to look through tens of processes. There you can get PID or kill the app directly. I hope this helps.

标签: gnome gnome-shell


【解决方案1】:

The following works with Gnome 43:

  1. Install https://extensions.gnome.org/extension/4974/window-calls-extended/
  2. Run gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell/Extensions/WindowsExt --method org.gnome.Shell.Extensions.WindowsExt.FocusPID | sed -E "s/\('(.*)',\)/\1/g" to get the PID of the focussed window or use a different method.

【讨论】:

    猜你喜欢
    • 2022-12-01
    • 2022-12-02
    • 2022-12-01
    • 2022-12-01
    • 2022-12-02
    • 2022-12-02
    • 2022-12-16
    • 2022-12-27
    • 2022-12-28
    相关资源
    最近更新 更多