# Xmodmap at xsession?



## athos (Apr 11, 2012)

Hello everyone, I just wanted to ask a simple question. Can I use xmodmap at the ~/.xsession script? There's no way I can get xmodmap to work at startup. This is how my ~/.xsession looks like:


```
#!/bin/sh

#xcompmgr &
xrdb -merge $HOME/.Xresources &
eval `cat ~/.fehbg` &
setxkbmap es &
urxvtd &
xmodmap ~/.Xmodmap &

exec spectrwm
```

And this is my ~/.Xmodmap:


```
clear Lock
keycode 0x42 = Escape
```

Any ideas? I've been searching in the forum, and I found nothing. Thanks for your time.


----------



## SirDice (Apr 12, 2012)

I see no reason why you can't use it in ~/.xsession. Doesn't it work?

Do you use startx? If you do it's ~/.xinitrc that gets executed. Simplest solution is to symlink ~/.xsession and ~/.xinitrc so the files are always the same.


----------



## athos (Apr 12, 2012)

Hello SirDice,

The thing is that I use x11/xdm, so it uses ~/.xsession, not ~/.xinitrc.

I even tried writing the x11/xmodmap line in /usr/local/lib/X11/xdm/Xsetup_0, wich is the script that gets executed when x11/xdm is run (as root) but it just doesn't get the work done.


----------



## graudeejs (Apr 12, 2012)

athos said:
			
		

> Hello SirDice,
> 
> The thing is that I use x11/xdm, so it uses ~/.xsession, not ~/.xinitrc.
> 
> I even tried writing the x11/xmodmap line in /usr/local/lib/X11/xdm/Xsetup_0, wich is the script that gets executed when x11/xdm is run (as root) but it just doesn't get the work done.



For some WM you can execute it from ~/.xinitrc (or ~/.xsession [whatever]). For some WM's you *need* to execute it from WM itself (i.e. from WM config).


----------



## athos (Apr 13, 2012)

graudeejs said:
			
		

> For some WM you can execute it from ~/.xinitrc (or ~/.xsession [whatever]). For some WM's you *need* to execute it from WM itself (i.e. from WM config).



Hello again graudeejs,

Well, I set up the following line in ~/.spectrwm.com:


```
autorun  = ws[9]:urxvtc -e xmodmap ~/.Xmodmap
```

And it isn't working, I guess it's a matter of asking at the spectrwm forums...


----------

