If you're just interested in remapping keys in a manner that works for any wm, I think I have a way for any typical X wm but you would probably have to configure it per wm. For example, in Awesome, I add the following line to the end of my rc.lua
:
awful.util.spawn_with_shell("/usr/bin/setxkbmap -option caps:swapescape -option altwin:ctrl_win")
with my other autostart items. The above options will swap escape and capslock and map the "windows" keys (and the usual ctrl keys) to ctrl.
Whatever DE or wm you use, it should offer a way to autostart commands. Autostarting the appropriate setxkbmap
command should remap your keys. I've done this in various window managers. AFAIK, this is the reliable, "proper" way to remap keys, in contrast to xmodmap, which seems flakey.
To remap the keys you want, you need to know the appropriate options and key values to pass. You can find a list in /usr/share/X11/xkb/rules/xorg.lst
Of course, you could use setxkbmap
in .xinitrc
also, but as you pointed out, lightdm doesn't seem to use it when loading the sessions. Since I use lightdm too, I don't usually think of editing xinitrc
, but it just struck me that there should be a way of starting a user-defined X session through lightdm... and I found this answer. That might be more in line with what you want to do.