> For the complete documentation index, see [llms.txt](https://wilskym.gitbook.io/hkl/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wilskym.gitbook.io/hkl/adding-hotkeys.md).

# Adding Hotkeys

How to add hotkeys using Hotkey Listener

First, ensure you import the library's namespace:

```
using WK.Libraries.HotkeyListenerNS;
```

...then instantiate the class and add some hotkeys:

> Hotkey Listener has its own built-in `Hotkey` class that lets you define modifiers and keys.

```
var hkl = new HotkeyListener();

// Define a new hotkey using the Hotkey class. 
// Parameters are: [modifiers], [keys].
Hotkey hotkey1 = new Hotkey(Keys.Control | Keys.Shift, Keys.J);

// You can also define a hotkey in string format. 
// Visit http://shorturl.at/ehJMN for more info.
Hotkey hotkey2 = new Hotkey("Control+Shift+D4");

hkl.Add(hotkey1);
hkl.Add(hotkey2);
```

The `Add()` method also allows adding an array of hotkeys:

```
hkl.Add(new[] { hotkey1, hotkey2 });
```

> **Important:** If you're building an application that has no external user-option for changing or customizing the default hotkey(s) set, something you'll need to consider when working with global hotkeys is that there are a number of predefined keys or key-combinations already in use within a number of applications such as [Google Chrome](https://chrome.google.com/) - for example `Control`+`Tab`. This then means that you might need to find the right key or key combination to use when shipping your applications.
