|
|
||
Understanding X Session Alt-Fn Keyboard Assignments© Copyright Darrell Anderson. By default most single desktop workstation inittab files establish six consoles or virtual terminals. These terminals often are referred to with the acronym tty, which is derived from years ago when terminals were teletype machines. Unlike a mainframe environment where many actual terminals (keyboards) are connected to one computer, with a modern single desktop computer typically only one keyboard is attached. However, all ‘nix systems are multi-user by design. Thus, virtual terminals are used, that is, different terminal sessions such that users simulate working from a different terminal or keyboard. Scroll through a typical inittab file to a section that looks something like this: c1:1235:respawn:/sbin/agetty 38400 tty1 linuxc2:1235:respawn:/sbin/agetty 38400 tty2 linux c3:1235:respawn:/sbin/agetty 38400 tty3 linux c4:1235:respawn:/sbin/agetty 38400 tty4 linux c5:1235:respawn:/sbin/agetty 38400 tty5 linux c6:12345:respawn:/sbin/agetty 38400 tty6 linux Each line instructs the init command to establish a console or virtual terminal session. After booting into GNU/Linux and the text-based login screen appears, a user can toggle to any of these six consoles using a standardized keyboard shortcut of Alt-Fn, where Fn represents a function key and the n represents a respective console number. Thus, Alt-F1 is the keyboard shortcut to toggle to console 1 (tty1), Alt-F2 for console 2 (tty2), etc., all the way through Alt-F6 for console 6 (tty6). One does not have to be logged in to toggle among these six consoles. The X graphical server uses the same approach toward assigning keyboard shortcuts to toggle to various X screen sessions, as well as being able to continue toggling among console sessions. With respect to screen numbering, the X graphical server differs from init only in the name designations and the additional use of the Ctrl key. X uses the prefix of vt whereas init establishes tty sessions. Unless explicitly instructed otherwise, the X graphical server assigns the first vt number in sequence with the number of existing tty consoles. The additional Ctrl key is necessary because by conventional design, within most X environments the Alt key is an active modifier key to perform basic graphical environment tasks. For example, in KDE the keyboard shortcut of Alt-F2 does not toggle to tty2 but instead launches the Run command dialog box. To toggle to console tty2 requires Ctrl-Alt-F2. With the typical GNU/Linux distribution, six tty consoles are established. Most people never modify the six tty consoles that most distros provide in /etc/inittab. Typically, then, the next available virtual terminal is vt7. But even if inittab is modified for fewer than 6 tty consoles, the subsequent Ctrl-Alt-Fn keyboard shortcut assignment corresponds with the assigned vt number. For most people the vt keyboard assignments will be Ctrl-Alt-F7 through Ctrl-Alt-F12 because 6 ttys are enabled. However, if a user edits inittab to enable only 3 tty consoles, then X assigns the next virtual terminal to vt4. The number is always sequential with respect to the existing tty consoles unless explicitly instructed otherwise. Users can explicitly circumvent this automatic assignment. With the startx script (/usr/X11R6/bin) this is performed by passing additional command line parameters: startx -- :0 vt7 Or, users can manually edit the startx script to permanently modify the script variables. When using display managers (graphical login managers) such as XDM or KDM, modify the Xservers file (XDM: /etc/X11/xinit; KDM: /opt/kde/share/config/kdm) to explicitly assign the vt terminal. For example: :0 local@tty1 /usr/X11R6/bin/X :0 vt7 Thus, even if establishing only three tty consoles within inittab, notice the explicit assignment of the vt number. With the previous examples, the explicit assignment means that the X session virtual terminal number will be vt7 rather than vt4. Finis. |
||