BASIC X-Windows



BASIC X-Windows

Know Your System

I guess this subtitle should really be "Know your monitor and video card!" Let's face it, if you don't have at least the basic specs on the monitor and video card of your system when installing X, you're going to pay a heavy price. Right now, when you may still have Win98 or WinME installed, go and check out exactly what the video card and monitor specs are. Don't wait! Save yourself! Stop reading this and do it!

BIOS Setting may help

Okay, if you don't have this option available, but you're still having problems with XWindows, then one of the big steps that may help is to restart your computer and change a BIOS setting and rerun the configuration.

On most computers you would press the Del key to enter your BIOS setup features. This may be different for your PC and you'll need to verify with the manufacturer's documents. Once you're in the BIOS setup, look for something labeled Plug&Play or PNP or Plug'n'Play. The setting usually offers two options, either software or hardware. On your computer the two options may be named OS vs. System.

The key difference is that one option forces your system to figure out your machine's plug'n'play devices like monitor, modem etc. The other option will force your OS to figure out plug'n'play devices. For better results when installing X-Windows or configuring it, set your Plug'n'Play BIOS option to hardware or system NOT for OS!

How to Start?

To start on the local screen, type in: startx

How to Exit?

How do you exit XWindows if there's a problem?

To get out of XWindows when a failure occurs press these 3 keys:

Ctrl Alt Backspace

Starting X Applications

Remember the XWindows Server/Client model. The GUI is the server, the application is the client. Most Xwindows applications are local (Gnome or KDE local deskptop). Sometimes we need to use an X client which needs to be run from another machine. For example you may be logged in to marie and want to run xmaple from arthur. If you just try to rlogin to arthur and then type xmaple then most likely the command will fail with the message

Error: Can't open display:

This happens because xmaple is trying to open a window on arthur but you are not on that machine. To fix this you must do two things:

1. Tell arthur to display to your display

2. Ask marie to accept input from arthur

This is accomplished with the following:

1. First find out the name of your display (that is the name of the terminal that marie is sending the display to). In a terminal window of marie type echo $DISPLAY. You should get a response like bw3.ma.utexas.edu:0.0; if you just get a blank line then type who and look for your username:

rpjudd ttyqa Sep 17 13:16 (bw3.ma.utexas.ed)

The last item will be your display (hopefully). It may get truncated, but the important part is bw3. In arthur type

export DISPLAY=bw3:0.0

or

setenv DISPLAY bw3:0.0

depending on whether your shell is Bash or C-shell respectively. To find out which you have type echo $SHELL. If the answer is /bin/bash then you have the Bash shell, while /bin/csh and /bin/tcsh are versions of the C-shell which work the same in this regard.

2. In marie type

3.

xhost arthur

to which marie will reply

arthur being added to access control list.

You may then run any X client from arthur and display it on your monitor.

The only tricky part of this is working out your display. If you are at the console of a computer such as marie (ie. the computer itself is in front of you) then the display is called marie:0.0 (this also applies to the PCs). Otherwise, you are probably using an NCD xterminal, and you need to know its name. This will either be bwnn.ma.utexas.edu or colornn.ma.utexas.edu where nn is some number.

HELP, X Doesn't Work Right!

Sometimes, installing X for the first time is like having your nails trimmed using an UZI 9mm. On occasion it's going to hurt, and it'll cost you some blood! Even though solid distributions including Mandrake and RedHat are pretty good at guiding you through XWindows configuration, I have to say it is sad that they too have left out some update files from their CDs. A number of hardware profiles are just not available on the CD you get and the best bet is to get hold of your specific distribution's technical help and ask them what to do.

Here are some trouble shooting tips:

• Again, to get the heck out of XWindows when a failure occurs press these 3 keys: Ctrl + Alt + Backspace

• Remember that in Linux, you can find files you're looking for by using the locate command. This is a BIG help for identifying where the certain file or directory is!

• If you are using a registered RedHat then you may call 1-800-348-2451

• The XWindows files that you should be aware of and likely use:

/usr/X11R6/lib/X11/XF86Config = the configuration file you may spend time editing

SuperProbe = video clock probing

Xconfigurator = configuring X manually

Can't Get to X Windows

Okay, so you run startx and end up with nothing at all, or worse an error! Arggg. Yes I've been there. I feel your pain!

You have a couple of options that might resolve the issue quickly:

1st, try to see if the issue is hardware compatibility related by simply reducing the resolution you were trying. You can do so with any of the options mentioned above, or try these commands:

system-config-display when using Fedora

drakconf or harddrake2 when using Mandrake

2nd, try a reinstall (I know it's a pain but may be needed) and this time choose a very basic and generic video setting. For example choose "generic" for video or "svga" and choose something basic like 800x600 for the resolution. This will quickly validate whether there is a hardware compatibility issue.

3rd, if there is a hardware issue, often it is because the Linux version you are installing has not yet included the right driver. Try getting a hold of a more recent version or a different flavor, or run Linux from the CD as a Live-CD using Knoppix, or Suse etc.

Customizing the Desktop Windows Manager (FWWM, others vary – see Gnome or KDE for LINUX)

Fvwm uses three files: .fvwmrc, .xsession, and .Xdefaults. This section will give some ideas about how to customize these for yourself.

.XDefaults

This file contains information about your preferences for various applications. When you run a new application it looks in this file to see if there is anything it should use and then obeys it if possible. Each application has its own set of defaults and will use these if you don't set any. There is no single system wide .Xdefaults file so you need to create your own. The file is just a list of resources which are specified as strings of the form

appname*subname*subsubname...: value

By convention, the application name is the same as the program name, but with the first letter capitalized (e.g. Emacs). Here is a selection from mine:

Xterm*vt100*font: 10x20

Xterm*saveLines: 2000

Xterm*scrollBar: true

Emacs*Background: WhiteSmoke

Emacs*cursorColor: Red3

Emacs*menubar*Font: -adobe-helvetica-bold-r-normal--14-140-75-75-p-82-iso8859-1

Emacs*menu*Font: -adobe-helvetica-bold-r-normal--14-140-75-75-p-82-iso8859-1

Emacs*popup*Font: -adobe-helvetica-bold-r-normal--14-140-75-75-p-82-iso8859-1

Emacs*font: 9x15bold

Emacs*geometry: 80x35+180+0

Emacs*region*attributeBackground: lavender

Netscape*Navigator*geometry: 760x860-0+0

Most of this is fairly easy to work out. The first three lines ensure that all my terminal windows use the 10x20 font, with 2000 lines saved and a scroll bar. Most of the other settings make sense, except for the last emacs one. This (together with a setting in my .emacs file) means that when I select a region it is colored lavender.

If you don't want to create your own then you can copy ones from various people in the department by typing for example:

cp ~rpjudd/.Xdefaults ~/.Xdefaults

You should take care that you don't put contradictory information in this file, although if you do it will just get ignored. Another thing which you need to bear in mind is that some applications are very picky about the way you specify the resources. Emacs is one of these. If you look in my defaults file you will see that in some places there are periods instead of asterisks:

emacs*menubar.foreground: Lavender

emacs*menu*Foreground: Lavender

These two lines control different resources and each one has to be in this form. Thus, if at first it seems the resource you specify doesn't take effect then it may not be in the correct format.

Once you have created your defaults, you need to tell the X server about them. You can do this by either logging out and back in again, or with the command:

xrdb -load ~/.Xdefaults

For further information on which resources may be specified look in the man pages for X (towards the end) for general resources. For a particular application look in its man pages, and also in the defaults file (if it exists) for the application. These files are in the /usr/lib/X11/app-defaults/ directory.

.Xsession

This is the first file the X server looks at when starting your X environment. Its main job is some bookkeeping and to tell the server which windows manager to run. A typical .xsession file might look like

#!/bin/sh

if [ -f $HOME/.Xdefaults ]; then

xrdb -load $HOME/.Xdefaults

fi

# Put other commands here, eg xclock, xterm etc.

xclock -geometry +0+0 &

xterm -geometry +0-0 &

xterm -geometry 80x5+0+0 -C -ls &

fvwm

The first line says that this is a shell script to be executed by the shell. The if ... fi statement checks to see if you have a defaults file, and if you do it loads it, just as we saw above. The next lines start up some initial applications, and then run fvwm. Pay careful attention to the ampersands. Every line containing an application to be run, except the last, must end with an ampersand; the last line cannot end with one. This is so that all but one application runs in the background, while fvwm runs in the foreground. Thus to log out from your X Windows session you need to end fvwm with the exit command in the menu on button 1.

If you would rather end your X session by typing control-D or logout in a terminal window then swap the last two lines:

# Put other commands here, eg xclock, xterm etc.

xclock -geometry +0+0 &

xterm -geometry +0-0 &

fvwm &

xterm -T Logout -geometry 80x5+0+0 -C -ls

To log out you would use the window titled ``Logout''.

.fvwmrc

The system default file for this is /usr/lib/X11/fvwm/system.fvwmrc. It is a very long and at times complicated file, and there isn't enough space to go into it in detail here. Do not despair, however. The file itself contains copious comments explaining what is going on. If you want to customize it then copy it to your home directory:

cp /usr/lib/X11/fvwm/system.fvwmrc ~/.fvwmrc

and then open the file in a text editor. Then read through the comments and experiment with changing things. Once you have made some changes, save the file and then restart fvwm to make the changes take effect. Rather than logging out and back in again, select the Exit Fvwm option in the menu on button 1. This will bring up a submenu; select Restart Fvwm. If the manager doesn't like the changes you made it will probably just ignore them.

We will discuss some parts of this file, to give you an idea. The first thing I changed were the fonts. I was going blind trying to read the menus so I changed the lines:

# Now the fonts - one for menus, another for window titles, another for icons

#Font -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*

Font -*-times-medium-i-*-*-*-120-*-*-*-*-*-*

WindowFont -adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-*-*

#IconFont -adobe-helvetica-medium-r-*-*-11-*-*-*-*-*-*-*

IconFont fixed

to give me larger fonts:

# Now the fonts - one for menus, another for window titles, another for icons

Font -adobe-helvetica-medium-r-*-*-18-*-*-*-*-*-*-*

WindowFont -adobe-helvetica-bold-r-normal--14-*-*-*-*-*-*-*

IconFont -adobe-helvetica-bold-r-normal--18-*-*-*-*-*-*-*

Note that the # symbol means that a comment follows. Everything after will be ignored.

For a (more than) complete list of fonts type the command xlsfonts | less in a terminal window.

The virtual desktop feature is controlled in these lines:

###########################################################################

# Set up the virtual desktop and pager

#set the desk top size in units of physical screen size

DeskTopSize 2x2

To make the desktop the same size as the screen change the last line to:

DeskTopSize 1x1

Obviously you may also increase the size of the desktop.

The next important item is the start up function. This is a list of applications to run when fvwm starts. You can put them all here instead of in your .xsession file if you want. The system file has everything commented out except for:

Function "InitFunction"

Module "I" GoodStuff

EndFunction

This line runs the GoodStuff module which we discussed in Section 2.4. The settings for this are lower down in the file. You can put anything you like at this point. Here is mine:

# Stuff to do at start-up

Function "InitFunction"

Exec "I" xsetroot -bitmap misc/comet3.xbm &

Exec "I" exec emacs -geometry 90x49-0+0 -fn 9x15bold -iconic&

Exec "I" exec xclock -geometry 100x100+7+0 &

Exec "I" exec xload -geometry 100x100+7+110 &

Exec "I" exec xbiff -geometry +7+220 &

Exec "I" exec xterm -fn 10x20 -geometry 80x30-10-10 -T Pine -e pine &

Module "I" FvwmWinList

Module "I" FvwmPager 0 3

EndFunction

The first line changes my background to a pretty picture, the next five lines we have already discussed what they do, although the format is different here. When you add things you must take care to follow the same format. The last two lines start up a list of windows and the Pager, respectively. The window list is what I use instead of icons. It is simply a list which I can click on to switch to an application. The same list appears in the menu in button 3.

The last thing I will mention is how to write the menus which are bound to the mouse buttons. This is what the default looks like:

# This menu will fire up some very common utilities

Popup "Utilities"

Title "Utilities"

Exec "GNU Emacs" exec emacs &

Exec "Xterm" exec xterm &

Exec "Netscape" exec netscape &

Exec "Xfig" exec xfig &

Exec "Top" exec rxvt -T Top -n Top -e top &

Exec "Xman" exec xman &

Exec "Xmag" exec xmag &

Nop ""

Popup "Modules" Module-Popup

Nop ""

Popup "Exit" Quit-Verify

EndPopup

The format is similar to the start up function. Anything you add must follow this. Compare this with the menu on button 1. The option starting with Exec will run programs, while the Popup options bring up submenus. You can write your own submenus similarly. The Nop command just gives you a horizontal line.

Lower down in the file you will find the sections on binding commands and menus to the mouse, the function keys, and the title buttons, and on the defaults for the modules such as the Pager and GoodStuff.

I recommend that you copy the system file and then compare it with other people's. However this file is quite complicated and there are a lot of dependencies within it which are not obvious. You should not just copy someone else's file and use it, because it will probably not work. Mine, for instance, is set up for a particular screen size, and bits of it are incompatible with the standard one. Instead you should make small changes and see what effect they have, then keep going

X Windows System Configuration

How do you edit the monitor information running Fedora core 3 2.6.9-1.667 (Heidelberg) or RedHat 9 2.4.20-6 (shrike)?

As root,Go to the directory /etc/X11/ and open   xorg.conf   if you are using Fedora core 3.

If you are running RedHat 9 (shrike) 2.4.20-6; the file will be  XF86Config

You can use a text editor like vim. You will have to be root to change this file; so be very careful - - if you make a mistake here, you might loose everything.

Sample XF86Config file:

# XFree86 4 configuration created by pyxf86config

Section "ServerLayout"

Identifier "Default Layout"

Screen 0 "Screen0" 0 0

InputDevice "Mouse0" "CorePointer"

InputDevice "Keyboard0" "CoreKeyboard"

InputDevice "DevInputMice" "AlwaysCore"

EndSection

Section "Files"

# RgbPath is the location of the RGB database. Note, this is the name of the

# file minus the extension (like ".txt" or ".db"). There is normally

# no need to change the default.

# Multiple FontPath entries are allowed (they are concatenated together)

# By default, Red Hat 6.0 and later now use a font server independent of

# the X server to render fonts.

RgbPath "/usr/X11R6/lib/X11/rgb"

FontPath "unix/:7100"

EndSection

Section "Module"

Load "dbe"

Load "extmod"

Load "fbdevhw"

Load "glx"

Load "record"

Load "freetype"

Load "type1"

Load "dri"

EndSection

Section "InputDevice"

# Specify which keyboard LEDs can be user-controlled (eg, with xset(1))

# Option "Xleds" "1 2 3"

# To disable the XKEYBOARD extension, uncomment XkbDisable.

# Option "XkbDisable"

# To customise the XKB settings to suit your keyboard, modify the

# lines below (which are the defaults). For example, for a non-U.S.

# keyboard, you will probably want to use:

# Option "XkbModel" "pc102"

# If you have a US Microsoft Natural keyboard, you can use:

# Option "XkbModel" "microsoft"

#

# Then to change the language, change the Layout setting.

# For example, a german layout can be obtained with:

# Option "XkbLayout" "de"

# or:

# Option "XkbLayout" "de"

# Option "XkbVariant" "nodeadkeys"

#

# If you'd like to switch the positions of your capslock and

# control keys, use:

# Option "XkbOptions" "ctrl:swapcaps"

# Or if you just want both to be control, use:

# Option "XkbOptions" "ctrl:nocaps"

#

Identifier "Keyboard0"

Driver "keyboard"

Option "XkbRules" "xfree86"

Option "XkbModel" "pc105"

Option "XkbLayout" "us"

EndSection

Section "InputDevice"

Identifier "Mouse0"

Driver "mouse"

Option "Protocol" "PS/2"

Option "Device" "/dev/psaux"

Option "ZAxisMapping" "4 5"

Option "Emulate3Buttons" "yes"

EndSection

Section "InputDevice"

# If the normal CorePointer mouse is not a USB mouse then

# this input device can be used in AlwaysCore mode to let you

# also use USB mice at the same time.

Identifier "DevInputMice"

Driver "mouse"

Option "Protocol" "IMPS/2"

Option "Device" "/dev/input/mice"

Option "ZAxisMapping" "4 5"

Option "Emulate3Buttons" "no"

EndSection

Section "Monitor"

Identifier "Monitor0"

VendorName "Monitor Vendor"

ModelName "Hitachi CM500"

DisplaySize 270 200

HorizSync 30.0 - 64.0

VertRefresh 50.0 - 100.0

Option "dpms"

EndSection

Section "Device"

Identifier "Videocard0"

Driver "i810"

VendorName "Videocard vendor"

BoardName "Intel 810"

VideoRam 16384

EndSection

Section "Screen"

Identifier "Screen0"

Device "Videocard0"

Monitor "Monitor0"

DefaultDepth 24

SubSection "Display"

Depth 24

Modes "1024x768" "800x600" "640x480"

EndSubSection

EndSection

Section "DRI"

Group 0

Mode 0666

EndSection

The part I had trouble with was the horizontal sync and the Vertical Refresh rate. I knew what the monitor was capable of so I was able to safely change it here and all was ok. if you get either one of those specs wrong you will very likely destroy your monitor; so be careful

This is the file on the machine with Fedora core 3: ( xorg.conf )

# Xorg configuration created by system-config-display

Section "ServerLayout"

Identifier "single head configuration"

Screen 0 "Screen0" 0 0

InputDevice "Mouse0" "CorePointer"

InputDevice "Keyboard0" "CoreKeyboard"

EndSection

Section "Files"

# RgbPath is the location of the RGB database. Note, this is the name of the

# file minus the extension (like ".txt" or ".db"). There is normally

# no need to change the default.

# Multiple FontPath entries are allowed (they are concatenated together)

# By default, Red Hat 6.0 and later now use a font server independent of

# the X server to render fonts.

RgbPath "/usr/X11R6/lib/X11/rgb"

FontPath "unix/:7100"

EndSection

Section "Module"

Load "dbe"

Load "extmod"

Load "fbdevhw"

Load "glx"

Load "record"

Load "freetype"

Load "type1"

Load "dri"

EndSection

Section "InputDevice"

# Specify which keyboard LEDs can be user-controlled (eg, with xset(1))

# Option "Xleds" "1 2 3"

# To disable the XKEYBOARD extension, uncomment XkbDisable.

# Option "XkbDisable"

# To customise the XKB settings to suit your keyboard, modify the

# lines below (which are the defaults). For example, for a non-U.S.

# keyboard, you will probably want to use:

# Option "XkbModel" "pc102"

# If you have a US Microsoft Natural keyboard, you can use:

# Option "XkbModel" "microsoft"

#

# Then to change the language, change the Layout setting.

# For example, a german layout can be obtained with:

# Option "XkbLayout" "de"

# or:

# Option "XkbLayout" "de"

# Option "XkbVariant" "nodeadkeys"

#

# If you'd like to switch the positions of your capslock and

# control keys, use:

# Option "XkbOptions" "ctrl:swapcaps"

# Or if you just want both to be control, use:

# Option "XkbOptions" "ctrl:nocaps"

#

Identifier "Keyboard0"

Driver "kbd"

Option "XkbModel" "pc105"

Option "XkbLayout" "us"

EndSection

Section "InputDevice"

Identifier "Mouse0"

Driver "mouse"

Option "Protocol" "IMPS/2"

Option "Device" "/dev/input/mice"

Option "ZAxisMapping" "4 5"

Option "Emulate3Buttons" "yes"

EndSection

Section "Monitor"

Identifier "Monitor0"

VendorName "Monitor Vendor"

ModelName "Hitachi CM500"

HorizSync 30.0 - 64.0

VertRefresh 50.0 - 100.0

Option "dpms"

EndSection

Section "Device"

Identifier "Videocard0"

Driver "ati"

VendorName "Videocard vendor"

BoardName "ATI Mach64"

EndSection

Section "Screen"

Identifier "Screen0"

Device "Videocard0"

Monitor "Monitor0"

DefaultDepth 8

SubSection "Display"

Viewport 0 0

Depth 16

Modes "800x600" "640x480"

EndSubSection

SubSection "Display"

Viewport 0 0

Depth 8

Modes "1024x768" "800x600" "640x480"

EndSubSection

EndSection

Section "DRI"

Group 0

Mode 0666

EndSection

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download