HowTos/Keylaunch

From OpenZaurus

Contents

Keylaunch

Overview

keylaunch is used to bind 'commands' to hotkeys. For example, pressing 'Calendar' can load Calendar, and pressing 'Fn 3' can lower the brightness.

keylaunch is used by GPE to provide these hotkeys. There is a remarkable lack of documentation for keylaunch anywhere so the below information is the result of perusing the source code. Please feel free to correct any mistakes.

Description

Keylaunch uses /etc/keylaunchrc, and can also be (overridden? in addition?) by ~/.keylaunchrc.

A typical keylaunchrc may look like this: -

  # Comment
  
  key=....F9:-:command
  key=...*1:chvt 1
  key=....Released F9:anothercommand


Each line has the following format ([]'s means optional. {} means its a variable): -

  key={flag}[{option} ]{keyname}[ {combinekeyname}][:-]:[~]{command}

Lets look at each bit seperately: -

  • key= - This is always the same.
  • {flag} - 4 characters, normally ....
    • Each character corresponds to a modifier. If the modifier is pressed at the same time, then this key will be triggered. IE, Control + 1 can give a chvt 1.
    • If the FIRST character is '?', then all the flags are ignored, and it will trigger on ANY modifier
    • OTHERWISE, each character can be '.' (not selected) or '*' (selected), and the modifiers are as follows: -
  *... - Control
  .*.. - Shift
  ..*. - Alt
  ...* - Fn
  • [{option}] - Optional Option. Note the SPACE afterwards if used!
    • This dictates on what event the key must trigger. If you don't specify an option it assumes when the key is pressed.
    • The events can be one of the following: -
  Pressed - Occurs when the key is pressed
  Released - Occurs when the key is released
  Held - Occurs if the key is held for a bit
  Combine - Occurs when you press TWO keys (IE Calendar+AddressBook} You MUST provide {combinekeyname}.
    • Don't forget the space!!!
  • {keyname} - The name of the key to trigger on
    • The names are defined in /etc/keymap-2.6.map
  • [ {combinekeyname}] - Iff (if and only if) the Combine option is used you specify a second key here.
    • Don't forget the space BEFORE this (ie, between key and combinekeyname}
  • [:-] - Try to raise an existing window
    • If this exists then when the key is triggered keylaunch will first see if there is already a running instance of the command, and if so, just bring it into focus.
    • If it is omitted, then it will load a new instance every time.
  • [~] - Disable startup notify
    • If this exists (IE, a tilda before the commandname), then startup notify will not be used. I think this means that you won't see the hourglass in the corner.
  • {command} - Command to run
    • What command to run.

Example(s)

The following is a list of examples. Feel free to add your examples to the list.

 # keylaunchrc - Created 2006, BundaBRG (slc860)
 
 # Format: -
 #  key={flag}[{option} ]{key}[ {key2}][:-]:[~]{command}
 
 # Brightness Control (fn+3, fn+4)
 key=...*3:~display-brightness.sh down
 key=...*4:~display-brightness.sh up
 
 # Virtual Terminals (ctrl+alt+#) (doesnt work)
 key=*.*.1:~chvt 1
 key=*.*.2:~chvt 2
 key=*.*.3:~chvt 3
 key=*.*.4:~chvt 4
 key=*.*.5:~chvt 5
 key=*.*.6:~chvt 6
 key=*.*.7:~chvt 7
 key=*.*.8:~chvt 8
 key=*.*.9:~chvt 9
 key=*.*.0:~chvt 10
 
 # Calendar Hotkey
 key=....F9:-:gpe-calendar
 
 # Address Hotkey
 key=....F10:-:gpe-contacts
 
 # Email Hotkey
 key=....F13:-:sylpheed
 
 # Home Hotkey
 key=....F12:-:gpe-mini-browser
 
 # Menu Hotkey
 key=....F11:~matchbox-remote -menu
 key=...*F11:~matchbox-remote -panel-toggle
 
 # Above Home Silkscreen
 #key=....F5:
 
 # Home Silkscreen
 key=....F15:~display-brightness.sh up
 
 
 # Between Home/Email Silkscreen
 #key=....F6:
 
 # Email Silkscreen
 key=....F16:~display-brightness.sh down
 
 # Between Email/Contacts Silkscreen
 #key=....F7:
 
 # Contacts Silkscreen
 #key=....F17:
 
 # Between Contacts/Calendar Silkscreen
 #key=....F8:
 
 # Calendar Silkscreen
 #key=....F18:
 
 # Between Calendar/EJ
 # don't know
 
 
 # E/J Silkscreen
 key=....F19:~matchbox-remote -panel-toggle
 
 # Below E/J Silkscreen
 # don't know