|Last modified: 16-06-2020|
Unlike Windows where applications simply call some API to send stuff to the screen, GUI-based applications in Linux require an X server that takes care of handling keyboards and monitors. In other words, in X, applications are clients connecting to the X server to receive keyboard events and outputing data to the monitor.
Low resolution, eg. 800x600@60Hz while your graphic card + monitor can handle much higher resolutions
Picture incorrectly left- or right-aligned, ie. there's some bit missing on either side
Proprietary drivers (Nvidia) vs. open-source (nv, Nouveau)
Run X once, then check its /var/log/Xorg.0.log file for information on your hardware.
Make sure Linux has the right driver for your video card
If Xorg can't figure out the right settings for your display (monitor and video card), create and fine-tune its xorg.conf file.
You can also use "gtf" (command-line) and "xvidtune" (X application) to get hardware information.
If you are double-booting, you can use the Windows shareware PowerStrip to get the capabilities of your graphic card and monitor, and use those to fix issues you might have in X.
CTRL-ALT-Fx to switch to/from X and text mode
To kill X in case "init 3" or CTRL-ALT-Backspace are disabled: Either through a script in /etc/init.d/, or "ps aux | grep X ; kill <pid of X>"
In a running X session, open an xterm console:
Note that xorg 7.3 uses "xrandr" to set the resolution to what it thinks it should be (apparently, xrandr reads the DCC information from the monitor), and "gtf" is part of the xserver-xorg-core package.
If Xorg is now using a definition that is higher than you'd like, eg. 1200x1024 instead of 1024x768:
# joe /etc/X11/xorg.conf:
export DISPLAY=":0" means that the X server is running on the local computer, and should be reached through a local connection (eg. Unix domain socket), while export DISPLAY="localhost:0" will use TCP/IP.
RANDR: Stands for rotate and resize. Notifies clients when the display is resized to a new resolution or rotated.
X can be started manually by calling it directly "$ X", which is a symlink to Xorg. You can also add a configuration file with "-config myconfig.file". However, to get a client running, use "$ X -terminate & sleep 2; DISPLAY=:0 xterm" to get a terminal console.
A more user-friendly wrapper is available: $ startx /usr/bin/xterm -- :0 -config /etc/testconfig
If startx is launched without any argument, it will run clients listed in either ~/.xinitrc or /etc/X11/xinit/xinitrc.
CTRL-ALT-Backspace being a bit rough as a way to exit X, it's usually disabled through DontZap in xorg.conf.
A "display manager" is the GUI equivalent of the "login" program. Once the user has logged on, the display manager will usually present client applications such as a window manager, and a desktop environment (KDE, GNOME, XFCE, etc.) Major display managers are GDM (Gnome), KDM (KDE), and XDM (Xt; Old).
By default, Debian-based systems (including Ubuntu) start the display manager in all runlevels. You can easily disable the startup of the display manager in runlevel 3 by executing these commands:
Enhances character-based applications like Midnight Commander or Joe use a curses library, which checks the TERM environment variable and uses a database to determine the capabilities supported by that terminal; those applications use the OS' termios interface to control input. Since X doesn't understand character-based applications, an application known as a terminal emulator is required to act as a bridge: xterm, gnome-terminal, konsole, etc.
Desktop environments are program suites to manage panels, desktop background, session manage, window manager, etc. As a lighter alternative, some window managers handle a subset of those features.
An X session = character-mode login
A session manager = saves/restores session state so the user can log out and log back in without losing information
The Xfce session manager is started using "startxfce4".
Screen = Monitor + Device (video card)
ServerLayout = Input device (keyboard, mouse) + Screen
To find out which modes are available for a particular monitor and video card, run X once and check /var/log/Xorg.log.0. For instance, "NVIDIA(0): Default mode "1024x768": 78.8 MHz, 60.1 kHz, 75.1 Hz" means that the dot clock (speed at which pixels are sent to the display) runs at 78.8MHz, the horizontal refresh rate is 60.1kHz, and the vertical refresh rate is 75.1Hz.
The level of log detail can be adjusted using the -logverbose level command-line option, where level is a number from 0 to 9. The default is level 3; higher levels introduce a bit more detail, notably the actual contents of the EDID decoded into readable strings.
Screen resolution can be set either dynamically by running "xrandr" within an X session, or statically by adding a Screen section in xorg.conf.
Use the VESA driver (Video Electronics Standard Association) if you don't know which driver to use to get started.
DPMS is a VESA standard that conserves energy by using the horizontal and vertical sync signals to select one of four power states. DPMS is enabled on a monitor-by-monitor basis by adding an option to the Monitor section of the config file: Option "DPMS"
DDC (Display Data Channel) is a VESA technology to probe the monitor's capabilities, and even control the monitor settings. Data blocks returned by the monitor are formatted according to the EDID (Extended Display Identification Data) format.
Note that DDC can't be used when the monitor is indirectly connected through a KVM, in which case, you need to specify the horizontal and vertical sync frequencies that will work with the monitor by adding two entries in the Monitor section: HorizSync and VertRefresh.
If you can't find the specs of your monitor, here's a basic rule:
HorizSync = VertRefresh * (VerticalResolution + 40) / 1000
You should use a range instead of discret values, eg. "HorzSync 59.6 - 61.6" and "VertRefresh 74.0 - 76.0".
Note that changing resolution from eg. 1280x1024 to 800x600 doesn't change the size of the screen image; You can then scroll the display using the mouse. You can change resolutions as set in the "Modes" line through CTRL-ALT-+ and CTRL-ALT--.
If you want to change the resolution and screen size at the same time, use "xrandr" to check what sizes are available, followed by "xrandr -s" to select a size, eg. "xrandr -s 3" or "xrandr -s 1280x800". Use the "r" option to change the vertical refresh rate, eg. "xrandr -r 70".
Since recent Linux distros now use udev, you might need to use "/dev/input/mice" instead of "/dev/mouse".
Option "ZAxisMapping" is used to handle scrollwheels on mice.
The XKB extension save keyboard configuration in a keyboar map. On Debian/Ubuntu, this is located under /etc/X11/xkb/. Options are selected in xorg.conf through "Xkb..." variables.
You can change the keyboard settings in a session through the "setxkbmap" command.
To display the current keyboard layout: $ xkbprint $DISPLAY keyboard.ps
xdpyinfo: information about the display
xwininfo: basic information about a window (xwininfo -root)
xset: to view/change X configuration settings
xkill: to kill the connection between X and a client, which usually stops the client application
xwd: to take a screenshot
xhost: to allow a remote client application to use the local display
xmodmap: to modify the keyboard map
dpkg-reconfigure -phigh xserver-xorg
Still starts with US keyboard:
... even after pasting the output from gtf in /etc/X11/xorg.conf?
"The X Resize, Rotate and Reflect Extension (RandR) allows clients to dynamically change X screens, so as to resize, rotate and reflect the root window of a screen. The initial X11 design did not anticipate the need for dynamic resizing and it was necessary to restart the X server to bring about the changes. However, changing the screen resolution on the fly without changing the desktop size had been available under XFree86 since the beginning. RandR extension framework brought the ability to change display characteristics without restarting the X session."