Using the <Super> key for keyboard shortcuts

This howto describes features in Linux Mint 7 (Gloria) and Ubuntu 9.04 (Jaunty Jackalope)

Having come to Linux from Windows, and having to still use and support Windows from time to time at work, I have become very familiar with some of the default shorcuts Windows uses that involve the Windows key (that little key between the <Ctrl> and <Alt> that has the Windows flag on it) such as:

  • <Win>+D to toggle the desktop
  • <Win>+E to launch Windows Explorer
  • <Win>+L to lock the screen

I currently use Mint 7 and found that it provides these same shortcuts (and so many more) by default, but that it maps the shortcuts to different key combos.  I learned the combos (like <Ctrl>+<Alt>+L to lock the screen.  But switching back and forth between Windows and Mint made it difficult when I hit <Win>+E in Mint, and it launches the Expo wall.

Linux distros generally reference the Windows key as <Super> or <Mod4>, so I figured I could edit my preferences and set my shortcuts to work the way my fingers expect them to.  However, I ran into some problems. Firstly, with Compiz at least, keyboard shortcuts are managed from a couple different places.  The (sensibly named) Keyboard Shortcuts application in your Mint menu manages quite a few of them, but others can be found in the CompizConfig Settings Manager (aka CCSM).  The CCSM also lets you create shortcuts for commands, so if the window manager doesn’t already do it (like launch nautilus ~/ or gnome-terminal then you can create a shortcut to execute that command.

Since I wanted to mimic Windows’ default shortcuts mentioned above, I had to make changes in both the Keyboard Shortcuts and CCSM in order to accomplish what I wanted. But before I could do any of them, I had to make it to where the Windows key worked as a combination key. This post on the Ubuntu forums pointed me in the right direction. I never would have found this setting on my own.  Here’s how to do it:

  1. You have to go to the Keyboard Preferences (it just shows up as Keyboard in the Mint Menu) application
  2. Select the Layouts tab
  3. Click the Layout Options button
  4. Expand the Alt/Win Key Behavior heading
  5. Select the “Super is mapped to Win keys” option

Now when you go to Keyboard Preferences and you try to set a key combo, the Windows key doesn’t just show up as Super_L (meaning the left Windows key acting as an individual key), it shows up as Mod4+[whatever key you combine with it] meaning it works like Ctrl and Alt and Shift as a combo key.

Now to set the <Super> combos I listed at the top of the post:

Locking the screen

  1. Open Keyboard Shortcuts
  2. Click the line that has “Lock Screen” (the shortcut will change to “New Shortcut…”)
  3. Press the key combo you want (i.e., <Win>+L) and the shortcut will change to Mod4+L.

Launch the home directory

  1. Open Keyboard Shortcuts
  2. Click the line that has “Home Folder” (the shortcut will change to “New Shortcut…”)
  3. Press the key combo you want (i.e., <Win>+E) and the shortcut will change to Mod4+E.

Toggling the desktop

  1. Open CCSM
  2. Select General/General Options/Keybindings
  3. Scroll down to the Show Desktop line (the one that has a keyboard icon next to it, not the one that has the monitor icon next to it)
  4. Click the shortcut button (It will either say “Disabled” or will show the shortcut key combination)
    • If the button says Disabled, you will get a pop-up window that lets you enable it with a checkbox.  The window will then switch to the one that lets you set the combination.
    • If the button already has a shortcut, it will jump right to the the pop-up window that lets you change the combination
  5. Click the “grab key combination” button
  6. Press the key combination you want to set for the shortcut
  7. Click “OK” to close the pop-up window and save your preference
  8. Alternately, you can click the edit icon and type the shortcut, such as <Super>+d or <Ctrl>+<Alt>+d

Anything Else

  1. Open CCSM
  2. Go to General/Commands
  3. On the first available command line, enter the command you want the shortcut to run
  4. Go to the Key Bindings tab
  5. Click the shortcut button for the command line that corresponds to the line you entered your command on (ie, if you entered your command on “Command Line 0 ” then click the shortcut button for “Run command 0”)
  6. Click the shortcut button (It will either say “Disabled” or will show the shortcut key combination)
    • If the button says Disabled, you will get a pop-up window that lets you enable it with a checkbox.  The window will then switch to the one that lets you set the combination.
    • If the button already has a shortcut, it will jump right to the the pop-up window that lets you change the combination
  7. Click the “grab key combination” button
  8. Press the key combination you want to set for the shortcut
  9. Click “OK” to close the pop-up window and save your preference
  10. Alternately, you can click the edit icon and type the shortcut, such as <Super>+d or <Ctrl>+<Alt>+d
Advertisements