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

(SOLVED): How to determine the VT of a running X session?



Jan C. Nordholz wrote:

On Wed, Feb 15, 2006 at 01:04:49PM -0600, David Berg wrote:
On 2/15/06, Marc Shapiro <mshapiro_42@yahoo.com> wrote:
Is there any way to determine the virtual terminal that an X session is
running on?
$ man -k vt
...
fgconsole (1)        - print the number of the active VT.
...

It seems to need super user privileges though.  I can see why super
user privileges should be necessary for chvt but not fgconsole.  Does
anyone know why or should it be reported as a "bug".
Apparently VT_GETSTATE doesn't work when you're under X (returns EINVAL)...
but there's an alternate solution: Marc, what about the "vtXX" commandline option
to the X server? See man XFree86 or Xorg...

Thank you! Both of these methods work just fine. I never knew about the vtxx option for the xserver (nor about the -k option for man). Since I already have aliases for startx to allow me to start the two X sessions, all I had to do was to add vt07 to one of them and vt08 to the other. Now I know that Ctl-Alt-F7 will ALWAYS get to my session and my wife can ALWAYS get to hers with Ctl-Alt-F8. Since I have an fvwm button bar at the bottom of the screen for each of us, I have also added a button that will switch to the other session using chvt. Those were exactly the commands that I needed.

--
Marc Shapiro
mshapiro_42@yahoo.com




Reply to: