Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have the following line in my .bashrc

xmodmap -e "keycode 116 = slash"

when I SSH to that machine, I get

xmodmap:  unable to open display ''

and needless to say, I want it out of there. Can anyone let me know how to clean this error?

OpenSSH_4.7p1 Debian-8ubuntu1.2, OpenSSL 0.9.8g 19 Oct 2007

Thank you for your help.

share|improve this question
1  
with both given answers you can cure the symptom, but imho the main problem is, that the xmodmap-call does not belong to .bashrc. it is something which should be set once for the current X11-session .. and not each time a shell is opened. so imho the xmodmap-call belongs to .xinitrc or .xsession, before you call your windowmanager. –  akira Oct 25 '09 at 16:49
    
Good point, akira. I didn't even think about this when answering. Dervin: Have you tried something like this? help.ubuntu.com/community/MultimediaKeys –  innaM Oct 28 '09 at 21:18

2 Answers 2

up vote 5 down vote accepted

You could change your .bashrc to only do run xmodmap if there is a display available:

if [ -n "${DISPLAY+x}" ]; then
    xmodmap -e "keycode 116 = slash"
fi
share|improve this answer
    
xmodmap, not xmodpmap, but it worked wonderfully. accepted. –  Dervin Thunk Oct 25 '09 at 16:16
    
I stand corrected. –  innaM Oct 25 '09 at 16:22
    
Unrelated, but [ -n "${DISPLAY+x}" ] can be replaced with a simpler [ "$DISPLAY" ] or [[ $DISPLAY ]]. –  grawity Oct 5 '11 at 6:00

That error is probably because you didn't enable X11 forwarding. Just run ssh with the -X option (ie

ssh -X -l user server.tld

or in putty click the option goto SSH -> X11 -> Enable X11 forwarding.

Of course you need to be running an Xserver first before you SSH in, Linux has this by default, where if you are running Windows you can use Xming.

If you don't use an X11 session whenever you SSH in, then just use Manni's solution.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.