{"id":15684021,"url":"https://github.com/azu/motion-key","last_synced_at":"2025-05-07T15:06:44.391Z","repository":{"id":66143505,"uuid":"384900864","full_name":"azu/motion-key","owner":"azu","description":"A keyboard config app for your motion.","archived":false,"fork":false,"pushed_at":"2021-08-10T13:47:45.000Z","size":292,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-07T15:06:29.744Z","etag":null,"topics":["camera","electron","key","keybinding","keyboard","motion"],"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/azu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"azu"}},"created_at":"2021-07-11T08:54:12.000Z","updated_at":"2022-10-02T15:46:57.000Z","dependencies_parsed_at":"2023-02-22T01:15:19.367Z","dependency_job_id":null,"html_url":"https://github.com/azu/motion-key","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fmotion-key","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fmotion-key/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fmotion-key/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fmotion-key/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azu","download_url":"https://codeload.github.com/azu/motion-key/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252902614,"owners_count":21822261,"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":["camera","electron","key","keybinding","keyboard","motion"],"created_at":"2024-10-03T17:09:43.737Z","updated_at":"2025-05-07T15:06:44.373Z","avatar_url":"https://github.com/azu.png","language":"TypeScript","readme":"# motion-key\n\nA keyboard configuration for your motion.\n\n## Requirements\n\n- macOS\n    - Currently, [sendKeyStroke.ts](./src/main/sendKeyStroke.ts) is dependend on macOS\n    - Welcome to Pull Request for supporting another platform\n- web camera\n\n## Feature\n\n- Bind keystroke to your motion\n- Support gesture like 👍 ✌️\n- Configuration by JavaScript `~/.config/motion-key/motion-key.config.js`\n\n## Installation\n\n\u003e https://github.com/azu/motion-key/releases/latest\n\n1. Download a binary from [the latest releases](https://github.com/azu/motion-key/releases/latest)\n2. Install app\n\n:warning: This app is not signed. So, OS show warning about it.\n\nAdditional installation steps on macOS:\n\n1. Select `motion-key.app`\n2. Open context menu and Click \"Open\"\n\n:warning: require permission on macOS.\nOpen the app, and you need to add permission for `motion-key.app`\n\n- **Accessibility**\n  - use accessibility permission to get `activeWindow` object\n  - `activeWindow` includes active app info like bundle.id, url, title.\n- **Screen Recording**\n  - use Screen Recording permission to use web camera\n\n## Config\n\nYou can write config file in `~/.config/motion-key/motion-key.config.js`.\n\nConfig location:\n\n- `~/.config/motion-key/motion-key.config.js`\n\nYou can control reaction for pixel diffs:\n\n```js\nmodule.exports = ({ type, activeWindow, payload }) =\u003e {\n    if (type === \"PixelChangeAction\") {\n        // ignore diffs less than 5% of capture\n        if (payload.diffPercent \u003c 5) {\n            return;\n        }\n        return {\n            key: \"ArrowDown\"\n        };\n    } else if (type === \"GestureAction\") {\n        return {\n            key: \"ArrowUp\"\n        };\n    }\n}\n```\n\nYou can change the config for each application:\n\n```js\nconst muPdf = ({ type }) =\u003e {\n    if (type === \"PixelChangeAction\") {\n        return {\n            key: \"j\"\n        }\n    } else if (type === \"GestureAction\") {\n        return {\n            key: \"k\"\n        }\n    }\n};\n\nmodule.exports = ({ type, activeWindow, payload }) =\u003e {\n    const bundleId = activeWindow?.owner?.bundleId;\n    if (bundleId === 'info.efcl.mu-pdf-viewer') {\n        return muPdf({ type });\n    }\n    if (type === \"PixelChangeAction\") {\n        return {\n            key: \"ArrowDown\"\n        }\n    } else if (type === \"GestureAction\") {\n        return {\n            key: \"ArrowUp\"\n        }\n    }\n}\n```\n\nYou can set `key` for each Gesture:\n\n```js\nmodule.exports = ({ type, activeWindow, payload }) =\u003e {\n    if (type === \"PixelChangeAction\") {\n        return {\n            key: \"ArrowDown\"\n        }\n    } else if (type === \"GestureAction\") {\n        if (payload.type === \"👍\") {\n            return { key: \"ArrowUp\" }\n        }\n        if (payload.type === \"✌️\") {\n            return { key: \"ArrowRight\" }\n        }\n    }\n}\n```\n\nYou can set `nextActionIntervalMs` to throttle keys.\n\nmotion-key ignore actions until the passage of `nextActionIntervalMs`.\n\n```js\nmodule.exports = ({ type, activeWindow, payload }) =\u003e {\n    if (type === \"PixelChangeAction\") {\n        return {\n            key: \"ArrowDown\",\n            nextActionIntervalMs: 5 * 1000\n        }\n    } else if (type === \"GestureAction\") {\n        return {\n            key: \"ArrowUp\",\n            nextActionIntervalMs: 5 * 1000\n        }\n    }\n}\n```\n\nFor more details, see [Config.ts](src/main/Config.ts).\n\n### Recipe\n\nOnly work on Kindle.app\n\n```js\nconst kindle = ({ type, payload }) =\u003e {\n    if (type === \"PixelChangeAction\") {\n        // large motion to next page\n        if (payload.diffPercent \u003c 10) {\n            return;\n        }\n        return {\n            key: \"Space\"\n        }\n    } else if (type === \"GestureAction\") {\n        // 👍 next page\n        if (payload.type === \"👍\") {\n            return { key: \"Space\" }\n        }\n        // ✌️ prev page\n        if (payload.type === \"✌️\") {\n            return { key: \"Space\", modifier: { \"shift\": true } }\n        }\n    }\n};\n\nmodule.exports = ({ type, activeWindow, payload }) =\u003e {\n    const bundleId = activeWindow?.owner?.bundleId;\n    if (bundleId === \"com.amazon.Kindle\") {\n        return kindle({ type, payload })\n    }\n}\n```\n\n## Releases\n\n    npm version {patch,minor,major}\n    git push --tags\n\n## Contributing\n\n1. Fork it!\n2. Create your feature branch: `git checkout -b my-new-feature`\n3. Commit your changes: `git commit -am 'Add some feature'`\n4. Push to the branch: `git push origin my-new-feature`\n5. Submit a pull request :D\n\n## License\n\nMIT\n","funding_links":["https://github.com/sponsors/azu"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazu%2Fmotion-key","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazu%2Fmotion-key","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazu%2Fmotion-key/lists"}