Welcome to Linux Knowledge Base and Tutorial
"The place where you learn linux"
Cyber Angels

 Create an AccountHome | Submit News | Your Account  

Tutorial Menu
Linux Tutorial Home
Table of Contents
Up to --> Linux Tutorial

· The X Windowing System
· Configuring the X-Windows Server
· The Basics of X
· Resources
· Colors
· Displaying Clients
· Fonts
· The Window Manager
· Remote Access

Man Pages
Linux Topics
Test Your Knowledge

Site Menu
Site Map
Copyright Info
Terms of Use
Privacy Info
Masthead / Impressum
Your Account

Private Messages

News Archive
Submit News
User Articles
Web Links


The Web

Who's Online
There are currently, 64 guest(s) and 0 member(s) that are online.

You are an Anonymous user. You can register for free by clicking here

Linux Tutorial - The X Windowing System - Displaying Clients
  Colors ---- Fonts  

Displaying Clients

When the clients connect to the server, one key piece of information it needs is the display name. The display is of the form


The hostname identifies the name of the machine to which the display is physically connected. The most common form of hostname is simply the node name, as more than likely the server is in the same network. However, it is possible to use a fully qualified domain or even an IP address for the hostname.

Unless you have some special hardware, you probably have only one physical display per server. However, each display is given a number starting at 0. If you only have one, then you will always access hostname:0. The screen number is only used in cases where a single keyboard and mouse are associated with multiple monitors. Like displays, screens are counted starting at 0. Because multiple screens are far less common than multiple displays, you can omit the screen number when specifying the display. Generally, the default display is stored in the DISPLAY variable, which is then used by default. However, many X clients have a -display option, with which you can specify the display.

The next important issue is the concept of geometry. One advantage of a system like X is the ability not only to move windows around the screen but also to change their size and shape as well. Rather than using the window manager to change the shape of the window, you can specify the shape and size when the application is started by specifying the clients geometry.

The geometry is represented by four characteristics: width, height, the distance from left or right, and the distance from the top or bottom. These are referenced by width, height, xoff, and yoff, respectively. Depending on the application, the height and width are measured in either pixels or characters, whereas the xoff and yoff values are measured only in pixels. Both xoff and yoff are measured in relationship to the screen. The general syntax of the geometry specification is

application -geometry widthxheight+xoff+yoff

Here the + (plus sign) before xoff and yoff indicate a distance from the left and top edges of the screen, respectively. By changing + to -, you change the offset to be from the right and bottom instead of left and top. For example, if you wanted to start the analog clock 30 pixels to the right of the upper left corner, the command would look like this:

oclock -geometry 90x90+30+0 &

(It's a good idea to run all clients in the background, otherwise you don't get your prompt back until the client terminates.) Now, if we wanted to start the clock 30 pixels to the left of the upper right corner, the command would look like this:

oclock -geometry 90x90-30+0 &

Now, if we wanted to start the clock 30 pixels to the left of the lower right corner, the command would look like this:

oclock -geometry 90x90-30-0 &

The four corners are thus mapped like this:

+0+0 -0+0

+0-0 -0-0

You can also specify negative offsets that would then start the client outside of the respective edge of the screen. For example, if we change the above command to look like this

oclock -geometry 90x90--30+0 &

It will start the client so that the right edge of the clock is 30 pixels outside of the right edge of the screen. (Be careful not to have spaces in there.) This does not mean that the entire clock is outside of the right edge of the screen. This is a misconception that many people have (including me, at first). On many systems, there is something magical about the upper left corner of the client. Offsets from the edge of the screen are in relationship to this magical corner. This is not so with X.

A +xoff value is the distance of the left edge of the client from the left edge of the screen. A -xoff value is the distance of the right edge of the client from the right edge of the screen. This also means that a +yoff value is the distance of the top of the client to the top of the screen, and -yoff is the distance from the bottom of the client to the bottom of the screen.

Note that the geometry is specified in pairs. So, if you specify the height, you must also specify the width. Also, if you specify the x-offset, you must also specify the y-offset. However, you don't have to specify the offsets if you only want to specify the size. Therefore, you could start the clock like this:

oclock -geometry 90x90 &

This gives me a 90x90 clock at the default location. If you only want the offset to take the default size, it might look like this:

oclock -geometry +100+42 &

The thing that bothers me about this clock is that it is pretty boring. The colors are drab and it really doesn't have any life to it. The nice thing is that we can change the colors. With the analog clock, we can change several different things. If we wanted the background color to be cornflower blue, we would enter the command

oclock -bg cornflowerblue &

This creates an analog clock with the default size at the default location with a background of cornflower blue. However, it still looks boring. I want a foreground of red. So, lets run the command like this:

oclock -bg cornflowerblue -fg red &

Now it's beginning to have a little life to it. However, having both hands red is still not good enough. I want the hour hand red but the minute hand white, and I want the jewel at the top of the clock yellow. The command would then look like this:

oclock -bg cornflowerblue -hour red -minute white -jewel yellow &

Thats not all. We can use a couple more options. However, these are listed in the oclock(X) man-page, so you can take a look there if you want. Other clients have different options because some of them don't make sense with an analog clock. For example, the digital clock (dclock) has an option to specify the font (-fn). Because there are no characters on the analog clock, an option to change the font wouldn't make sense.

 Previous Page
  Back to Top
Table of Contents
Next Page 


Test Your Knowledge

User Comments:

Posted by serutake on June 30, 2014 09:13am:

Very efficiently written information. http://www.friv2g.org | http://www.friv3g.com http://www.friv4g.com | http://www.friv5g.com

You can only add comments if you are logged in.

Copyright 2002-2009 by James Mohr. Licensed under modified GNU Free Documentation License (Portions of this material originally published by Prentice Hall, Pearson Education, Inc). See here for details. All rights reserved.
Show your Support for the Linux Tutorial

Purchase one of the products from our new online shop. For each product you purchase, the Linux Tutorial gets a portion of the proceeds to help keep us going.



Security Code
Security Code
Type Security Code

Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.

Help if you can!

Amazon Wish List

Did You Know?
The Linux Tutorial can use your help.


Tell a Friend About Us

Bookmark and Share

Web site powered by PHP-Nuke

Is this information useful? At the very least you can help by spreading the word to your favorite newsgroups, mailing lists and forums.
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters. Articles are the property of their respective owners. Unless otherwise stated in the body of the article, article content (C) 1994-2013 by James Mohr. All rights reserved. The stylized page/paper, as well as the terms "The Linux Tutorial", "The Linux Server Tutorial", "The Linux Knowledge Base and Tutorial" and "The place where you learn Linux" are service marks of James Mohr. All rights reserved.
The Linux Knowledge Base and Tutorial may contain links to sites on the Internet, which are owned and operated by third parties. The Linux Tutorial is not responsible for the content of any such third-party site. By viewing/utilizing this web site, you have agreed to our disclaimer, terms of use and privacy policy. Use of automated download software ("harvesters") such as wget, httrack, etc. causes the site to quickly exceed its bandwidth limitation and are therefore expressly prohibited. For more details on this, take a look here

PHP-Nuke Copyright © 2004 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
Page Generation: 0.09 Seconds