LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   environment variable "$DISPLAY" (https://www.linuxquestions.org/questions/slackware-14/environment-variable-%24display-693306/)

garyg007 12-27-2008 01:20 PM

environment variable "$DISPLAY"
 
Since installing 12.2, some things have not been functioning as expected; the warnings/errors that occur seem to indicate that an environment variable "$DISPLAY" needs to be set. For instance:
Code:

root@abitbox:~# xwininfo -id 0:0
xwininfo:  unable to open display ''

I have not been able to determine what that env variable should be set to - could someone help?

Thanks

Gary

astrogeek 12-27-2008 01:32 PM

That is you X server display
 
I am not an X-pert but I know the DISPLAY environment variable should be the identifier of the X server you want to connect to.

Usually this will be ':0', unless you are running multiple X servers. I have some notes on this from running X sessions across a LAN but that machine is not accessible to me at the moment - I'll try to post some later.

[EDIT]
There is a very short explanation of the $DISPLAY var here.
[/EDIT]

pixellany 12-27-2008 02:18 PM

Look at the man page for xwininfo. It wants the window ID, not the display ID

Try running xwininfo with no arguments.

garyg007 12-27-2008 02:34 PM

Quote:

Originally Posted by pixellany (Post 3388749)
Look at the man page for xwininfo. It wants the window ID, not the display ID

Try running xwininfo with no arguments.

Thank you both for the replies;

I already did that, and it is no help here is what it produces:
Code:

root@abitbox:~# xwininfo
xwininfo:  unable to open display ''
usage:  xwininfo [-options ...]

where options include:
    -help                print this message
    -display host:dpy    X server to contact
    -root                use the root window
    -id windowid        use the window with the specified id
    -name windowname    use the window with the specified name
    -int                print window id in decimal
    -children            print parent and child identifiers
    -tree                print children identifiers recursively
    -stats              print window geometry [DEFAULT]
    -bits                print window pixel information
    -events              print events selected for on window
    -size                print size hints
    -wm                  print window manager hints
    -shape              print shape extents
    -frame              don't ignore window manager frames
    -english            print sizes in english units
    -metric              print sizes in metric units
    -all                -tree, -stats, -bits, -events, -wm, -size, -shape

root@abitbox:~#

Where in the slackware 12.2 system do I look to find the information needed?

@Astrogeek: I already saw that; unfortunately, I still do not know where to find the information that the variable needs to be set to.


Again, Thank you for the replies;

Gary

slack1992man 12-27-2008 02:54 PM

Are you running X? y/n
If you are not, you need to run X.
If you are, then: Were you logged in as root when you stated X (from the prompt) or did you su to root?
If you are in as root, then
Code:

echo $DISPLAY
If you su'ed into root, then you need to
Code:

xhost local:
before you do, and then
Code:

DISPLAY=:0.0
after you su into root

If none of this works, then please post the output of
Code:

echo $DISPLAY
and we'll star over ;)

pixellany 12-27-2008 02:54 PM

Interesting-----On my system, running "xwininfo" with no arguments allows you to click on a window to get a dump of information.

Can you run "xwininfo -name foo"? (Replace "foo" with the name of a window as it appears in the title bar.)

pixellany 12-27-2008 03:00 PM

But---"xwininfo -id <id>" does not want the display ID---it wants the window ID. I'm not getting why everyone's talking about $DISPLAY.

There is a -display option, but I assume that is to be used in conjunction with -id, -name, etc.

slack1992man 12-27-2008 03:06 PM

Quote:

Originally Posted by pixellany (Post 3388787)
But---"xwininfo -id <id>" does not want the display ID---it wants the window ID. I'm not getting why everyone's talking about $DISPLAY.

There is a -display option, but I assume that is to be used in conjunction with -id, -name, etc.

"Unable to open display" kicks out when X is not running or when the shell in use does not have access to an X screen. That was the purpose of my line of questioning. Lets see which it is.

astrogeek 12-27-2008 03:22 PM

HA! Yes, per slack'92man: let's start over...
 
I focused on the value of $DISPLAY as being the question, but maybe that was not the point you were asking.

Your use of xwininfo does indicate that you are not in an X session so there would be no meaningful value for $DISPLAY in that context...

And pixellany is correct, in an X environment as you used it, xwininfo wants the window ID, not the server ID...

So, as slack'92man said, let's start over and restate the question.

First, you stated that some things are not working, and I understand xwininfo to be an example of one that is not working? If that is correct, then the obvious question based on your output posted is:

Are you in an X session? ... then follow slack'92man's decision tree...

garyg007 12-27-2008 04:01 PM

My system is set to boot directly into init 4; KDE 3.5; loggen in as normal user.
The root Konsole was started by:
"K menu--->system--->more applications--->terminal program - super user mode", rather than
"su" from the user Konsole

I followed the steps suggested by slack1992man; actually using two consoles - the super user console and the user console running "xhost local:" from the regular user console
and then setting "DISPLAY=:0.0" from the super-user console. xwininfo now works from the super-user console.

What started me into this was when I installed hplip; hp-setup defaults to a gui application that needs to be run with root privileges, but failed because it could not open a window. I ended up having to resort to the interactive setup. I've tried running a number of other things that needed root privileges but failed when the tried to open a window.

Thank you all for taking the time to try and educate me

Gary

garyg007 12-27-2008 07:29 PM

Quote:

Originally Posted by astrogeek (Post 3388796)
I focused on the value of $DISPLAY as being the question, but maybe that was not the point you were asking.

Your use of xwininfo does indicate that you are not in an X session so there would be no meaningful value for $DISPLAY in that context...

Astrogeek, I did not see your post; yes, it took me all that time to prepare my 07:01PM post. The value of $DISPLAY was what I was looking for; Apparently I am/was completly clueless about what was going on.
Obviously, using "xwininfo" was a really bad example -- I wanted to keep my request for help generic and I came across "xwininfo" when an install of a perl mod failed - so I used that as an example

Thanks again

Gary

astrogeek 12-27-2008 07:46 PM

You are welcome!
 
Quote:

Originally Posted by garyg007 (Post 3388973)
Astrogeek, I did not see your post...

No problem, glad you got it figured out, and thanks for the courtesy of your reply!


All times are GMT -5. The time now is 10:15 AM.