All notes
Xorg

Intro

Regenerate xorg.conf

X :2 -configure 

# Switch to Non-GUI mode.
init 1

# Regenerate xorg.conf.
Xorg -config /etc/X11/xorg.conf

Commands

startx, xinit

startx looks at those in order:

  1. ~/.xinitrc
  2. xinitrc in the xinit library directory.
  3. To determine the server to run, startx first looks for a file called .xserverrc in the user's home directory. If that is not found, it uses the file xserverrc in the xinit library directory.
  4. The system-wide xinitrc and xserverrc files are found in the /etc/X11/xinit directory.
  5. For gnome, add to the ~/.xinitrc file: exec gnome-session.

~/.xinitrc

~/.vnc/xstartup

xstartup used to start gnome

ArchBBS.

#!/bin/bash
export XKL_XMODMAP_DISABLE=1
exec gnome-session

Xorg

Xorg -config file
	# Read the server configuration from file.
Xorg -configdir directory
	# Read the server configuration files from directory.
Xorg -configure
	# When this option is specified, the Xorg server loads all video driver modules, probes for available hardware, and writes out an initial xorg.conf file based on what was detected. This option is only available when the server is run as root (i.e, with real-uid 0).

# If you are already running an X server, use a different display, for example
Xorg :2 -configure

xhost

The xhost program is used to add and delete host names or user names to the list allowed to make connections to the X server.

51cto. xhost 是用来控制X server访问权限的。 通常当你从hostA登陆到hostB上运行hostB上的应用程序时, 做为应用程序来说,hostA是client,但是作为图形来说, 是在hostA上显示的,需要使用hostA的Xserver,所以hostA是 server.因此在登陆到hostB前,需要在hostA上运行xhost + 来使其它用户能够访问hostA的Xserver. xhost + 是使所有用户都能访问Xserver. xhost + ip使ip上的用户能够访问Xserver. xhost + nis:[email protected]使domain上的nis用户user能够访问 xhost + inet:[email protected]使domain上的inet用户能够访问。

ArchWiki on Xhost.

# To provide access to an application running as sudo or su to the graphical server (aka your X session aka your computer screen), open a terminal and type as your normal user (don't su -):
xhost +local:

# Disable access control. Access is granted to everyone.
xhost +

#To get things back to normal, with controlled access to the X screen:
xhost -

EDID

Wikipedia. Extended display identification data (EDID) is a data structure provided by a digital display to describe its capabilities to a video source (e.g. graphics card or set-top box).

FAQ

Start a GUI on a remote Linux PC via SSH

AskUbuntu.

# Option 1.
ssh tim "DISPLAY=:0 nohup firefox"

# Option 2.
vncviewer -via [email protected] localhost:0

X won't start without a monitor attached

UbuntuForum.

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    Option         "ConnectedMonitor" "DFP-1"
    Option         "IgnoreEDID" "TRUE"
    Option         "UseEDID" "FALSE"
    Option         "ModeValidation" "NoEdidModes"
    VendorName     "NVIDIA Corporation"
EndSection

Number of created screens does not match number of detected devices.

CentOS. Remove nomodeset option from kernel param.

nomodeset
The newest kernels have moved the video mode setting into the kernel. So all the programming of the hardware specific clock rates and registers on the video card happen in the kernel rather than in the X driver when the X server starts.. This makes it possible to have high resolution nice looking splash (boot) screens and flicker free transitions from boot splash to login screen. Unfortunately, on some cards this doesnt work properly and you end up with a black screen. Adding the nomodeset parameter instructs the kernel to not load video drivers and use BIOS modes instead until X is loaded.

/etc/X11/xorg.conf

See Gentoo on Xorg.conf for more info.

Sections

Each other line in a section define a value to an option. The value can be of the following types:

The special option named "Option" accepts also the additional types:

Note also that the Option values must be enclosed in double quote marks ("").

InputDevice

InputClass

Device

Screen

Section "ServerLayout"
    Identifier     "X.org Configured"
    Screen      0  "Screen0" 0 0
    InputDevice    "Mouse0" "CorePointer"
    InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
    ModulePath      "/usr/lib64/xorg/modules"
    FontPath        "catalogue:/etc/X11/fontpath.d"
    FontPath        "built-ins"
EndSection

Section "Module"
    Load           "glx"
EndSection

Section "InputDevice"
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "InputDevice"
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/input/mice"
    Option         "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Monitor Vendor"
    ModelName      "Monitor Model"
EndSection

Section "Device"
    Identifier     "Card0"
    Driver         "nvidia"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Card0"
    Monitor        "Monitor0"
    DefaultDepth    24
    SubSection     "Display"
        Viewport    0 0
        Depth       1
    EndSubSection
    SubSection     "Display"
        Viewport    0 0
        Depth       4
    EndSubSection
	SubSection     "Display"
        Viewport    0 0
        Depth       16
    EndSubSection
    SubSection     "Display"
        Viewport    0 0
        Depth       24
    EndSubSection
EndSection

Display

ArchWiki.

Type command "w", it shows:

USER	TTY		FROM
user1	tty1	:0
user2	tty2	-
user3	pts/0	192.168.0.2
user4	pts/1	:0.0
Wcf note:

RandR

RandR (Rotate and Resize) is an X Window System extension, which allows clients to dynamically change (e.g. resize, rotate, reflect) screens. In most cases, it can fully replace the old Xinerama setup.

# Query
xrandr -q

# Set DPI manually.
xrandr --dpi 144

xrandr --output VGA1 --auto --output HDMI1 --auto --right-of VGA1
# --right-of places the previous screen (HDMI1) to the right of the specified screen (VGA1).

# VGA1 right of HDMI1 at fixed resolutions
xrandr --output VGA1 --mode 1024x768 --pos 1920x0 --output HDMI1 --mode 1920x1080 --pos 0x0
# or
$ xrandr --output VGA1 --mode 1024x768 --output HDMI1 --mode 1920x1080 --left-of VGA1
# --left-of places the previous screen (HDMI1) to the left of the specified screen (VGA1). 

Configuration using xorg.conf

This is similar to using xrandr, separate Monitor section is needed for each screen. As an Identifier, the same value as reported by xrandr -q is used (i.e. Identifier "VGA1" is used instead of --output VGA1).

Example: dualhead configuration using relative coordinates

/etc/X11/xorg.conf

Section "Monitor"
    Identifier  "VGA1"
    Option      "Primary" "true"
EndSection

Section "Monitor"
    Identifier  "HDMI1"
    Option      "LeftOf" "VGA1"
EndSection