All Projects → golang-design → hotkey

golang-design / hotkey

Licence: MIT license
⌨️ cross-platform hotkey package

Programming Languages

go
31211 projects - #10 most used programming language
objective c
16641 projects - #2 most used programming language
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to hotkey

Hotkeys
➷ A robust Javascript library for capturing keyboard input. It has no dependencies.
Stars: ✭ 5,165 (+6198.78%)
Mutual labels:  keyboard, hotkeys, shortcut, hotkey, shortcuts
keybind
ClojureScript key bindings (shortcut) library
Stars: ✭ 85 (+3.66%)
Mutual labels:  hotkeys, shortcut, hotkey, shortcuts
Keymage
Yet Another JS Keybinding library
Stars: ✭ 325 (+296.34%)
Mutual labels:  hotkeys, shortcut, hotkey, shortcuts
react-shortcut
Convenient React component that detects if the given key combination is pressed, and triggers a callback
Stars: ✭ 16 (-80.49%)
Mutual labels:  hotkeys, shortcut, hotkey, shortcuts
Capslock Plus
An efficiency tool that provides various functions by enhancing the Caps Lock key into a modifier key.
Stars: ✭ 650 (+692.68%)
Mutual labels:  keyboard, shortcut, hotkey
Xcactionbar
"Alfred for Xcode" plugin
Stars: ✭ 1,217 (+1384.15%)
Mutual labels:  shortcut, hotkey, shortcuts
react-hotkey-tooltip
A global Hotkey provider with built in tooltip for React
Stars: ✭ 34 (-58.54%)
Mutual labels:  hotkeys, shortcut, hotkey
hotscript
HotScript - Revolutionizing how Windows works.
Stars: ✭ 29 (-64.63%)
Mutual labels:  keyboard, shortcut, hotkey
g910-gkey-macro-support
GKey support for Logitech G910 Keyboard on Linux
Stars: ✭ 85 (+3.66%)
Mutual labels:  keyboard, hotkeys, shortcut
react-keyboard-shortcuts
A declarative library for handling hotkeys based on explicit priority in React applications
Stars: ✭ 23 (-71.95%)
Mutual labels:  keyboard, hotkeys, shortcuts
React Hotkeys
React component to listen to keydown and keyup keyboard events, defining and dispatching keyboard shortcuts.
Stars: ✭ 279 (+240.24%)
Mutual labels:  keyboard, hotkeys, shortcut
Shortcutmapper
A visual keyboard shortcuts explorer for popular applications.
Stars: ✭ 657 (+701.22%)
Mutual labels:  keyboard, shortcuts
Repeat
Cross-platform mouse/keyboard record/replay and automation hotkeys/macros creation, and more advanced automation features.
Stars: ✭ 763 (+830.49%)
Mutual labels:  keyboard, hotkey
Hotkey
Simple global shortcuts in macOS
Stars: ✭ 574 (+600%)
Mutual labels:  keyboard, shortcut
Globalhooks
Allows you to create global keyboard events
Stars: ✭ 74 (-9.76%)
Mutual labels:  keyboard, shortcut
Slowquitapps
Add a global delay to Command-Q to stop accidental app quits.
Stars: ✭ 916 (+1017.07%)
Mutual labels:  keyboard, shortcut
Ng Keyboard Shortcuts
Dead Simple Keyboard Shortcuts Management for Angular
Stars: ✭ 121 (+47.56%)
Mutual labels:  keyboard, shortcut
Pyhooked
Pure Python hotkey hook, with thanks to pyHook and pyhk
Stars: ✭ 150 (+82.93%)
Mutual labels:  keyboard, hotkeys
Is Hotkey
Check whether a browser event matches a hotkey.
Stars: ✭ 211 (+157.32%)
Mutual labels:  keyboard, hotkeys
Selectnextoccurrence
A Visual Studio Extension that selects the next occurrences of the current selection and adds multiple cursors for editing
Stars: ✭ 129 (+57.32%)
Mutual labels:  keyboard, shortcut

hotkey PkgGoDev hotkey

cross platform hotkey package in Go

import "golang.design/x/hotkey"

Features

  • Cross platform supports: macOS, Linux (X11), and Windows
  • Global hotkey registration without focus on a window

API Usage

Package hotkey provides the basic facility to register a system-level global hotkey shortcut so that an application can be notified if a user triggers the desired hotkey. A hotkey must be a combination of modifiers and a single key.

func main() { mainthread.Init(fn) } // not necessary when use in Fyne, Ebiten or Gio.
func fn() {
    hk := hotkey.New([]hotkey.Modifier{hotkey.ModCtrl, hotkey.ModShift}, hotkey.KeyS)
    err := hk.Register()
    if err != nil {
        return
    }
    fmt.Printf("hotkey: %v is registered\n", hk)
    <-hk.Keydown()
    fmt.Printf("hotkey: %v is down\n", hk)
    <-hk.Keyup()
    fmt.Printf("hotkey: %v is up\n", hk)
    hk.Unregister()
    fmt.Printf("hotkey: %v is unregistered\n", hk)
}

Note platform specific details:

  • On macOS, due to the OS restriction (other platforms does not have this restriction), hotkey events must be handled on the "main thread". Therefore, in order to use this package properly, one must start an OS main event loop on the main thread, For self-contained applications, using golang.design/x/hotkey/mainthread is possible. For applications based on other GUI frameworks, such as fyne, ebiten, or Gio. This is not necessary. See the "./examples" folder for more examples.
  • On Linux (X11), when AutoRepeat is enabled in the X server, the Keyup is triggered automatically and continuously as Keydown continues.
  • If this package did not include a desired key, one can always provide the keycode to the API. For example, if a key code is 0x15, then the corresponding key is hotkey.Key(0x15).

Examples

Description Folder
A minimum example minimum
Register multiple hotkeys multiple
A example to use in GLFW glfw
A example to use in Fyne fyne
A example to use in Ebiten ebiten
A example to use in Gio gio

Who is using this package?

The main purpose of building this package is to support the midgard project.

To know more projects, check our wiki page.

License

MIT | © 2021 The golang.design Initiative Authors, written by Changkun Ou.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].