4. How to Define a Hotkey - nanpuhaha/HotkeyNet GitHub Wiki

Here's a simple example of a hotkey definition. You would type these lines in the hotkey file on the computer where you press this hotkey:

    <hotkey Ctrl F3>
        <sendpc local>
            <sendwin Ubertastic>
            <text Whoopee!>

Each line of this definition tells HotkeyNet one of the four pieces of information that it needs for a hotkey.

  1. The keys that you press to trigger the action. In this case, Ctrl F3.

  2. The computer on which HotkeyNet types text or takes some other action. In this case it's the local computer, which means the computer on which you pressed Ctrl F3.

  3. The window that the text appears in. In this case it's the window of a program called Ubertastic.

  4. The action to be taken. In this case, HotkeyNet types "Whoopee!"

You don't have to indent lines as shown in the example, but it makes long definitions easier to read.

Hotkey Triggers

Triggers are the key combinations you press to fire a hotkey. Triggers can include regular modifiers, custom modifiers, and toggle modifiers. Here's a simple example:

    <Hotkey F1>

Here's an example with one regular modifier:

    <Hotkey RCtrl F1>

Here's an example with a custom modifier:

    <UseKeyAsModifier Esc>
    <Hotkey Esc F1>

Here's an example that fires only when NumLock is on and ScrollLock is off:

    <Hotkey NumLockOn ScrollLockOff F1>

Here's a complicated example:

    <UseKeyAsModifier Esc>
    <Hotkey LShift LCtrl NumLockOn Esc F1>

For more information about triggers, see Hotkey in the reference section. For a list of keys, see Keynames.


⚠️ **GitHub.com Fallback** ⚠️