Hi, I would say a systematic way to do it is using the systemd/logind dbus api.
You can see the information using the command line tool: # loginctl show-seat seat0 Id=seat0 ActiveSession=1 <- interesting CanMultiSession=yes CanTTY=yes CanGraphical=yes Sessions=1564 1 IdleHint=no IdleSinceHint=0 IdleSinceHintMonotonic=0 # loginctl show-session 1 Id=1 User=1000 Name=michal Timestamp=Mon 2017-07-24 08:42:22 CEST TimestampMonotonic=42458199 VTNr=7 Seat=seat0 Display=:0 <- interesting Remote=no Service=xdm-np Scope=session-1.scope Leader=3132 <- interesting Audit=1 Type=x11 Class=user Active=yes State=active IdleHint=no IdleSinceHint=0 IdleSinceHintMonotonic=0 No idea about reliable way to find the authority file. Parsing the X's command line would probably work in most cases. Michal Srb _______________________________________________ xorg@lists.x.org: X.Org support Archives: http://lists.freedesktop.org/archives/xorg Info: https://lists.x.org/mailman/listinfo/xorg Your subscription address: %(user_address)s