I'm running TCL11 64-bit on an x86_64 laptop. I have Xorg-7.7.tcz and fluxbox.tcz loaded. Also, I use the user=bruno boot command. For the purpose of this exercise (so that two different users are logged in--one in an X session, one in a console), I pressed Ctrl+Alt+F1 and logged in as tc in tty1.
Therefore, in this situation, the "right answers" are that the X11 session's user is bruno and the display happens to be :0.0 . How would a shell script find this information?
To my surprise, if I run the who command in tty1 I don't even see evidence that user bruno is logged in:
tc@box:~$ who
tc tty1 00:00 Nov 25 08:33:42
The last command is similarly unhelpful.
The ps command is not helpful, either, because the X server is started by root and not by bruno:
bruno@box:~$ ps -ef | grep X
6462 root /usr/local/lib/xorg/Xorg -nolisten tcp
17653 bruno grep X
I found this
https://unix.stackexchange.com/a/117099 but in TCL Xorg's PPID is 1 so the display manager approach is not going to work.
If X is running then one can
assume that the X session's user is "cat /etc/sysconfig/tcuser" and that the display is ":0.0" but I don't want to make assumptions.
So how would a shell script running in TCL find active X11 session's user and display, without making assumptions?