Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

running xmodmap on startx

39 views
Skip to first unread message

John Tsiombikas

unread,
Dec 30, 2011, 5:32:49 AM12/30/11
to
Hello

I've got some custom keymappings in .Xmodmap such as mapping the caps lock key
to control, and the command key on a macbook to alt etc. Now, I'm pretty sure
my .Xmodmap file used to be applied automatically when I started the X server
(through startx, no display managers), but it's not happening any more, or my
keybindings are being overwritten at some point, I'm not sure which. The result
is that I have to manually execute xmodmap .Xmodmap on a terminal which is
becoming tedious really quickly.

I've tried adding the command to .xinitrc and still nothing. Now I know
the command must be executed because I added an echo redirected to
/tmp/foo in there and it gets written, so my guess is that something is
overriding my mappings further on in the xinit process.

Do you have any ideas or suggestions on how to find out what's going on
and fix this? Am I missing something here?

The system is Debian GNU/Linux btw, and also I'm not looking for any
desktop-environment-specific solutions to this problem, as I'm not using
one.

Cheers.

--
John Tsiombikas
http://nuclear.mutantstargoat.com/

Lucas Levrel

unread,
Dec 30, 2011, 10:16:19 AM12/30/11
to
Le 30 décembre 2011, John Tsiombikas a écrit :

> Do you have any ideas or suggestions on how to find out what's going on
> and fix this? Am I missing something here?

Maybe your window manager is overwriting your settings? What happens if
you start in failsafe (no WM)?

--
LL

Eli the Bearded

unread,
Dec 30, 2011, 4:23:29 PM12/30/11
to
In comp.windows.x, John Tsiombikas <nuc...@member.fsf.org> wrote:
> Do you have any ideas or suggestions on how to find out what's going on
> and fix this? Am I missing something here?

The startx program is usually a shell script:

$ file /usr/bin/startx
/usr/bin/startx: POSIX shell script text
$ head -15 /usr/bin/startx
#!/bin/sh

# $Xorg: startx.cpp,v 1.3 2000/08/17 19:54:29 cpqbld Exp $
#
# This is just a sample implementation of a slightly less primitive
# interface than xinit. It looks for user .xinitrc and .xserverrc
# files, then system xinitrc and xserverrc files, else lets xinit choose
# its default. The system xinitrc should probably do things like check
# for .Xresources files and merge them in, startup up a window manager,
# and pop a clock and serveral xterms.
#
# Site administrators are STRONGLY urged to write nicer versions.
#
# $XFree86: xc/programs/xinit/startx.cpp,v 3.16tsi Exp $

$

See that "STRONGLY urged" comment? If you have been around a while
(X11R3 seems so recent...) you know that what exactly startx does
various a lot. Read the one on your system.

I find it easier to just wholesale replace the startx script with
my own, to better control what defaults exist.

Set your environment variables, eg XAUTHORITY, and then call xinit:

xinit $HOME/.Xclients $opt_client_args -- /usr/bin/X $opt_server_args

The .Xclients file starts your initial programs (eg, xterms,
window manager, xclock, whaterver), and that is where your xmodmap
command should exit. The X environment will shut down when the Xclients
script ends, so write it with that in mind. Typically you start
everything in the background ("xterm ... &") except for the window
manager.

Here's a bit of my .Xclients by way of example:

#!/bin/ksh

# geometry as reported by xwininfo, alas this is wm dependent
# Top row
xterm -geometry 80x24+0+0 &
xterm -geometry 80x24+504+0 &
xterm -geometry 107x24-6+0 &

# ...

# Windowless commands

map=$HOME/xmodmap/2011-opensuse-dell/tab-numlock-caps.xmodmap
xmodmap $map

# xev | perl -wlne 'if(/ (keycode .*\)),/){print $1}'
xset=
# F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12
for n in 67 68 69 70 71 72 73 74 75 76 95 96 ; do
# -r keycode : surpress autorepeat for keycode
xset="$xset -r $n"
done
xset $xset

xscreensaver -nosplash &
icewm &
keypid=$!

# some window managers set their own background
sleep 2
xsetroot -solid lightblue

wait $keypid

Elijah
------
.Xclients are the easiest shell scripts to write
0 new messages