Any reliable way to find the X11 display id and authority file for local session running in actual monitor.
Michal Srb
msrb at suse.com
Wed Aug 2 15:54:46 UTC 2017
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
More information about the xorg
mailing list