Is there a way for a Java application to detect if the screen is locked?

后端 未结 2 723
我寻月下人不归
我寻月下人不归 2021-02-14 21:43

I\'m looking for a way to know in a Java application (without JNI - it\'s a multi-platform application) can detect if the screen is locked.

For information... o

2条回答
  •  你的背包
    2021-02-14 22:23

    I don't think there is an API for that or even a way to do it all. Parsing screenshots generated by java.awt.Robot is neither platform- nor version- or even configuration-independant, and in general, I don't think "screen is locked" is a well-enough defined concept to be used in this sense - on Linux, there can be more than just one "screen" (X server), you can switch to console terminals, you can have applications running one (or more) machines display their GUIs on another machine over the network...

提交回复
热议问题