Hotkeys Quick Start

Overview

This documentation explains how to configure hotkeys in your configuration file. Hotkeys can be defined using various modifiers and keys, allowing you to create custom keyboard shortcuts for different actions.

Modifier Keys

Symbol Alternative Names Description
^ ctrl, control Control key
! alt, option Option (Alt) key
* shift, shft Shift key
# cmd, command, start Command key
fn fun, function Function key

Special Keys

Category Keys
Function Keys f1 through f20
Navigation home, end, pageup, pagedown
Arrow Keys left, right, up, down (or with arrow suffix)
Common Keys space, tab, return/enter, escape/esc
Editing delete/backspace, forwarddelete

Numpad Keys

Numpad keys are prefixed with numpad, for example: numpad0 through numpad9, numpadplus, numpadminus, numpadmultiply, numpaddivide, numpadenter, numpadclear

Examples

Basic Commands

Display a simple dialog:

f1: display dialog "Hello, World!" buttons {"OK"} default button "OK"

Shows a dialog box when F1 is pressed

Application Control

Launch applications using different methods:

^f1: runApp("AppCode.app") # Using internal runApp method f3: open XCode.app # Using shell command

Control + F1 launches AppCode, F3 launches XCode

Window Context Awareness

Execute commands based on active window:

f5: currentAppChrome(): openMenuItem("Google Chrome", "View", "Reload This Page")

When in Chrome, F5 triggers the reload menu item

Android Emulator specific command:

f2: currentWindowAndroidEmulator: APPADB -e shell input keyevent KEYCODE_APP_SWITCH

F2 sends a special keycode when Android Emulator is active

AppleScript Integration

Single-line AppleScript:

f4: osascript -e 'display dialog "Hello world"'

Executes a simple AppleScript command

Multi-line AppleScript with context:

f9: currentApp("com.apple.dt.Xcode"): appleScript: | tell application id "com.jetbrains.fleet" activate end tell

When in Xcode, F9 activates Fleet using AppleScript

Conditional Execution

Using else operator:

f6: CURRENT_APP_XCODE: osascript -e 'display dialog "Hello world"' else: runApp("AppCode.app")

If Xcode is active, show dialog; otherwise launch AppCode

Keyboard Layout Management

Switch between keyboard layouts:

!*: switchKeyboardLayout("com.apple.keylayout.US", "com.apple.keylayout.LatinAmerican")

Option + Shift switches between US and Latin American layouts

Display available layouts:

control-alt-command-l: displayAvailableKeyboardInputSources()

Control + Option + Command + L shows all available keyboard layouts

System Integration

Execute shell scripts and system commands:

#f7: ~/utl/shell-script-filename.sh # Run shell script f10: openConfig() # Open configuration ^#o: runApp("System Preferences") # Open System Preferences

Various system-level integrations

Configuration Format

Hotkeys are defined in YAML format with the following structure:

hotkeys:
  # Single line command
  ^f1: runApp("AppCode.app")

  # Multi-line command
  f5:
    currentAppChrome():
      openMenuItem("Google Chrome", "View", "Reload This Page")

macros:
  # Define reusable macros
  MACRO_NAME: replacement_value

Common Examples

Basic Commands

Hello World Dialog

f1: display dialog "Hello, World!" buttons {"OK"} default button "OK"

Shows a simple dialog box when F1 is pressed

Application Control

Launching Applications

# Using internal runApp method
^f1: runApp("AppCode.app")

# Using shell command
f3: open XCode.app

Two different methods to launch applications

Window Context Commands

Android Emulator Commands

f2:
  currentWindowAndroidEmulator: APPADB -e shell input keyevent KEYCODE_APP_SWITCH

Sends special keycode when Android Emulator is active

Chrome-Specific Commands

f5:
  currentAppChrome():
    openMenuItem("Google Chrome", "View", "Reload This Page")

Triggers Chrome's reload command when Chrome is active

AppleScript Integration

Single-line AppleScript

f4: osascript -e 'display dialog "Hello world"'

Executes a simple AppleScript command

Multi-line AppleScript

f9:
  currentApp("com.apple.dt.Xcode"):
    appleScript: |
      tell application id "com.jetbrains.fleet"
        activate
      end tell

Activates Fleet when Xcode is active

Conditional Commands

Using Else Operator

f6:
  CURRENT_APP_XCODE: osascript -e 'display dialog "Hello world"'
  else: runApp("AppCode.app")

Shows dialog in Xcode, otherwise launches AppCode

Keyboard Layout Control

Switching Layouts

# Switch between US and Latin American layouts
!*: switchKeyboardLayout("com.apple.keylayout.US", "com.apple.keylayout.LatinAmerican")

# Display available layouts
control-alt-command-l: displayAvailableKeyboardInputSources()

Commands for managing keyboard layouts

System Tools

Configuration and System Commands

# Run shell script
#f7: ~/utl/shell-script-filename.sh

# Open config
f10: openConfig()

# Reload config - useful after making changes
#f10: reloadConfig()

# Open System Preferences
^#o: runApp("System Preferences")

Various system-level commands and tools. Use reloadConfig() to apply changes without restarting the app.

Notes

Appendix: Complete Key Definitions

All Available Keys

Category Key Names
Numbers 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Letters a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z
Special Characters section/ยง, tilde/grave/`, minus/-, equal/=, leftbracket/[, rightbracket/], semicolon/;, quote/', comma/,, period/dot/., slash//, backslash/\\
Numpad numpad0 through numpad9, numpaddecimal, numpadmultiply, numpadplus, numpaddivide, numpadminus, numpadequals, numpadclear, numpadenter
Control Keys space, return/enter, tab, delete/backspace, forwarddelete, linefeed, escape/esc
Modifier Keys command/cmd/start, shift, capslock/caps, option/alt, control/ctrl, rightshift, rightoption/rightalt, rightcontrol, function/fn
Function Keys f1 through f20, f13/printscreen
Media Keys volumeup, volumedown, mute
Navigation help/insert, home, end, pageup, pagedown, leftarrow/left, rightarrow/right, downarrow/down, uparrow/up

All Modifier Symbols and Names

Symbol Alternative Names Description
^ control, ctrl Control modifier
! option, alt Option/Alt modifier
* shift, shft Shift modifier
# command, cmd, start Command modifier
fn function, fun Function modifier
caps capslock Caps Lock modifier
numpad numericpad Numeric Pad modifier
help - Help modifier