> For the complete documentation index, see [llms.txt](https://docs.streamavatars.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/events/on-hotkey.md).

# On Hotkey

{% hint style="danger" %}
Hotkeys are only recognized while the application is in focus to prevent scripts that can act as keyloggers.
{% endhint %}

```lua
function yourEvent(string_modifier, string_hotkey)
    --isFocused is where the application is focused or not
    --string modifier will contain all modifiers that are held.
    --control+alt+shift
    --hotkey will contain a string based on which key is pressed
    --example: pressing 8 would give: N8
end

return function()
    addEvent('hotkeyPress', 'yourEvent');
    keepAlive();
end
```

{% hint style="info" %}
Events are asynchronous coroutines.
{% endhint %}

{% hint style="danger" %}
Hotkeys are only available for clients running the windows operating system.
{% endhint %}
