Re: Detect screen-lock in shell/c++




2014-11-03 9:32 GMT+01:00 Bastien Nocera <hadess hadess net>:
On Mon, 2014-11-03 at 08:43 +0100, Mathieu Slabbinck wrote:
> I have a cross-platform application that runs on Ubuntu 14.04 (Unity &
> GNome) & Fedora (GNome). There I need to determine if the screensaver
> is active or not and if the screen is locked or not.
>
> I found out that I can get the screensaver info with:
> gnome-screensaver-command -q

As far as I know, neither Unity nor gnome-shell use gnome-screensaver
anymore. In fact, gnome-screensaver has been closed for new bugs.

Didn't know that's deprecated. Works fine still. Any idea on the correct current handling to get tis information?

> But I cannot seem to figure out how I can detect a screen lock. For
> example on Unity I can use:
>
> gdbus call -e -d com.canonical.Unity -o /com/canonical/Unity/Session -m com.canonical.Unity.Session.IsLocked
>
> but that's a Unity-specific item. So what's the best approach to get
> screen lock in GNome?

What do you actually want to do? Why do you need to detect the screen
saver? Or do you need to detect that the screen is locked?

Well the application I created should do action A when the user logs out or locks the screen, and the application should do action B when the screen saver comes up.
Simple as that.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]