2

I'm running XMonad with XQuartz on an 11,3 Macbook Prop Retina. My .xinitrc looks as follow:

[[ -f ~/.Xdefaults ]] && xrdb -load ~/.Xdefaults
export LANG="en_CA.UTF-8"
xmodmap /Users/xxxxxxx/.xmodmarc
cd $HOME
/Users/xxxxxxxx/Library/Haskell/bin/xmonad

I've noticed that both the LANG export and the xmodmap are being called, but their effects are not persisting. If I throw some env >> tmp.txt in there I can see that it's a different environment than when I finally reach a terminal, and I suspect perhaps even a different user that is calling xinit.

My Questions

  • what user or environment is actually calling xinit when you startup XQuartz?
  • where is the appropriate place to put xmodmap so that it's called once, and only once, when XQuartz is started?
  • How do I get the LANG set once, and only once, as an environment variable when I start XQuartz (I need it for unicode support)

Thank you!

  • you have cd $HOME in your ~/.xinitrc? If yes, then remove that line. Also, place exec in front of your call to xmonad, like this: exec .../bin/xmonad. Also, note that export only alters the environment of the current process and child processes of the current process. It has no effect on processes already running, such as another instance of terminal. – Alexej Magura Mar 29 '14 at 23:06
2
+25

What user/env is actually calling xinit when you start XQuartz?

Under Linux, this would be the user that you logged in as; I'd suspect that it's probably the same for Mac OS X. As for the environment, whatever the current environment is when you run xinit, that will be the environment that XQuartz runs with, excepting changes to the environment done within one of the files that XQuartz reads when it starts up.

Where should I put xmodmap so that it's called once, and only once, when XQuartz is started?

To create your own custom map/table and store it in a configuration file, run:

xmodmap -pke > ~/.Xmodmap

Make the desired changes to ~/.Xmodmap and then test the new configuration with:

xmodmap ~/.Xmodmap

To active your custom table when starting Xorg, that is XQuartz, add the following to your ~/.xinitrc

[ -s ~/.Xmodmap ] && xmodmap ~/.Xmodmap # you can also try using `[[ -s ~/.Xmodmap ]] && xmodmap ~/.Xmodmap`

How do I get the LANG set once, and only once, as an environment variable when I start XQuartz (I need it for unicode support)

To set LANG, simply add one of the following to your ~/.xinitrc

[[ -z "$LANG" ]] && LANG=<VALUE> # only sets LANG, if LANG is empty
LANG=<VALUE> # sets LANG regardless of whether it is or is not empty
  • Unfortunately this didn't work. I'd had an .xinitrc already with similar code. I believe the problem is related somehow to the environment in which xinit is being called. If I run whoami in .xinitrc I get the correct user. However, if I look at $ENV within .xinitrc (by running echo "$ENV" >> /Users/.../tmp.txt) I see a different environment than when I finally land in the shell. – aaronlevin Apr 1 '14 at 15:38
  • @weirdcanada have you checked the docs for XQuartz to see if it covers this kind of issue? – Alexej Magura Apr 1 '14 at 18:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .