On what VT am I?
Glynn Clements
glynn at gclements.plus.com
Thu Feb 2 18:26:38 PST 2006
Tim Dijkstra wrote:
> > > I have a setup with different users having X sessions on several
> > > virtual terminals. I want a certain app to know if it belongs to
> > > the current virtual terminal or not. Now I know how to query the
> > > console to ask which is the active virtual terminal. I can't figure
> > > out however how to ask the xserver on which VT it runs. I can get
> > > the display string of course. And although usually vt(7+n) == :n
> > > this isn't guarantied.
> >
> > On Linux the VT of $DISPLAY is:
> >
> > fuser /dev/tty* 2>&1|egrep "\<$(ps aux|egrep "X(org)? .*$(echo
> > $DISPLAY| cut -d. -f1)\>"|awk '{print $2}')\>"|cut -d: -f1
>
> OK thanks, this seems to work on my system, but seems a bit fragile...
> For example: does X always have the display on the cmdline?
No.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the xorg
mailing list