Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Linux utility to configure modifier keys to act as other keys when pressed and released on their own.
C Groff Makefile
Branch: master

This branch is 16 commits ahead, 10 commits behind alols:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
LICENSE
Makefile
README.md
superkey-launch.1
superkey-launch.c
superkey-launch.desktop

README.md

SUPERKEY-LAUNCH

superkey-launch allows you to use a modifier key as another key when pressed and released on its own. Note that it is slightly slower than pressing the original key, because the pressed event does not occur until the key is released. The default behaviour is to generate Alt+F2 when the Left Superkey is pressed and released on its own. This allows you to quickly launch applications in many popular Linux desktop environments (Mate, XFCE, KDE, Fluxbox and more!).

Slackware Linux SlackBuild available here:

http://slackbuilds.org/repository/14.1/desktop/superkey-launch/

AUTOSTART

To start superkey-launch at startup within all X environments, place superkey-launch.desktop in /etc/xdg/autostart.

Minimal building instructions

$ git clone https://github.com/ryanpcmcquen/superkey-launch.git .
$ make

Usage

$ superkey-launch [-d] [-t <timeout ms>] [-e <map-expression>]

-d

Debug mode. Does not fork into the background.

-t <timeout ms>

If you hold a key longer than this timeout, superkey-launch will not generate a key event. Default is 500 ms.

-e <map-expression>

The expression has the grammar 'ModKey=Key[|OtherKey][;NextExpression]'

The list of key names is found in the header file X11/keysymdef.h (remove the XK_ prefix). Note that due to limitations of X11 shifted keys must be specified as a shift key followed by the key to be pressed rather than the actual name of the character. For example to generate "{" the expression 'ModKey=Shift_L|bracketleft' could be used (assuming that you have a key with "{" above "[").

You can also specify ModKey in decimal (prefix #), octal (#0), or hexadecimal (#0x). It will be interpreted as a keycode unless no corresponding key name is found.

Examples

  • This will make Left Shift generate Escape when pressed and released on it's own, and Left Control generate Ctrl-O combination when pressed and released on it's own.

    superkey-launch -e 'Shift_L=Escape;Control_L=Control_L|O'
    
  • In conjugation with xmodmap it is possible to make an ordinary key act as an extra modifier. First map the key to the modifier with xmodmap and then the modifier back to the key with superkey-launch. However, this has several limitations: the key will not work as ordinary until it is relased, and in particular, it may act as a modifier unintentionally if you type too fast. This is not a bug in superkey-launch, but an unavoidable consequence of using these two tools together in this way. As an example, we can make the space bar work as an additional ctrl key when held (similar to Space2ctrl) with the following sequence of commands.

    # Map an unused modifier's keysym to the spacebar's keycode and make it a
    # control modifier. It needs to be an existing key so that emacs won't
    # spazz out when you press it. Hyper_L is a good candidate.
    spare_modifier="Hyper_L"
    xmodmap -e "keycode 65 = $spare_modifier"
    xmodmap -e "remove mod4 = $spare_modifier" # hyper_l is mod4 by default
    xmodmap -e "add Control = $spare_modifier"
    
    # Map space to an unused keycode (to keep it around for superkey-launch to
    # use).
    xmodmap -e "keycode any = space"
    
    # Finally use superkey-launch to cause the space bar to generate a space when tapped.
    superkey-launch -e "$spare_modifier=space"
    

Note regarding xmodmap

If you are in the habit of remapping keycodes to keysyms (eg, using xmodmap), there are two issues you may encounter.

  1. You will need to restart superkey-launch after every time you modify the mapping from keycodes to keysyms (eg, with xmodmap), or superkey-launch will still use the old mapping.

  2. The key you wish to send must have a defined keycode. So for example, with the default mapping Super_L=Alt_L|F2, you still need an Alt+F2 key defined in your xmodmap mapping. (I get around this by using 255, which my keyboard cannot send).

Contact

Find the latest version at https://github.com/ryanpcmcquen/superkey-launch

The author can be reached at ryan dot q at linux dot com

Something went wrong with that request. Please try again.