How to determine if screensaver is active on another session
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
You can detect if a user's screensaver is active via:
gnome-screensaver-command -q
I'm trying to create a daemon to perform actions when the user is inactive, but I'm finding this command always returns false when not run from inside the user's session. For example, these variants all report the screensaver is inactive, even when it's active:
sudo gnome-screensaver-command -q
sudo -u myuser gnome-screensaver-command -q
Why is this, and how do I check the status of a user's screen from a different user like root?
command-line screen-lock screensaver
add a comment |Â
up vote
1
down vote
favorite
You can detect if a user's screensaver is active via:
gnome-screensaver-command -q
I'm trying to create a daemon to perform actions when the user is inactive, but I'm finding this command always returns false when not run from inside the user's session. For example, these variants all report the screensaver is inactive, even when it's active:
sudo gnome-screensaver-command -q
sudo -u myuser gnome-screensaver-command -q
Why is this, and how do I check the status of a user's screen from a different user like root?
command-line screen-lock screensaver
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
You can detect if a user's screensaver is active via:
gnome-screensaver-command -q
I'm trying to create a daemon to perform actions when the user is inactive, but I'm finding this command always returns false when not run from inside the user's session. For example, these variants all report the screensaver is inactive, even when it's active:
sudo gnome-screensaver-command -q
sudo -u myuser gnome-screensaver-command -q
Why is this, and how do I check the status of a user's screen from a different user like root?
command-line screen-lock screensaver
You can detect if a user's screensaver is active via:
gnome-screensaver-command -q
I'm trying to create a daemon to perform actions when the user is inactive, but I'm finding this command always returns false when not run from inside the user's session. For example, these variants all report the screensaver is inactive, even when it's active:
sudo gnome-screensaver-command -q
sudo -u myuser gnome-screensaver-command -q
Why is this, and how do I check the status of a user's screen from a different user like root?
command-line screen-lock screensaver
command-line screen-lock screensaver
edited Oct 3 '16 at 23:40
Jeff Schaller
33.7k851113
33.7k851113
asked Oct 3 '16 at 22:58
Cerin
3841517
3841517
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
I know that it's a bit late but maybe some other people can read the answer now.
The problem is with dbus. You need to export the right variable before running the gnome-screensaver-command
.
First you need to know the uid of the user. I exported also the DISPLAY
of the user. You can get its value using the command w
sudo -u myuser DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$UID_OF_MYUSER/bus DISPLAY=:0 gnome-screensaver-command --query
This worked with Debian 9 and gnome-screensaver-command 3.6.1
New contributor
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
I know that it's a bit late but maybe some other people can read the answer now.
The problem is with dbus. You need to export the right variable before running the gnome-screensaver-command
.
First you need to know the uid of the user. I exported also the DISPLAY
of the user. You can get its value using the command w
sudo -u myuser DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$UID_OF_MYUSER/bus DISPLAY=:0 gnome-screensaver-command --query
This worked with Debian 9 and gnome-screensaver-command 3.6.1
New contributor
add a comment |Â
up vote
1
down vote
I know that it's a bit late but maybe some other people can read the answer now.
The problem is with dbus. You need to export the right variable before running the gnome-screensaver-command
.
First you need to know the uid of the user. I exported also the DISPLAY
of the user. You can get its value using the command w
sudo -u myuser DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$UID_OF_MYUSER/bus DISPLAY=:0 gnome-screensaver-command --query
This worked with Debian 9 and gnome-screensaver-command 3.6.1
New contributor
add a comment |Â
up vote
1
down vote
up vote
1
down vote
I know that it's a bit late but maybe some other people can read the answer now.
The problem is with dbus. You need to export the right variable before running the gnome-screensaver-command
.
First you need to know the uid of the user. I exported also the DISPLAY
of the user. You can get its value using the command w
sudo -u myuser DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$UID_OF_MYUSER/bus DISPLAY=:0 gnome-screensaver-command --query
This worked with Debian 9 and gnome-screensaver-command 3.6.1
New contributor
I know that it's a bit late but maybe some other people can read the answer now.
The problem is with dbus. You need to export the right variable before running the gnome-screensaver-command
.
First you need to know the uid of the user. I exported also the DISPLAY
of the user. You can get its value using the command w
sudo -u myuser DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$UID_OF_MYUSER/bus DISPLAY=:0 gnome-screensaver-command --query
This worked with Debian 9 and gnome-screensaver-command 3.6.1
New contributor
New contributor
answered yesterday
Fabio Zoratti
111
111
New contributor
New contributor
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f314124%2fhow-to-determine-if-screensaver-is-active-on-another-session%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password