Powered By GitBook
106.1. Install and configure X11

106.1 Install and configure X11

Weight: 2
Description: Candidates should be able to install and configure X11.
Key Knowledge Areas:
    Verify that the video card and monitor are supported by an X server
    Awareness of the X font server
    Basic understanding and knowledge of the X Window configuration file
Terms and Utilities:
    /etc/X11/xorg.conf
    xhost
    DISPLAY
    xwininfo
    xdpyinfo
    X
In the days of very expensive computers that were shared among many users, X terminals provided a low cost way for many users to share the resources of a single computer. Nowadays computers have become as much powerful that no one doesn't think about sharing resources, but there are some history lessons which should know about!

X

The X Window System, often known as X, is a windowing system for graphics workstations developed at MIT. It is based on a client/server model : The client/server model in X system works in reverse to typical client/server model, where the client runs on the local machine and asks for services from the server. In X system, the server runs on the local machine and provides its display and services to the client programs. The client programs may be local or remotely exist over different networks, but X serverc appear transparently.
X11 display server protocol
Beside displaying the windows for the clients(applications ) The X server also handles input devices such as keyboards, mice, and touchscreens
XOrg Server was the free and open-source implementation of the display server for the X Window System managed by the X.Org Foundation. The X11 name points to X Windows version 11.
In many modern linux distributions , the Display manager server still exists, but X Window has been replaced by new solutions like wayland.

/etc/X11/xorg.conf

The file xorg.conf is a file used for configuring the X.Org Server. xorg.conf usually is located in /etc/X11/xorg.conf but that does not exist any more on modern linux distributions , so we use a sample xorg.conf to explain that.
The xorg.conf configuration file is organized into sections which may be specified in any order. The general section format is
Section "SectionName"
SectionEntry ...
EndSection
Lets take a quick look at most important ones:
    Files - pathnames for files such as fontpath
1
Section "Files"
2
FontPath "/usr/share/X11/fonts/misc"
3
FontPath "/usr/share/X11/fonts/100dpi/:unscaled"
4
FontPath "/usr/share/X11/fonts/75dpi/:unscaled"
5
FontPath "/usr/share/X11/fonts/Type1"
6
FontPath "/usr/share/X11/fonts/100dpi"
7
FontPath "/usr/share/X11/fonts/75dpi"
8
FontPath "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
9
EndSection
Copied!
    Module - which modules to load
1
Section "Module"
2
Load "bitmap"
3
Load "ddc"
4
Load "dri"
5
Load "extmod"
6
Load "freetype"
7
Load "glx"
8
Load "int10"
9
Load "type1"
10
Load "vbe"
11
EndSection
Copied!
For example glx takes care of 3d graphical effects.
    InputDevice - keyboard and pointer (mouse)
1
Section "InputDevice"
2
Identifier "Generic Keyboard"
3
Driver "kbd"
4
Option "CoreKeyboard"
5
Option "XkbRules" "xorg"
6
Option "XkbModel" "pc105"
7
Option "XkbLayout" "us"
8
EndSection
9
10
Section "InputDevice"
11
Identifier "Configured Mouse"
12
Driver "mouse"
13
Option "CorePointer"
14
Option "Device" "/dev/input/mice"
15
Option "Protocol" "ImPS/2"
16
Option "Emulate3Buttons" "true"
17
Option "ZAxisMapping" "4 5"
18
EndSection
19
20
Section "InputDevice"
21
Identifier "Synaptics Touchpad"
22
Driver "synaptics"
23
Option "SendCoreEvents" "true"
24
Option "Device" "/dev/psaux"
25
Option "Protocol" "auto-dev"
26
Option "RightEdge" "5000"
27
EndSection
Copied!
These InputDevice sections are configured for any input devices, such as touchpads, mice, keyboards, that you may have plugged in to your system.
    Monitor - display device description
1
Section "Monitor"
2
Identifier "Generic Monitor"
3
Option "DPMS"
4
EndSection
Copied!
    Device - video card description/information
1
Section "Device"
2
Identifier "ATI Technologies, Inc. Radeon Mobility 7500 (M7 LW)"
3
Driver "radeon"
4
BusID "PCI:1:0:0"
5
Option "DynamicClocks" "on"
6
7
Option "CRT2HSync" "30-80"
8
Option "CRT2VRefresh" "59-75"
9
10
Option "MetaModes" "1024x768 800x600 640x480 1024x768+1280x1024"
11
12
Option "XAANoOffscreenPixmaps" "true"
13
EndSection
14
Copied!
    Screen - binds a video adapter to a monitor
1
Section "Screen"
2
Identifier "Screen0"
3
Device "Screen0 ATI Technologies, Inc. Radeon Mobility 7500 (M7 LW)"
4
Monitor "Generic Monitor"
5
DefaultDepth 24
6
SubSection "Display"
7
Depth 1
8
Modes "1024x768"
9
EndSubSection
10
SubSection "Display"
11
Depth 4
12
Modes "1024x768"
13
EndSubSection
14
SubSection "Display"
15
Depth 8
16
Modes "1024x768"
17
EndSubSection
18
SubSection "Display"
19
Depth 15
20
Modes "1024x768"
21
EndSubSection
22
SubSection "Display"
23
Depth 16
24
Modes "1024x768"
25
EndSubSection
26
SubSection "Display"
27
Depth 24
28
Modes "1024x768"
29
EndSubSection
30
EndSection
Copied!
    ServerLayout - binds one or more screens with one or more input devices
1
Section "ServerLayout"
2
Identifier "DefaultLayout"
3
Screen "Default Screen"
4
InputDevice "Generic Keyboard"
5
InputDevice "Configured Mouse"
6
InputDevice "Synaptics Touchpad"
7
EndSection
Copied!

xwininfo

There may be situations where-in we need to fetch detailed information about an application window on our Linux system. For example, we might need to get the size and position of the window.
xwininfo is the tool that'll help us in this case. It's basically a window information utility for X (or X-Windows system). It gives Various information about that window depending on which options are selected. Information like size, position, color, depth, … .
1
[email protected]:~# xwininfo
2
3
xwininfo: Please select the window about which you
4
would like information by clicking the
5
mouse in that window.
6
7
xwininfo: Window id: 0x320000a "[email protected]: ~"
8
9
Absolute upper-left X: 65
10
Absolute upper-left Y: 52
11
Relative upper-left X: 0
12
Relative upper-left Y: 0
13
Width: 732
14
Height: 410
15
Depth: 32
16
Visual: 0x2a0
17
Visual Class: TrueColor
18
Border width: 0
19
Class: InputOutput
20
Colormap: 0x3200009 (not installed)
21
Bit Gravity State: NorthWestGravity
22
Window Gravity State: NorthWestGravity
23
Backing Store State: NotUseful
24
Save Under State: no
25
Map State: IsViewable
26
Override Redirect State: no
27
Corners: +65+52 -3+52 -3-138 +65-138
28
-geometry 80x24--7+14
Copied!

xdpyinfo

Xdpyinfo is a utility for displaying information about an X server.
1
[email protected]:~# xdpyinfo
2
name of display: :0
3
version number: 11.0
4
vendor string: The X.Org Foundation
5
vendor release number: 11906000
6
X.Org version: 1.19.6
7
maximum request size: 16777212 bytes
8
motion buffer size: 256
9
bitmap unit, bit order, padding: 32, LSBFirst, 32
10
image byte order: LSBFirst
11
number of supported pixmap formats: 7
12
supported pixmap formats:
13
depth 1, bits_per_pixel 1, scanline_pad 32
14
depth 4, bits_per_pixel 8, scanline_pad 32
15
depth 8, bits_per_pixel 8, scanline_pad 32
16
depth 15, bits_per_pixel 16, scanline_pad 32
17
depth 16, bits_per_pixel 16, scanline_pad 32
18
depth 24, bits_per_pixel 32, scanline_pad 32
19
depth 32, bits_per_pixel 32, scanline_pad 32
20
keycode range: minimum 8, maximum 255
21
focus: window 0x320000b, revert to Parent
22
number of extensions: 29
23
BIG-REQUESTS
24
Composite
25
DAMAGE
26
...
Copied!

xhost

As we said X is designed to be network transparent, so that an X server can display windows from local or networked application sources.
The primary command for executing these network activities is xhost — the server access control program for X. Typically, remote access will be disabled, as it poses a security risk. But, if you need to run a GUI application on a remote computer, and have the GUI show up on your own screen, XHOST can be used to allow the remote computer. let get started:
    xhost with no option tells us the access status:
2
access control enabled, only authorized clients can connect
3
SI:localuser:user1
Copied!
    xhost + : Turns off access control (all remote hosts will have access to X server)
    xhost - : Turns access control back on.
1
2
access control disabled, clients can connect from any host
3
4
access control enabled, only authorized clients can connect
Copied!
    xhost + hostname: Adds hostname to X server access control list.
    xhost - hostname: Removes hostname from X server access control list.
1
[email protected]:~# xhost +172.16.43.136
2
172.16.43.136 being added to access control list
3
5
access control enabled, only authorized clients can connect
6
INET:172.16.43.136 (no nameserver response within 5 seconds)
7
SI:localuser:user1
8
9
[email protected]:~# xhost -172.16.43.136
10
172.16.43.136 being removed from access control list
Copied!
The xhost program is used to add and delete user names to the list allowed to make connections to the X server:
    xhost +si:localuser:some_user Grants "some_user" access to the "localuser" X, (localuser refers to the user who is currently logged in.)
    xhost -si:localuser:some_user Revokes access of "some_user".
1
[email protected]:~# xhost +si:localuser:payam
2
localuser:payam being added to access control list
3
5
access control disabled, clients can connect from any host
6
SI:localuser:payam
7
SI:localuser:user1
8
9
[email protected]:~# xhost -si:localuser:payam
10
localuser:payam being removed from access control list
Copied!

DISPLAY

The magic word in the X window system is DISPLAY. A display consists (simplified) of:
    a keyboard,
    a mouse
    and a screen.
A DISPLAY is managed by X server program. The server serves displaying capabilities to other programs that connect to it. The remote server knows where it have to redirect the X network traffic via the definition of the DISPLAY environment variable which generally points to an X Display server located on your local computer.
1
[email protected]:~# echo $DISPLAY
2
:0
Copied!
The value of the display environment variable is: hostname:D.S
where:
    hostname is the name of the computer where the X server runs. An omitted hostname means the localhost.
    D is a sequence number (usually 0). It can be varied if there are multiple displays connected to one computer.
    S is the screen number. A display can actually have multiple screens. Usually there's only one screen though where 0 is the default.
:0.0 means that we are talking about the first screen attached to your first display in your local host
We can change the DISPLAY environment and connect my graphical output to another machine.
1
[email protected]:~# export DISPLAY=172.16.43.136:0
Copied!
In this case if a graphical program is run , its output (windows) will be shown on another machine
When using the OpenSSH ssh command on Linux, the -X option can be used to specify X11 forwarding.
.
.
.
.
Last modified 1yr ago