xmodmap during in .xinitrc does not stick
On one of my machines, xmodmap runs during XQuartz startup but the changes it makes do not stick. In my setup (Mavericks, XQuartz 2.7.5), I have a simple .xmodmap to switch Mod1 and Mod2: clear Mod1 clear Mod2 add Mod1 = Meta_L Meta_R add Mod2 = Mode_switch I run my .xinitrc with `/bin/sh -x', so system.log shows what .xinitrc is doing: 23.01.14 20:49:09,867 org.macosforge.xquartz.startx[89292]: xauth: file /home/crestani/.serverauth.89293 does not exist 23.01.14 20:49:11,927 org.macosforge.xquartz.startx[89292]: /opt/X11/bin/xinit: XFree86_VT property unexpectedly has 0 items instead of 1 23.01.14 20:49:12,044 org.macosforge.xquartz.startx[89292]: + userresources=/home/crestani/.Xdefaults 23.01.14 20:49:12,044 org.macosforge.xquartz.startx[89292]: + usermodmap=/home/crestani/.xmodmap 23.01.14 20:49:12,044 org.macosforge.xquartz.startx[89292]: + sysresources=/etc/X11/xinit/.Xresources 23.01.14 20:49:12,044 org.macosforge.xquartz.startx[89292]: + sysmodmap=/etc/X11/xinit/.Xmodmap 23.01.14 20:49:12,044 org.macosforge.xquartz.startx[89292]: + '[' -f /etc/X11/xinit/.Xresources ']' 23.01.14 20:49:12,044 org.macosforge.xquartz.startx[89292]: + '[' -f /etc/X11/xinit/.Xmodmap ']' 23.01.14 20:49:12,044 org.macosforge.xquartz.startx[89292]: + '[' -f /home/crestani/.Xdefaults ']' 23.01.14 20:49:12,044 org.macosforge.xquartz.startx[89292]: + xrdb -merge /home/crestani/.Xdefaults 23.01.14 20:49:12,083 org.macosforge.xquartz.startx[89292]: + '[' -f /home/crestani/.xmodmap ']' 23.01.14 20:49:12,083 org.macosforge.xquartz.startx[89292]: + xmodmap /home/crestani/.xmodmap 23.01.14 20:49:12,086 org.macosforge.xquartz.startx[89292]: + xset -b 23.01.14 20:49:12,088 org.macosforge.xquartz.startx[89292]: + xmodmap 23.01.14 20:49:12,090 org.macosforge.xquartz.startx[89292]: + exec quartz-wm It runs `xmodmap /home/crestani/.xmodmap', but when app_to_run (xterm) launches, the changes are no longer there: crestani@bender [~] xmodmap xmodmap: up to 2 keys per modifier, (keycodes in parentheses): shift Shift_L (0x40), Shift_R (0x44) lock Caps_Lock (0x41) control Control_L (0x43), Control_R (0x46) mod1 Mode_switch (0x42), Mode_switch (0x45) mod2 Meta_L (0x3f), Meta_R (0x47) mod3 mod4 mod5 I can run xmodmap manually, then the xmodmap settings are correct and stick as long as XQuartz is running. crestani@bender [~] xmodmap /home/crestani/.xmodmap crestani@bender [~] xmodmap xmodmap: up to 2 keys per modifier, (keycodes in parentheses): shift Shift_L (0x40), Shift_R (0x44) lock Caps_Lock (0x41) control Control_L (0x43), Control_R (0x46) mod1 Meta_L (0x3f), Meta_R (0x47) mod2 Mode_switch (0x42), Mode_switch (0x45) mod3 mod4 mod5 For debugging, I log the result of `xmodmap'[1] in .xinitrc immediatly before it execs quartz-wm (see second to last line in the system.log excerpt above). It showed the desired mapping (mod1 is Meta and mod2 is Mode_switch). There must be something undoing my xmodmap settings between the time my machine finishes .xinitrc and the time the first xterm comes up. I suspect some race condition, possibly with xkb. Does anybody have a guess or a hint what I should observe to identify the problem? Is the xkb error in org.macosforge.xquartz.log related to my problem? [3232113.457] (II) GLX: Initialized Core OpenGL GL provider for screen 0 [3232113.575] X11.app: DarwinProcessFDAdditionQueue_thread: Sleeping to allow xinitrc to catchup. [3232113.596] (EE) Error loading keymap /tmp/server-30.xkm [3232113.596] (EE) XKB: Failed to load keymap. Loading default keymap instead. [3232115.602] noPseudoramiXExtension=0, pseudoramiXNumScreens=1 [3232116.578] Calling ListenOnOpenFD() for new fd: 8 Is xmodmap still the recommended way to modify keyboard mappings in XQuartz or should I switch to xkb? How would I change the xkb configuration, since as far as I understand XQuartz does not use a static xkb configuration but instead generates the configuration dynamically from OS X's keyboard settings? Thanks for your help! Footnotes: [1] I needed to redirect xmodmap's output to a file but I was not able to find the location to where the output of the commands that are called by .xinitrc gets logged. Does anybody know where the output is logged? -- Marcus
Don't use ~/.xinitrc ... place scripts in ~/.xinitrc.d Use ~/.Xmodmap (notice the case), and it will be managed for you On Jan 23, 2014, at 12:40, Marcus Crestani <crestani@informatik.uni-tuebingen.de> wrote:
On one of my machines, xmodmap runs during XQuartz startup but the changes it makes do not stick. In my setup (Mavericks, XQuartz 2.7.5), I have a simple .xmodmap to switch Mod1 and Mod2:
clear Mod1 clear Mod2 add Mod1 = Meta_L Meta_R add Mod2 = Mode_switch
I run my .xinitrc with `/bin/sh -x', so system.log shows what .xinitrc is doing:
23.01.14 20:49:09,867 org.macosforge.xquartz.startx[89292]: xauth: file /home/crestani/.serverauth.89293 does not exist 23.01.14 20:49:11,927 org.macosforge.xquartz.startx[89292]: /opt/X11/bin/xinit: XFree86_VT property unexpectedly has 0 items instead of 1 23.01.14 20:49:12,044 org.macosforge.xquartz.startx[89292]: + userresources=/home/crestani/.Xdefaults 23.01.14 20:49:12,044 org.macosforge.xquartz.startx[89292]: + usermodmap=/home/crestani/.xmodmap 23.01.14 20:49:12,044 org.macosforge.xquartz.startx[89292]: + sysresources=/etc/X11/xinit/.Xresources 23.01.14 20:49:12,044 org.macosforge.xquartz.startx[89292]: + sysmodmap=/etc/X11/xinit/.Xmodmap 23.01.14 20:49:12,044 org.macosforge.xquartz.startx[89292]: + '[' -f /etc/X11/xinit/.Xresources ']' 23.01.14 20:49:12,044 org.macosforge.xquartz.startx[89292]: + '[' -f /etc/X11/xinit/.Xmodmap ']' 23.01.14 20:49:12,044 org.macosforge.xquartz.startx[89292]: + '[' -f /home/crestani/.Xdefaults ']' 23.01.14 20:49:12,044 org.macosforge.xquartz.startx[89292]: + xrdb -merge /home/crestani/.Xdefaults 23.01.14 20:49:12,083 org.macosforge.xquartz.startx[89292]: + '[' -f /home/crestani/.xmodmap ']' 23.01.14 20:49:12,083 org.macosforge.xquartz.startx[89292]: + xmodmap /home/crestani/.xmodmap 23.01.14 20:49:12,086 org.macosforge.xquartz.startx[89292]: + xset -b 23.01.14 20:49:12,088 org.macosforge.xquartz.startx[89292]: + xmodmap 23.01.14 20:49:12,090 org.macosforge.xquartz.startx[89292]: + exec quartz-wm
It runs `xmodmap /home/crestani/.xmodmap', but when app_to_run (xterm) launches, the changes are no longer there:
crestani@bender [~] xmodmap xmodmap: up to 2 keys per modifier, (keycodes in parentheses):
shift Shift_L (0x40), Shift_R (0x44) lock Caps_Lock (0x41) control Control_L (0x43), Control_R (0x46) mod1 Mode_switch (0x42), Mode_switch (0x45) mod2 Meta_L (0x3f), Meta_R (0x47) mod3 mod4 mod5
I can run xmodmap manually, then the xmodmap settings are correct and stick as long as XQuartz is running.
crestani@bender [~] xmodmap /home/crestani/.xmodmap crestani@bender [~] xmodmap xmodmap: up to 2 keys per modifier, (keycodes in parentheses):
shift Shift_L (0x40), Shift_R (0x44) lock Caps_Lock (0x41) control Control_L (0x43), Control_R (0x46) mod1 Meta_L (0x3f), Meta_R (0x47) mod2 Mode_switch (0x42), Mode_switch (0x45) mod3 mod4 mod5
For debugging, I log the result of `xmodmap'[1] in .xinitrc immediatly before it execs quartz-wm (see second to last line in the system.log excerpt above). It showed the desired mapping (mod1 is Meta and mod2 is Mode_switch).
There must be something undoing my xmodmap settings between the time my machine finishes .xinitrc and the time the first xterm comes up. I suspect some race condition, possibly with xkb. Does anybody have a guess or a hint what I should observe to identify the problem?
Is the xkb error in org.macosforge.xquartz.log related to my problem?
[3232113.457] (II) GLX: Initialized Core OpenGL GL provider for screen 0 [3232113.575] X11.app: DarwinProcessFDAdditionQueue_thread: Sleeping to allow xinitrc to catchup. [3232113.596] (EE) Error loading keymap /tmp/server-30.xkm [3232113.596] (EE) XKB: Failed to load keymap. Loading default keymap instead. [3232115.602] noPseudoramiXExtension=0, pseudoramiXNumScreens=1 [3232116.578] Calling ListenOnOpenFD() for new fd: 8
Is xmodmap still the recommended way to modify keyboard mappings in XQuartz or should I switch to xkb? How would I change the xkb configuration, since as far as I understand XQuartz does not use a static xkb configuration but instead generates the configuration dynamically from OS X's keyboard settings?
Thanks for your help!
Footnotes: [1] I needed to redirect xmodmap's output to a file but I was not able to find the location to where the output of the commands that are called by .xinitrc gets logged. Does anybody know where the output is logged?
-- Marcus
_______________________________________________ Xquartz-dev mailing list Xquartz-dev@lists.macosforge.org https://lists.macosforge.org/mailman/listinfo/xquartz-dev
Jeremy, thanks a lot for your quick reply!
"JHS" == Jeremy Huddleston Sequoia <jeremyhu@apple.com> writes: JHS> Don't use ~/.xinitrc ... place scripts in ~/.xinitrc.d
I did and this simplifies things a lot, thanks. Reworking my configuration led to another problem. The environment when the scripts in ~/.xinitrc.d run is not set according to my .cshrc (my login shell is /bin/tcsh). The launched WM has my environment, however. A `printenv' in a script below ~/.xinitrc.d shows an environment without my settings: SHELL=/bin/tcsh TMPDIR=/var/folders/zz/zyxvpxvq6csfxvn_n0000nqr0005dy/T/ Apple_PubSub_Socket_Render=/tmp/launch-JaMsGM/Render USER=crestani SSH_AUTH_SOCK=/tmp/launch-PNlOy8/Listeners PATH=/opt/X11/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin PWD=/ HOME=/home/crestani SHLVL=2 LOGNAME=crestani __LAUNCHD_FD=36 DISPLAY=:43 X11_PREFS_DOMAIN=org.macosforge.xquartz.X11 XAUTHORITY=/home/crestani/.Xauthority _=/usr/bin/printenv Is there a way to have the .xinitrc scripts inherit my tcsh environment settings? JHS> Use ~/.Xmodmap (notice the case), and it will be managed for you Thanks, that helped. -- Marcus
On Jan 24, 2014, at 00:31, Marcus Crestani <crestani@informatik.uni-tuebingen.de> wrote:
Jeremy,
thanks a lot for your quick reply!
"JHS" == Jeremy Huddleston Sequoia <jeremyhu@apple.com> writes: JHS> Don't use ~/.xinitrc ... place scripts in ~/.xinitrc.d
I did and this simplifies things a lot, thanks. Reworking my configuration led to another problem. The environment when the scripts in ~/.xinitrc.d run is not set according to my .cshrc (my login shell is /bin/tcsh). The launched WM has my environment, however. A `printenv' in a script below ~/.xinitrc.d shows an environment without my settings:
SHELL=/bin/tcsh TMPDIR=/var/folders/zz/zyxvpxvq6csfxvn_n0000nqr0005dy/T/ Apple_PubSub_Socket_Render=/tmp/launch-JaMsGM/Render USER=crestani SSH_AUTH_SOCK=/tmp/launch-PNlOy8/Listeners PATH=/opt/X11/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin PWD=/ HOME=/home/crestani SHLVL=2 LOGNAME=crestani __LAUNCHD_FD=36 DISPLAY=:43 X11_PREFS_DOMAIN=org.macosforge.xquartz.X11 XAUTHORITY=/home/crestani/.Xauthority _=/usr/bin/printenv
Is there a way to have the .xinitrc scripts inherit my tcsh environment settings?
They are sourced (not executed) from xinitrc, which is a bash script: if [ -d "${HOME}/.xinitrc.d" ] ; then for f in "${HOME}"/.xinitrc.d/*.sh ; do [ -x "$f" ] && . "$f" done unset f fi If you want to inherit your tcsh environment, then unfortunately, I think the only way would be creating ~/.xinitrc as: #!/bin/tcsh exec /opt/X11/lib/X11/xinit/xinitrc or whatever the tcsh syntax is.
"JHS" == Jeremy Huddleston Sequoia <jeremyhu@apple.com> writes: JHS> If you want to inherit your tcsh environment, then unfortunately, I JHS> think the only way would be creating ~/.xinitrc as:
Thanks, that does the trick. Shouldn't the shell's environment already be there when XQuartz launches any of the xinitrc scripts? /Applications/Utilities/XQuartz.app/Contents/MacOS/X11 executes the right shell and sets up the user's environment. Do the xinit scripts get called without inheriting the environment? -- Marcus
participants (2)
-
Jeremy Huddleston Sequoia
-
Marcus Crestani