<div dir="ltr"><div><div><div>Hi,<br><br></div>Thanks Michal. How to use Dbus API directly to get the same results?. <br>I think loginctl is missing in some old distros.<br><br><br></div>Thank you,<br><br></div>Sai Prasanna<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 2, 2017 at 9:24 PM, Michal Srb <span dir="ltr"><<a href="mailto:msrb@suse.com" target="_blank">msrb@suse.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I would say a systematic way to do it is using the systemd/logind dbus api.<br>
<br>
You can see the information using the command line tool:<br>
<br>
# loginctl show-seat seat0<br>
Id=seat0<br>
ActiveSession=1 <- interesting<br>
CanMultiSession=yes<br>
CanTTY=yes<br>
CanGraphical=yes<br>
Sessions=1564 1<br>
IdleHint=no<br>
IdleSinceHint=0<br>
IdleSinceHintMonotonic=0<br>
<br>
# loginctl show-session 1<br>
Id=1<br>
User=1000<br>
Name=michal<br>
Timestamp=Mon 2017-07-24 08:42:22 CEST<br>
TimestampMonotonic=42458199<br>
VTNr=7<br>
Seat=seat0<br>
Display=:0 <- interesting<br>
Remote=no<br>
Service=xdm-np<br>
Scope=session-1.scope<br>
Leader=3132 <- interesting<br>
Audit=1<br>
Type=x11<br>
Class=user<br>
Active=yes<br>
State=active<br>
IdleHint=no<br>
IdleSinceHint=0<br>
IdleSinceHintMonotonic=0<br>
<br>
<br>
No idea about reliable way to find the authority file. Parsing the X's command<br>
line would probably work in most cases.<br>
<span class="HOEnZb"><font color="#888888"><br>
Michal Srb<br>
</font></span></blockquote></div><br></div>