Switching Virtual Terminals

Switching virtual terminals can be done with the keyboard easily with <Alt><F#> and for graphical virtual terminals with <Ctl><Alt><F#>.

Is there a way to switch virtual terminal, both text and graphical, with a command?
 
Probably not an answer,

But this is,
 
vidcontrol -s ?

This works very well.

Can use this from a text console to another text console, or even to a graphical console. But cannot use this from a graphical console. So this is the equivalent of <Alt><F#>.

Is there an equivalent of <Ctl><Alt><F#> ?
 
from xterm try to use vidcontrol -s #num < /dev/ttyv*
not sure if it is possible

Using:

vidcontrol -s X </dev/ttyvY

Yes, if I am additionally logged into the text console (Y + 1).

So if I am in graphical console 9, and wish to switch to graphical console 10, I would have to log in to one of the text consoles first.

Almost there.
 
Switching virtual terminals can be done with the keyboard easily with <Alt><F#> and for graphical virtual terminals with <Ctl><Alt><F#>.
Can I just confirm what you mean by graphical terminal? Are you referring to XTerm via X11? Surely that keybinding depends on what window manager you use?
 
Can I just confirm what you mean by graphical terminal? Are you referring to XTerm via X11? Surely that keybinding depends on what window manager you use?


Yes, an xterm session (or similar) in X. Keybindings are irrelevant because I want to use a command.
 
Yes, an xterm session (or similar) in X. Keybindings are irrelevant because I want to use a command.
It is a bit naff but can you not send a key event to the WM via xsendkeys (i.e here)? Either modify this program or wrap it in a script.

Assuming then that your graphical terminals and on separate desktops. A specific key could be mapped to change to the respective one. Very possible in Fvwm, OpenBox, DWM, etc.
 
the combination is parsed by the X server itself not the WM
you can try sending to the root window but i doubt it will work (i dont think that events sent that way will reach the required code path)
 
Is it possible to leave terminal window opened on real computer, go home and connect through ssh, and attach to this existing terminal?
 
It is a bit naff but can you not send a key event to the WM via xsendkeys (i.e here)? Either modify this program or wrap it in a script.

Assuming then that your graphical terminals and on separate desktops. A specific key could be mapped to change to the respective one. Very possible in Fvwm, OpenBox, DWM, etc.

the combination is parsed by the X server itself not the WM
you can try sending to the root window but i doubt it will work (i dont think that events sent that way will reach the required code path)

Really, whether it works or not (which so far it does not), sending key events around to be acted upon, is a bit of a kludge, whereas what I want is the bit where it is acted upon.
 
the combination is parsed by the X server itself not the WM
you can try sending to the root window but i doubt it will work (i dont think that events sent that way will reach the required code path)
It should do. You send it to the root window and the WM hooks the event and handles it.
You often need to make sure to label the event as fake.

For OpenCDE, I integrated this tool to send events directly to the WM (not as keypresses). You should be able to get it to change virtual desktops using X11 events / atoms.

 
It should do. You send it to the root window and the WM hooks the event and handles it.
You often need to make sure to label the event as fake.

For OpenCDE, I integrated this tool to send events directly to the WM (not as keypresses). You should be able to get it to change virtual desktops using X11 events / atoms.

he does not want to change virtual desktops
he wants one of the console vt's (the classic textmode console) like switching from xterm to ttyv1 (ctrl+alt+f1)
 
So if I am in graphical console 9, and wish to switch to graphical console 10, I would have to log in to one of the text consoles first.
Would autologin to those text consoles be an option? There is an example here: https://forums.freebsd.org/threads/autologin-and-auto-run-x-server.6782/#post-43547

Be warned that it has changed a little. Your best bet is to read through the existing gettytab file where there is already a commented out autologin example for root. Just modify that one.
 
-s1 but you have to be at one of the other ttyv's
from X/xterm you may try < some other /dev/ttyvn where you are already logged or something
i don't have a freebsd desktop so I can't test
 
Back
Top