{"id":15680307,"url":"https://github.com/denyncrawford/deno-gkm","last_synced_at":"2025-05-12T19:14:34.864Z","repository":{"id":49381595,"uuid":"377590618","full_name":"denyncrawford/deno-gkm","owner":"denyncrawford","description":"Async based, Global Keyboard and Mouse listener (GKM) driver for Deno.","archived":false,"fork":false,"pushed_at":"2021-06-19T16:41:52.000Z","size":573,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-12T19:14:28.707Z","etag":null,"topics":["deno","events","global","keyboard","keyboard-events","mouse","mouse-events","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/denyncrawford.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-16T18:23:26.000Z","updated_at":"2023-05-25T08:11:17.000Z","dependencies_parsed_at":"2022-08-25T06:10:33.405Z","dependency_job_id":null,"html_url":"https://github.com/denyncrawford/deno-gkm","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denyncrawford%2Fdeno-gkm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denyncrawford%2Fdeno-gkm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denyncrawford%2Fdeno-gkm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denyncrawford%2Fdeno-gkm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/denyncrawford","download_url":"https://codeload.github.com/denyncrawford/deno-gkm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253805844,"owners_count":21967054,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deno","events","global","keyboard","keyboard-events","mouse","mouse-events","typescript"],"created_at":"2024-10-03T16:41:24.974Z","updated_at":"2025-05-12T19:14:34.839Z","avatar_url":"https://github.com/denyncrawford.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deno GKM\nAsync based, Global Keyboard and Mouse listener (GKM) for Deno.\n\n\u003e We're planing to implement GKM as an event trigger in the future, so it can be used for automation.\n\nBuilt on Windows, there's no Linux binaries available at the moment.\n\n## Why?\n\nDeno do not have any global keyboard and mouse listener available.\n\n## Requirements\n\nDeno GKM doesn't depends on Java anymore but it still requires the executable binary **Rusty GKM** which is a rust native plugin for listening (and emitting in the future) system events.\n\nIt automatically installs the binary in the `%APPDATA%/gkm` | `%HOME%/gmk` folder, you will find `gkm.exe`, which source you can find at https://github.com/denyncrawford/rusty-gkm.\n\n## Getting started\n\n**Import gkm**:\n\n```JavaScript\nimport gkm from 'https://raw.githubusercontent.com/denyncrawford/deno-gkm/master/mod.ts'\n```\n\n**Then use it as async iterator**:\n\n```javascript\nimport gkm from './mod.ts'\n\nfor await (const line of gkm()) {\n    const { event, data } = line;\n\tconsole.log(`${event}: ${data}`)\n}\n```\n\n**The event string format is**: `[device].[event_type]` so you can listen only the events you want using ***wildcards***:\n\n**This will yield only mouse events**:\n\n```javascript\nimport { wildcard } from './mod.ts'\nfor await (const line of wildcard('mouse.*')) {\n    const { event, data } = line;\n\tconsole.log(`${event}: ${data}`)\n}\n```\n\n**This will yield only keyboard events**: \n\n```javascript\n...const line of wildcard('key.*')...\n```\n\n## Accessing event names, data values and literals\n\nSince the event names are designed to be level accessible (trough wildcards), they follow the `[device].[event_action]?.[action_complement]`. \n\n**Available event names**:\n\n```bash\nmouse.move\nmouse.wheel\nmouse.button.press\nmouse.button.release\nkey.press\nkey.release\n```\n\n**Available data value formats**:\n\n- Mouse Move and Wheel: Data object with coordinates or deltas.\n- Mouse Button and keys: Key or button string.\n\n**Literals**:\n\nLiterals are values of key press or wheel modifications, so you can detect character case state or keybinding codes. If the event doesn't haver or support literals it will be `None`.\n\n## Building the binary\n\n**Install bundler**:\n\n```bash\ndeno install -f --allow-read --allow-write -n bundler https://raw.githubusercontent.com/trgwii/bundler/master/bundler.ts\n```\n\n**Run the bundler**:\n\n```bash\nbundler ts-bundle lib gkm.b.ts\n```\n\n## License\nThe code is licensed under the MIT license (http://opensource.org/licenses/MIT). See license.txt.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenyncrawford%2Fdeno-gkm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdenyncrawford%2Fdeno-gkm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenyncrawford%2Fdeno-gkm/lists"}