FMUtils.KeyboardHook
Lightweight wrapper for SetWindowsHookEx
Install / Use
/learn @factormystic/FMUtils.KeyboardHookREADME
_________ ____ _ _ _ _ _ __ _ _ _ _ _
| ___| \/ | | | | | (_) | | | / / | | | | | | | | |
| |_ | . . | | | | |_ _| |___ | |/ / ___ _ _| |__ ___ __ _ _ __ __| | |_| | ___ ___ | | __
| _| | |\/| | | | | __| | / __| | \ / _ \ | | | '_ \ / _ \ / _` | '__/ _` | _ |/ _ \ / _ \| |/ /
| | | | | | |_| | |_| | \__ \_| |\ \ __/ |_| | |_) | (_) | (_| | | | (_| | | | | (_) | (_) | <
\_| \_| |_/\___/ \__|_|_|___(_)_| \_/\___|\__, |_.__/ \___/ \__,_|_| \__,_\_| |_/\___/ \___/|_|\_\
__/ |
|___/
A lightweight wrapper for SetWindowsHookEx for making simple keyboard hooks
(but you can use it for whatever - see license.txt)
Nuget
Install-Package FMUtils.KeyboardHook
State of the Code
- Mostly operational
Hook.csis where the action is, but it's in a project for simpler separation and distribution
Usage
var KeyboardHook = new Hook("Global Action Hook");
KeyboardHook.KeyDownEvent += KeyDown;
// Also: KeyboardHook.KeyUpEvent += KeyUp;
private void KeyDown(KeyboardHookEventArgs e)
{
// handle keydown event here
// Such as by checking if e (KeyboardHookEventArgs) matches the key you're interested in
if (e.Key == Keys.F12 && e.isCtrlPressed)
{
// Do your magic...
}
}
KeyboardHookEventArgs is a helper class consisting of a Key core property, as well as breakout properties for left/right Ctrl/Alt/Win/Shift modifier keys.
See ProSnap for an example of how I built an end-user application out of it.
Related Skills
node-connect
337.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
337.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.2kCommit, push, and open a PR
