From a5dde31e1341de42c328de537041eddd79995ff5 Mon Sep 17 00:00:00 2001 From: data-niklas Date: Wed, 27 Apr 2022 11:17:51 +0200 Subject: [PATCH] all: adds more special keys (#14) --- hotkey_darwin.go | 31 +++++++++++++++++++++++++++++++ hotkey_linux.go | 33 ++++++++++++++++++++++++++++++++- hotkey_windows.go | 33 ++++++++++++++++++++++++++++++++- 3 files changed, 95 insertions(+), 2 deletions(-) diff --git a/hotkey_darwin.go b/hotkey_darwin.go index e2b3b2c..25a90b6 100644 --- a/hotkey_darwin.go +++ b/hotkey_darwin.go @@ -142,4 +142,35 @@ const ( KeyX Key = 7 KeyY Key = 16 KeyZ Key = 6 + + KeyReturn Key = 0x24 + KeyEscape Key = 0x35 + KeyDelete Key = 0x33 + KeyTab Key = 0x30 + + KeyLeft Key = 0x7B + KeyRight Key = 0x7C + KeyUp Key = 0x7E + KeyDown Key = 0x7D + + KeyF1 Key = 0x7A + KeyF2 Key = 0x78 + KeyF3 Key = 0x63 + KeyF4 Key = 0x76 + KeyF5 Key = 0x60 + KeyF6 Key = 0x61 + KeyF7 Key = 0x62 + KeyF8 Key = 0x64 + KeyF9 Key = 0x65 + KeyF10 Key = 0x6D + KeyF11 Key = 0x67 + KeyF12 Key = 0x6F + KeyF13 Key = 0x69 + KeyF14 Key = 0x6B + KeyF15 Key = 0x71 + KeyF16 Key = 0x6A + KeyF17 Key = 0x40 + KeyF18 Key = 0x4F + KeyF19 Key = 0x50 + KeyF20 Key = 0x5A ) diff --git a/hotkey_linux.go b/hotkey_linux.go index a31caa7..f3be4fa 100644 --- a/hotkey_linux.go +++ b/hotkey_linux.go @@ -135,7 +135,7 @@ const ( // Key represents a key. // See /usr/include/X11/keysymdef.h -type Key uint8 +type Key uint16 // All kinds of keys const ( @@ -176,4 +176,35 @@ const ( KeyX Key = 0x0078 KeyY Key = 0x0079 KeyZ Key = 0x007a + + KeyReturn Key = 0xff0d + KeyEscape Key = 0xff1b + KeyDelete Key = 0xffff + KeyTab Key = 0xff1b + + KeyLeft Key = 0xff51 + KeyRight Key = 0xff53 + KeyUp Key = 0xff52 + KeyDown Key = 0xff54 + + KeyF1 Key = 0xffbe + KeyF2 Key = 0xffbf + KeyF3 Key = 0xffc0 + KeyF4 Key = 0xffc1 + KeyF5 Key = 0xffc2 + KeyF6 Key = 0xffc3 + KeyF7 Key = 0xffc4 + KeyF8 Key = 0xffc5 + KeyF9 Key = 0xffc6 + KeyF10 Key = 0xffc7 + KeyF11 Key = 0xffc8 + KeyF12 Key = 0xffc9 + KeyF13 Key = 0xffca + KeyF14 Key = 0xffcb + KeyF15 Key = 0xffcc + KeyF16 Key = 0xffcd + KeyF17 Key = 0xffce + KeyF18 Key = 0xffcf + KeyF19 Key = 0xffd0 + KeyF20 Key = 0xffd1 ) diff --git a/hotkey_windows.go b/hotkey_windows.go index 232a530..bbc0e2a 100644 --- a/hotkey_windows.go +++ b/hotkey_windows.go @@ -151,7 +151,7 @@ const ( // Key represents a key. // https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes -type Key uint8 +type Key uint16 // All kinds of Keys const ( @@ -192,4 +192,35 @@ const ( KeyX Key = 0x58 KeyY Key = 0x59 KeyZ Key = 0x5A + + KeyReturn Key = 0x0D + KeyEscape Key = 0x1B + KeyDelete Key = 0x2E + KeyTab Key = 0x09 + + KeyLeft Key = 0x25 + KeyRight Key = 0x27 + KeyUp Key = 0x26 + KeyDown Key = 0x28 + + KeyF1 Key = 0x70 + KeyF2 Key = 0x71 + KeyF3 Key = 0x72 + KeyF4 Key = 0x73 + KeyF5 Key = 0x74 + KeyF6 Key = 0x75 + KeyF7 Key = 0x76 + KeyF8 Key = 0x77 + KeyF9 Key = 0x78 + KeyF10 Key = 0x79 + KeyF11 Key = 0x7A + KeyF12 Key = 0x7B + KeyF13 Key = 0x7C + KeyF14 Key = 0x7D + KeyF15 Key = 0x7E + KeyF16 Key = 0x7F + KeyF17 Key = 0x80 + KeyF18 Key = 0x81 + KeyF19 Key = 0x82 + KeyF20 Key = 0x83 )