Getting pid and details for topmost window

前端 未结 9 1075
醉酒成梦
醉酒成梦 2020-12-04 13:08

Does anyone know how to get the PID of the top active window and then how to get the properties of the window using the PID? I mean properties like process name, program nam

9条回答
  •  南笙
    南笙 (楼主)
    2020-12-04 13:21

    I run this command on a terminal:

    sleep 5s; ps -Flwwp $(xdotool getwindowpid $(xdotool getwindowfocus))
    

    Run it, change the focus to the relevant window, wait 5 seconds, then back to terminal. Voilà!

提交回复
热议问题