LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-11-2010, 07:25 PM   #1
anidev
LQ Newbie
 
Registered: Nov 2010
Location: Virginia, USA
Distribution: Ubuntu
Posts: 9

Rep: Reputation: 0
What is the purpose of the DISPLAY environment variable?


I have seen that many GUI programs have a command line argument like --display. I found out that if no such argument is specified, the DISPLAY environment variable is used to determine which X server the program should connect to. I always thought that the display manager such as gdm or kdm connects directly to the X server, and that other programs should connect to the display manager. So now I am a little confused. Could anyone explain to me why programs connect directly to X servers, why use display managers if the above is the case, and what exactly happens when a window is made visible?

Thanks
 
Old 11-11-2010, 07:53 PM   #2
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Bookworm (Fluxbox WM)
Posts: 1,391
Blog Entries: 54

Rep: Reputation: 360Reputation: 360Reputation: 360Reputation: 360
The function of the display manager is to manage the X server instances, not to mediate the applications. The applications communicate directly to the X server.

So it is quite possible to run X without a display manager (and on an old system, is a good way to save some memory!). It is just a matter of calling xinit directly with appropriate parameters.

You can even do without a windows manager for that matter, if you don't need to shuffle windows around, for example when creating a kiosk platform.

Last edited by neonsignal; 11-11-2010 at 07:54 PM.
 
Old 11-11-2010, 07:54 PM   #3
mf93
Member
 
Registered: Jun 2009
Distribution: Debian Squeeze, centOS
Posts: 229

Rep: Reputation: 36
all a windows manager does is give a display window for the Xserver to render TO. Xserver is in charge of all display rendering. The DISPLAY variable tells which display to which to send the rasterized image, which is usually at :0. for example, if you were to install xserver-xorg on an ubuntu box that had no window manager installed, and then sshed into it from a box WITH a window manager with the -X (X11 forwarding) option set, and entered a command such as xlogo, you would receive an xlogo window on the client machine, even though the server does not have a window manager installed.
 
Old 11-11-2010, 09:09 PM   #4
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
as said before, the DISPLAY variable is to help sort out multiple instances of the X server (such as in a dual head situation the left monitor may be :0.0 and the right may be :0.1, or a multi seat situation, seat 1 may be :0 seat 2 :1 seat 3 :2 etc..., another example would be using Xephyr or Xnest to run a nested X session within another X session the main one would be :0 the second would be :1, and last but not least VNC would also use separate DISPLAY environments for each instance of VNC server) these are only a few examples

that being said you can also from the command line with some programs implicitly tell a program to start on a given display using something like --display :X(.x) or -display :X(.x) assuming your user account has privileges to USE the specified display.
 
Old 11-12-2010, 07:55 PM   #5
anidev
LQ Newbie
 
Registered: Nov 2010
Location: Virginia, USA
Distribution: Ubuntu
Posts: 9

Original Poster
Rep: Reputation: 0
OK, let me get all this info straight!

X is a program that runs on the computer very soon after the kernel loads. Almost all graphics that must be displayed on the monitor are sent to the X server. Other programs send their GUI images and other window info to the X server. The desktop manager contains information about what programs should startup, what the desktop should look, etc. and sends images to X also. The window manager manages switching between windows, z-ordering of windows, what gets painted and what doesn't, where windows are, etc. And then there is the compositing manager, which I guess intercepts or intervenes between the programs and X and offers an API for manipulating the image(s) before they are sent to the X server.

Did I get all that right?
 
Old 11-12-2010, 08:12 PM   #6
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Bookworm (Fluxbox WM)
Posts: 1,391
Blog Entries: 54

Rep: Reputation: 360Reputation: 360Reputation: 360Reputation: 360
Just a small terminology clarification: the "desktop manager" refers to the program that starts the X server (usually all you see of it is the username/password prompt). The look and feel of the desktop revolves more around what is called the "desktop environment", which is a loose term encompassing the look of the desktop and the various programs that provide menus, file browsing, settings, and so on.

The X server does start towards the end of the initialization on a desktop distro, but it is typically invoked by the desktop manager (eg gdm, kdk, or xdm).

Last edited by neonsignal; 11-12-2010 at 08:17 PM.
 
Old 11-13-2010, 11:37 AM   #7
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
one more clarification, the X server does not have to be running on the same machine, there are X servers for windoze as well, in that case you run the X server, connect to a remote machine (usually with SSH with X forwarding enabled) and then you can run remote X programs from that machine on the local X server, in this manner X11 is a reverse client server since the SERVER program runs locally and the clients are run remotely, yes its confusing but thats how it works
 
Old 11-14-2010, 11:55 AM   #8
anidev
LQ Newbie
 
Registered: Nov 2010
Location: Virginia, USA
Distribution: Ubuntu
Posts: 9

Original Poster
Rep: Reputation: 0
I think I understand most of it now. I read somewhere that X really is a server that runs in the background and clients connect to it through sockets. Usually the X server on the client machine and is accessed via the loopback network interface. This is, I believe, an X server can be run on a remote computer and be displayed on a remote computer.

One more question: I know that this is how an X server is referenced:
host:x.y
The "host" is the server computer (usually 127.0.0.1, localhost, or blank) and "x" is the instance of the X server running on the "host", but what is "y"?
 
Old 11-15-2010, 11:06 AM   #9
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
y is the screen such as in multi-head set-ups :0.0 would be screen 1, :0.1 would be screen 2 etc.., however when using Xinerama for instance :X.1 to .X.n are transparently merged and all behave one virtual screen, :X.0
 
Old 11-15-2010, 09:38 PM   #10
anidev
LQ Newbie
 
Registered: Nov 2010
Location: Virginia, USA
Distribution: Ubuntu
Posts: 9

Original Poster
Rep: Reputation: 0
so "y" refers to each screen, which usually is a monitor.

Thanks for all your help! I'm glad I finally joined LQ...
 
Old 11-16-2010, 11:39 AM   #11
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
your welcome, and yes it often represents a monitor but also it could be a virtual display such as with Xnest or Xephyr or vnc, and welcome to lq btw i forgot to say that the first time i replied
 
Old 11-16-2010, 07:06 PM   #12
mf93
Member
 
Registered: Jun 2009
Distribution: Debian Squeeze, centOS
Posts: 229

Rep: Reputation: 36
make sure you mark the thread as solved. thread tools(top right corner of original post)->mark thread as solved
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem withChanging DISPLAY environment variable to display on someone else's screen wantsri Linux - Networking 1 10-25-2005 11:14 AM
Modifying DISPLAY environment variable on-the-fly ktulu1115 Linux - Software 1 10-07-2005 02:18 PM
Tcl Error no display name and no DISPLAY environment variable thinkgeek Programming 5 07-06-2005 10:24 PM
setting environment variable DISPLAY jpan Debian 4 10-15-2004 06:09 PM
DISPLAY environment variable danahata Slackware 2 02-26-2004 03:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration