Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'use .Xresources' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
use .Xresources
Authored by: Graff on Mar 09, '04 10:34:47PM

Ok, I created a working .Xdefaults but I had a problem with the .Xresources file. I renamed the .Xdefaults to .Xresources after I saw that it was working. When I tried to open an xterm in X11.app with the command "xterm &", the window opened up without any of my settings.

I did the xrdb command that you suggested and then I was able to open a window with my settings. However when I quit X11.app and restarted it I only got plain windows without any of my settings. I again did the xrdb command and as long as I didn't quit X11.app was able to open windows with my settings.

Any ideas?



[ Reply to This | # ]
use .Xresources
Authored by: mzs on Mar 10, '04 09:16:05AM

Do the following in your home dir.

verify that there is no .Xdefaults
create .Xresources with the resources that you like
verify that there is no .xsession file in your home dir

(you can verify with this command: file .Xdefaults .xsession)

Now quit X11 and start it again. It should work now. .Xresources will only take on a restart of X11, that is why you can do the xrdb command.

If that does not work, post a comment with the output of:

/bin/tcsh -c 'setenv'

(even if you are using bash, then this will give only the 'exported' vars)

Also as a sanity check, do:

ls -l $HOME/.Xresources

Maybe the permissions need to look like this: -rw-r--r--

Also do:

ls -l /usr/bin/cpp

This is used by X11 when your .Xresources file is sourced. (to handle comments and includes)

I am sort of grasping for straws by this point, but I hope there is some silly thing wrong this will find.



[ Reply to This | # ]
use .Xresources
Authored by: mzs on Mar 10, '04 09:24:55AM

One more thing, do you have an .xinitrc file in your home dir? You should not. That is supposed to be used in cases where you use a command like startx to start the X11 server and your window manager. You might have such a file and it may not source your .Xresources file. In fact you might do this command in your home dir and post the output:

ls -dl .[Xx]*



[ Reply to This | # ]
use .Xresources
Authored by: Graff on Mar 10, '04 08:53:48PM

Yep, that must be it. I have an .xinitrc file. I thought that this was needed for X11.app in order for it to use the quartz-wm window manager. This is what I have in that file:

xterm &
exec quartz-wm

Can I just remove the .xinitrc file or should I add in the xrdb command to "source" the .XResources file?

Hmm, I just tried removing the .xinitrc file and now the .XResources file works fine. I think that I had added a .xinitrc file in order to start up with a formatted X11 window. I used to have this code in there before I changed over to having a .XResources file:

xterm -rightbar -sb -sl 2000 -geometry 100x40 -bg black -fg white -fa Monaco -fs 11 &
exec quartz-wm


[ Reply to This | # ]
use .Xresources
Authored by: mzs on Mar 11, '04 09:34:34AM
I am happy I was able to help. If you like what the default starts for you, then you have no need for an .xinitrc file. If you really wish to change it, you can try creating an .xsession file in your home dir. (.xsession is intended for something like xdm plus xsm while .xinitrc is intended for something like startx. startx or somehting similar would be a script that assumes a terminal and can prompt the user asking things like which window manager to start, this is not how X11 is started on MacOS X so the .xsession file makes more sense.) .xsession is a script that takes no args and it should begin on the first line:

#!/bin/sh

It should be executable as well. It depends what the scripts on your system are like how it is started-up so to be safe on all systems you should always put the bourne shell shebang as the first line, make it executable, and assume that it is sourced by sh. On X11 by default is is started by part of a script that looks like this but these scripts do change from version to version:

#  The startup script is not intended to have arguments.

startup=$HOME/.xsession
resources=$HOME/.Xresources

if [ -s "$startup" ]; then
        if [ -x "$startup" ]; then
                exec "$startup"
        else
                exec /bin/sh "$startup"
        fi
...
fi

In your .xsession script you would like to have something like this:

resources=$HOME/.Xresources

if [ -r "$resources" ]; then
        xrdb -load "$resources"
fi

You may like to do -merge instead in case you have created some Xresources under /etc/X* or /usr/X* that you like to use but by now people should be using app-defaults instead.

After this you could have some lines like you had in the parent comment. Alternatively you might just have it start xsm. Do a man xsm in an xterm to see what that does and how to configure it.

So as you can see there is a LOT of detail to making good .xsession/.xinitrc files. I had to do it in the past when I had a networked home directory and several machines that I would run X sessions on with some having more or less heads (monitors). I have not done any of this compicated scripting on MacOS X though, so I have no idea what sort of gotcha's you might run into. I would just avoid as much of this as possible.

[ Reply to This | # ]