Global Hotkey Watcher for Reflex
Project description
Reflex Global Hotkey Watcher
Listens to hotkeys in the global scope and calls event handler as necessary.
from reflex_global_hotkey import global_hoykey_watcher
class State(rx.State):
last_key_pressed: str = ""
def on_key(self, keyname: str):
self.last_key_pressed = keyname
def index():
return rx.fragment(
State.last_key_pressed,
global_hoykey_watcher(
on_key_down=State.on_key
)
)
You can special case on the event key:
global_hoykey_watcher(
on_key_down=lambda key_name: rx.cond(
rx.Var.create(
["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"]
).contains(key_name),
State.on_key(key_name),
rx.console_log("Invalid key!"),
)
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file reflex_global_hotkey-1.0.0.tar.gz
.
File metadata
- Download URL: reflex_global_hotkey-1.0.0.tar.gz
- Upload date:
- Size: 1.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.12.6 Linux/6.10.9-amd64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c77713ba1cf85d071761e5e8e676d9c64bf9cef823de1bf8a7a81d2fe1d9d879 |
|
MD5 | 150d6730b3c27f69ac78987391b907f7 |
|
BLAKE2b-256 | e32645248e12d179d4f4733f402b95fca786dd6358c9e0170eb573dd3aa4c366 |
File details
Details for the file reflex_global_hotkey-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: reflex_global_hotkey-1.0.0-py3-none-any.whl
- Upload date:
- Size: 2.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.12.6 Linux/6.10.9-amd64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7acaa1bdd75a1387fdab52a05d88b6c174eac0251bd3b4568e7d416790d3bdf |
|
MD5 | 4099b6ba803ed84bed66d0028abdaa57 |
|
BLAKE2b-256 | a866c1bd1283bf4b987d725f9fc164454ee822567f2e78c8a015b54aa34564ba |