3

I want to switch Control and Command modifier keys in GNOME / Debian Jessie, because I use a Macintosh laptop.

I have managed to get these changed via the TweakTool -> Typing panel, like this:

  • Ctrl key position -> Left Ctrl as Meta
  • Alt/Win key behaviour -> Ctrl is mapped to Win keys (and the usua..)

But this introduces a new weird problem with the Alt key, that I can at least witness in JVM applications, e.g. IntelliJ IDEA: It is not possible any longer to use any keyboard shortcut that uses the Alt modifier.

For example the following prints the reported modifiers:

import javax.swing._
import java.awt.event.{InputEvent, KeyEvent}
val f = new JFrame
val p = new JPanel(new java.awt.GridLayout(3,1))
f.setContentPane(p)
val ls = Array.fill(3)(new JLabel("-"))
ls.foreach(p.add)
p.addKeyListener {
  new java.awt.event.KeyAdapter {
    def apply(i: Int, e: KeyEvent): Unit = 
      ls(i).setText(InputEvent.getModifiersExText(e.getModifiersEx))
    override def keyPressed (e: KeyEvent): Unit = apply(0, e)
    override def keyReleased(e: KeyEvent): Unit = apply(1, e)
    override def keyTyped   (e: KeyEvent): Unit = apply(2, e)
  }
}
f.setSize(200, 200)
f.setVisible(true)
p.requestFocus()

When I press down the Alt key, it is reported as such. But as soon as I press the additional key, e.g. Alt+A, both the pressed, typed and released modifier mask is simply changed to Meta. If I release the additional key first, then Alt, the reported mask on Alt release is Meta+Alt.

In any case, the expected behaviour is that Alt reporting is not changed at all. Since my development environment (IntelliJ IDEA) as well as many other applications make heavy use of Alt based shortcuts, I need to get this behaviour fixed. The bug is linked to the first setting (Ctrl key position), as soon as I disable it, Alt goes back to normal.


So is this a bug in Linux/GNOME? In OpenJDK (Alt still works normally in for example Iceweasel/Firefox)?

Is there an alternative way to flip Ctrl and Command without affecting the Alt keys?

  • Actually, the issue is less severe, because having Left Ctrl as Meta gives little benefits. Cycling through applications can be done with Alt+Tab instead. – 0__ Mar 5 '14 at 23:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.