Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

After quite a few hours of searching now, I still can't work out how to do this.


  • French Windows Comfort Curve Keyboard 2000 (which is why I want to remap)
  • HP Pavilion dm4 laptop running Kubuntu 12.04.
  • Emacs 24.3.1 cassou-emacs-precise

I simply want the ⊞ Win keys (+ left Alt if it's easier) to map to the ◆ Meta key in Emacs. I have tried everything I can think of - xev tells me that the keys are mapped to META_L and META_R from KDE's point of view - why on earth am I having so much trouble?

I've seen lots of stuff about remapping "mac-..." and "w32-..." stuff but I'm running neither a Mac, nor Windows. Why is Alt no good for my ◆ Meta? Alt Gr (right Alt) is used for lots of letters on a French keyboard and it's not practical to change that and I want a ◆ Meta key on the right side of the keyboard.

So I have done further research: Using Konsole and emacs -nw does not work but if I change this either with KDE's keyboard management app or xmodmap then it does work with Emacs in GUI mode. Win_R-w then C-h l gives:

M-w C-h l

for Emacs in GUI mode and

ESC [ > 0 ; 1 1 5 ; 0 c w C-h l

in emacs -nw in Konsole.

share|improve this question
Could you please explain what you have tried, and how it fails. Your last paragraph seems to imply that you have solved it. – terdon Aug 23 '13 at 14:00
@terdon Only for Emacs frames on the X server, though. If it still doesn't work in Konsole, despite being xmodmapped to what you want it to be, the implication is that Konsole is doing something with the keystroke before passing it to Emacs; I'd be interested to see the output of M-x view-lossage (C-h l) after a chord involving the problematic key. – Aaron Miller Aug 23 '13 at 14:17
@AaronMiller that's right. I get: ESC [ > 0 ; 1 1 5 ; 0 c w C-h l After trying Win_L and Win_R with the character 'w' and then C-h l. – AntonOfTheWoods Aug 23 '13 at 14:24
@Antonovich Your comment ends with "I get:"; perhaps it'd work better to edit the lossage into your question? -- oh, there it is. – Aaron Miller Aug 23 '13 at 14:29
@AaronMiller - It's my first time posting so it's taking me a while to get the formatting right! Thanks for your patience... – AntonOfTheWoods Aug 23 '13 at 14:30
up vote 1 down vote accepted

This appears to result from the way in which Konsole handles the Meta key, and requires a source patch to fix. (In the following, 'a' is the unpatched version, and 'b' is the patched.)

--- a/konsole/konsole/TEmuVt102.cpp
+++ b/konsole/konsole/TEmuVt102.cpp
@@ -945,7 +945,8 @@  void TEmuVt102::onKeyPress( TQKeyEvent* ev )
                                      encodeMode(MODE_AppScreen     , BITS_AppScreen ) + // VT100 stuff
                                      encodeStat(TQt::ControlButton , BITS_Control   ) +
                                      encodeStat(TQt::ShiftButton   , BITS_Shift     ) +
-                                     encodeStat(TQt::AltButton     , BITS_Alt       ),
+                                     encodeStat(TQt::AltButton     , BITS_Alt       ) +
+                                     encodeStat(TQt::MetaButton        , BITS_Alt   ),
                           &cmd, &txt, &len, &metaspecified ))
 //printf("cmd: %d, %s, %d\n",cmd,txt,len);
   if (connected)
@@ -977,7 +978,7 @@  void TEmuVt102::onKeyPress( TQKeyEvent* ev )

   if (cmd==CMD_send) {
-    if ((ev->state() & TQt::AltButton) && !metaspecified ) sendString("\033");
+    if (((ev->state() & TQt::AltButton) || (ev->state() & TQt::MetaButton)) && !metaspecified ) sendString("\033");
     emit sndBlock(txt,len);
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .