You are not logged in.

#1 2008-12-18 15:02:19

seansawyer
Member
Registered: 2008-08-18
Posts: 2

[Solved] Can't run xmodmap at LXDE startup

I'm trying to run xmodmap at startup to remap Ctrl and Caps Lock, so I have an desktop entry (xmodmap.desktop) in ~/.config/autostart as follows:

[Startup]
Type=Application
Name=Xmodmap
Comment=Remap keys in X.org
TryExec=xmodmap
Exec=xmodmap ~/.xmodmap
NoDisplay=true

Here are the contents of ~/.xmodmap:

!
! Swap Caps_Lock and Control_L
!
remove Lock = Caps_Lock
remove Control = Control_L
keycode 37 = Caps_Lock
keycode 66 = Control_L
add Lock = Caps_Lock
add Control = Control_L

I'm starting LXDE using xinit, so here are the contents of .xinitrc:

#!/bin/sh

exec startlxde

Running "xmodmap ~/.xmodmap" from a terminal after starting X works just fine, but when starting X (with xinit/startx) the keys are not mapped... Wondering what I'm missing here.

Last edited by seansawyer (2008-12-23 14:40:18)

Offline

#2 2008-12-18 16:11:22

bgc1954
Member
From: Edmonton, AB, Canada
Registered: 2006-03-14
Posts: 1,160

Re: [Solved] Can't run xmodmap at LXDE startup

it could be as simple as changing the [Startup] in your desktop file to [Desktop Entry] but that's a guess.  Or maybe your .config/autostart directory isn't being read for some reason--permissions problem?  Maybe try adding your xmodmap command to the /etc/xdg/lxsession/LXDE/autostart file to see if that works.  Just a bunch of suggestions for you. smile


Time is a great teacher, but unfortunately it kills all its pupils ... - Louis Hector Berlioz

Offline

#3 2008-12-23 14:38:53

seansawyer
Member
Registered: 2008-08-18
Posts: 2

Re: [Solved] Can't run xmodmap at LXDE startup

Thanks for the suggestions. I tried changing [Startup] to [Desktop Entry] in the desktop file (no dice) and further examined the permissions on the autostart dir (also to no avail). Putting it in /etc/xdg/lxsession/LXDE/autostart works, but I'd rather not have the keys remapped for all users on the machine.

Lucklily, after some more searching I came across this thread from the XFCE users list:
http://www.nabble.com/An-xmodmap-Issue-td20946296.html

There is a lot of good info in there, but the long and short of it is that adding the following line in ~/.xinitrc before starting LXDE does the trick:

test -r $HOME/.xmodmap && xmodmap $HOME/.xmodmap

Offline

Board footer

Powered by FluxBB