r10 - 27 May 2009 - 19:57:16 - JohnPerkinsYou are here: TWiki >  CSDocs Web  > XWindowFAQs

The X Window System

How Do I Change The Screen Resolution On The Computer I'm Using?

The command xsetres can only be used on intel-based desktop computers.

TIP Note: This means that the resolution can not be changed on instructional workstations.

The location of xsetres should be given already in your path; however, if there is a problem the program can be found in /s/std/bin.

How Do I Lock The Display?

GNOME users can lock the screen using SystemLock Screen.

For other users, the command xlock will lock your workstation. xlock has a large number of options. You should consult the xlock man page (type man xlock) for more information on these.

When you return to the workstation, move the mouse or press a key. You will be asked to enter your password to regain access to the workstation.

How Do I Change My Background?

You can change the background on your computer to a specific color, or you can use a picture.

GNOME users will find this under SystemPreferencesDesktop Background.

For other users, to change your background to a solid color, use the command xsetroot -solid [color]. Valid color names can be found in /s/X11/lib/X11/rgb.txt or by using the showrgb program.

To change your background to a picture, use the command xv -root -max -quit [name], where name is the picture you want to use. Any picture format that can be viewed using the xv viewer is acceptable.

ALERT! Warning: The more complex the picture, the more time it will take to repaint your computer screen after moving things around.

How Do I Set The Mouse For Left-handed Operation?

GNOME users can do this simply by going into SystemPreferencesMouse and checking the appropriate options.

Other users can change the mouse mapping by adding one of the following to your ~/.Xkeymap file:

pointer = 3 2 1

pointer = 3 2 1 4 5

The first entry is for a non-wheel mouse; the second entry is for a wheel mouse (with the wheel enabled). This will reverse the left and right mouse buttons for you. You will need to logout and login for the change to take effect.

How Do I Use X From Home?

You will need an X server and an SSH client capable of port-forwarding to display X applications from Computer Science computers on your computer at home or anywhere else. SecureCRT and ssh.com's SSH client are both capable of doing this.

See Also:

TIP Note: This listing is not meant to be comprehensive. If you have more questions, please reference the manual that came with your X server.

If you want to run an X application on a CS workstation, use ssh to log into the CS workstation. You will need to define a profile for the computer you are connecting to and enable X11 tunneling or X11 forwarding for that host BEFORE you connect.

Start the X server on your local host. Make sure "localhost" is allowed to connect to the display. Different X servers have different ways of controlling this access; you may need to refer to the software documentation to do this.

That should be all you need. Your SSH client will set the <$DISPLAY> variable for you, so you don't have to mess with it. Any X applications started within your ssh session should display on your local display. Traffic in between is encrypted in the SSH connection.

How Can I Get My X And/or Motif Application To Compile And Link Properly?

TIP Note: The xmkmf program will automatically add all the required paths and libraries you may need in your build. We therefore strongly encourage it's use wherever possible. The following information is provided for situations where xmkmf cannot be used.

Make sure you have the correct paths specified. If you are building X applications, you need to add /s/XFree86-4.0.3/include to the include search path and /s/XFree86-4.0.3/lib to the library search path. If you are using motif application, you also need to add /s/motif-2.1.10/include and /s/xpm-3.4k/include to your include path and /s/motif-2.1.10/lib and /s/xpm-3.4k/lib to your library path. Most compilers will prefer the shared versions of these libraries. Check your compiler documentation to ensure that the syntax you choose will include the required paths both at link time and at run time.

Make sure that you have all the required libraries. Each application will vary in the libraries that it requires. Some of the X and motif libraries you may need are listed below (along with some examples of functions that are defined in each library. The list is not exhaustive, but may help you identify needed libraries:

Library Link syntax Symbol Example Component
libX11 -lX11 (Always included) Core X
libXau -lXau XauReadAuth X
libXaw3d -lXaw3d XawInitializeWidgetSet X
libXIE -lXIE XieFloConvertFromRGB X
libXext -lXext XShapeCombineMask X
libICE -lICE IceProcessMessages X
libSM -lSM SmcDeleteProperties X
libXm -lXm XmCreateCommandDialog Motif
libMrm -lMrm MrmFetchWidget Motif
libXp -lXp XpGetDocumentData X printing
libXpm -lXpm xpmParseColors pixmaps
libsocket -lsocket -lnsl getpeername solaris

TIP Note: The CSL does not provide programming consulting services. If you are having trouble building your application, you will need to seek help from the man system, these faqs, the author of the package, and other sources.

Why Can't I Find X Application On My Tao Linux Computer?

In Tao Linux, X applications are installed in a different location than on other architectures. Running the newdots program will correct the problem by updating all your 'dot' files to the current version, which includes the path for the Tao Linux X applications. Alternatively, if you feel comfortable editing your 'dot' files, you can add /usr/X11R6/bin to the end of your path in your $HOME/.bashrc.local $HOME/.cshrc.local file.

How Do I Use The Numeric Keypad In X With Applications Like Vim Or Matlab?

This is a terminal capabilities problem. When the application (vim, matlab, etc.) starts, it enables an "Application keypad" mode, which causes the keypad keys to generate escape sequences instead of ASCII numbers.

The recommended workaround for this problem is:

  • Start your application (vi, matlab, etc.)
  • Hold down 'ctrl+middle mouse button'
  • (de-)select the option titled 'Enable Application Keypad'
  • Be sure numlock is active, then use the keypad.

You will need to re-select this option each time you run the application.

Help! My Xterm-based Applications Show Up All Black!

The X terminal program (xterm) in XFree86 version 4.* interprets X resources in a slightly different manner than previous versions. This has been found to cause problems with certain curses-based X applications, including some mail readers, the character-based internet browser lynx, and others. We have changed the default .Xresources file (which contains personal X resources) to avoid this problem. Individuals are encouraged to update their own .Xresources files to fix this problem. This can be done either by editing the file $HOME/.Xresources with a text editor or by running the newdots command. Running newdots is simpler, but will update many more files than just .Xresources. If you choose to edit the file, you want to change the line that reads

XTerm*Foreground: CSLFOREGROUND

to read

!XTerm*Foreground: CSLFOREGROUND

Prepending the line with a '!' causes it to be non-functional (You can also delete the line entirely, which does the same thing). Then re-load your X resources (this is most easily done by logging out and logging in) to have the change take effect.

How can I make my xclock more readable?

Some people find the default xclock colors difficult to read. This came about with Xrender library support and a new set of default colors for that application. We offer two solutions to make this situation better.

How to set xclock colors to a more readable combination

1. Add export XAPPLRESDIR=~/app-defaults to your .bashrc.local file OR setenv XAPPLRESDIR ~/app-defaults to your .cshrc.local file

2. Create a ~/app-defaults directory

3. Create a ~/app-defaults/XClock-color file with the following contents:

#ifdef RENDER

XClock.Clock.hourColor: rgba:00/00/00/ff

XClock.Clock.minuteColor: rgba:00/00/00/ff

XClock.Clock.secondColor: rgba:7f/7f/00/80

XClock.Clock.majorColor: rgba:00/00/00/ff

XClock.Clock.minorColor: rgba:00/00/00/ff

#endif

This will draw the hands and tick marks in black; some feel this looks sharper than the default red/green combination.

How to disable Xrender support in xclock

You can add a -norender option to the xclock command when you start xclock (usually in your ~/.xsession file). This gives slightly darker hands and tick marks on the clock, although the hands are not drawn as smooth.

How Can I Use Larger (or Smaller) Fonts In My X Applications?

Various X applications configure their fonts in different ways. Below are some details for setting font sizes we are commonly asked about.

Mozilla

Mozilla fonts can be specified under the Edit→Preferences preferences screen. From there, select General→Fonts & Colors. You can select font types as well as sizes.

You can also increase/decrease the font size in a browser window with Ctrl-=/Ctrl-- when viewing a web page.

GTK-based applications (including menu fonts in Mozilla)

These fonts are controlled in your ~/.gtkrc file. The following will set a default font for your GTK-based applications:

style "default_font" { 
   font = "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-iso8859-1"
}
widget "*" style "default_font"

If you know what widgets you want to set fonts for, you can define them here, but doing so is beyond the scope of this document.

Be sure to check out the section on Font Definitions below.

FVWM2/FVWM window manager

FVWM2 fonts are defined in your ~/.fvwm2/.fvwm2rc or ~/.fvwm2rc; FVWM fonts are defined in your ~/.fvwmrc file. Look in your ~/.xsession file to determine whether your account is configured to run fvwm2 or fvwm.

There are Font, IconFont, MenuStyle (not applicable in fvwm) and WindowFont (not applicable in fvwm2) fonts defined in these files:

Attribute Controls...
Font Title bars on windows in fvwm2, menu fonts in fvwm
IconFont Title on window icons
WindowFont Title on window title bars (fvwm only)
MenuStyle Fonts used in drop-down menus

See the section on Font Definitions below for information on font syntax.

xterm font settings

Control-rightclick will give you a list of pre-selected fonts you can select for an active xterm window. The "default" setting at the top of the list is what these windows will start as.

xterm default fonts (TrueType)

To use TrueType fonts in your xterm windows, you need to set XTerm*faceSize and XTerm*faceName attributes in your ~/.Xresource file. The XTerm*faceName attribute is used to specify the default font; XTerm*faceSize specifies the default font size.

Sample ~/.Xresources parameters for TrueType use:

XTerm*faceName: Bitstream Vera Serif Mono

XTerm*faceSize: 11

The fallback TrueType font for xterm use is Bitstream Vera Sans Mono. Font settings for a particular xterm window can be overridden using the -fs (size) and -fa (face) flags to xterm.

*NOTE*: do NOT use quotes around the font faceName; they will cause your font specification to fail and fall back to the fallback font.

Some available monospaced TrueType fonts available for use in xterm windows:

* Bitstream Vera Sans Mono

* Lucida Console

* QuickType II Mono

* Courant

* Courier New

* SimSun

xterm/xemacs/emacs/gvim default fonts (non-!TrueType)

These fonts are defined in your ~/.Xresources file, which are read in at login time. If you make any changes, you will need to logout/login for these changes to take effect.

Entries in your ~/.Xresources control the following attributes:

Attribute Controls...
*emacs.Font Emacs text font
*VT100.Font Default xterm font
*VT100.boldFont Default boldface xterm font
*VT100.fontX Fonts selected in Control-rightclick dropdown menu, where X is a number, 2-6, corresponding to the different fonts available in that menu

Font Definitions

Font definitions follow the following basic format:

-adobe-helvetica-bold-r-normal-*-*-120-*-*-*-*-*-*

To look at examples of different fonts, you can run the program xfontsel; the number above is a point size for a particular font. Although there are many ways of defining fonts with this syntax, we recommend using stars as show above for most of the font sizes (the number above is a point-size for the font, which will scale the font for your display). The font maker, family, weight, slant and slant width define the font look.

When changing to different fonts, you should use xfontsel to make sure the font you request is available on our computers.

Edit | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r10 < r9 < r8 < r7 < r6 | More topic actions
 
CSL Home
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback