Hi, I was doing some experimenting with the latest servers, and found that the only way to get my custom .Xmodmap to be loaded automatically at startup was to force it to be read at the end of the DarwinKeyboardReloadHandler routine. Is it safe to call xmodmap at the end of the DarwinKeyboardReloadHandler routine? Using xmodmap is much easier than trying to parse the .Xmodmap files and then calling XkbApplyMappingChange. I had to background the calls to xmodmap or else the server would hang waiting for the xmodmap processes. I also only call xmodmap on the second (or any subsequent) calls to DarwinKeyboardReloadHandler. Here is my ugly hack to quartzKeyboard.c that seems to be working for me: diff -up xorg-server-1.4.2-apple49/hw/xquartz/quartzKeyboard.c.orig xorg-server-1.4.2-apple49/hw/xquartz/quartzKeyboard.c --- xorg-server-1.4.2-apple49/hw/xquartz/quartzKeyboard.c.orig 2009-10-14 11:06:49.000000000 -0400 +++ xorg-server-1.4.2-apple49/hw/xquartz/quartzKeyboard.c 2009-10-14 00:07:14.000000000 -0400 @@ -172,6 +172,7 @@ const static struct { darwinKeyboardInfo keyInfo; pthread_mutex_t keyInfo_mutex = PTHREAD_MUTEX_INITIALIZER; +int ran_darwin_kbdreload = 0; static void DarwinChangeKeyboardControl(DeviceIntPtr device, KeybdCtrl *ctrl) { // FIXME: to be implemented @@ -372,6 +373,9 @@ void DarwinKeyboardReloadHandler(void) { CFIndex initialKeyRepeatValue, keyRepeatValue; BOOL ok; DeviceIntPtr pDev = darwinKeyboard; + const char *xmodmap = PROJECTROOT "/bin/xmodmap"; + const char *sysmodmap = PROJECTROOT "/lib/X11/xinit/.Xmodmap"; + char *homedir, usermodmap[1024], cmd[1024]; DEBUG_LOG("DarwinKeyboardReloadHandler\n"); @@ -415,6 +419,28 @@ void DarwinKeyboardReloadHandler(void) { } XkbUpdateCoreDescription(darwinKeyboard, 0); } pthread_mutex_unlock(&keyInfo_mutex); + + if (ran_darwin_kbdreload > 0 && access(xmodmap, F_OK) == 0) { + + /* Check for system .Xmodmap */ + if (access(sysmodmap, F_OK) == 0) { + snprintf (cmd, sizeof(cmd), "exec %s %s &", xmodmap, sysmodmap); + System(cmd); + } + + /* Check for user's local .Xmodmap */ + homedir = getenv("HOME"); + if (homedir != NULL) { + snprintf (usermodmap, sizeof(usermodmap), "%s/.Xmodmap", homedir); + if (access(usermodmap, F_OK) == 0) { + snprintf (cmd, sizeof(cmd), "exec %s %s &", xmodmap, usermodmap); + System(cmd); + } + } + + } else + ran_darwin_kbdreload++; + } //----------------------------------------------------------------------------- Thanks, Martin