Get current active window's title in Java

前端 未结 6 2023
耶瑟儿~
耶瑟儿~ 2020-12-08 17:43

I am trying to write a Java program that logs what application I\'m using every 5 seconds (this is a time tracker app). I need some way to find out what the current active w

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-08 18:13

    I've written a bash script that logs the current active window: http://www.whitelamp.com/public/active-window-logger.html It uses a patched version of wmctrl but provides details of an alternative (slower) method using xprop and xwininfo.

    The links to the wmctrl patch & source code and the script can be found above.

提交回复
热议问题