[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

How to determine the VT of a running X session?

Is there any way to determine the virtual terminal that an X session is running on?

Using 'who' only tells me who is logged onto a VT, which would be fine, except that it does not show VTs with X sessions.

I have two X sessions running at the same time. One is going to be running on tty7 and the other on tty8. I want to switch from one to the other. Obviously Ctl-Alt-F7, or Ctl-Alt-F8 will do this, but, I have no way of knowing which tty the current session is using since which session is on which tty depends on the order that they were started, which might vary.

Is there a way to programmatically determine which tty is active and switch to the other. That way, regardless of which session I am using, and which tty it is attached to, a single method will switch to the other session/tty.

Alternatively, is there any way to specify which tty an X session is started on. If I can say "start this X session on tty8 even if there is no session on tty7," or "always start this X session on tty7" then I would know exactly which Ctl-Alt-Fx sequence to use to switch to the desired session.

Marc Shapiro

Reply to: