{"id":19493586,"url":"https://github.com/fwextensions/powertoys-keys","last_synced_at":"2026-03-10T15:02:26.959Z","repository":{"id":57747360,"uuid":"521798139","full_name":"fwextensions/powertoys-keys","owner":"fwextensions","description":"A tool for setting shortcuts in PowerToys Keyboard Manager.","archived":false,"fork":false,"pushed_at":"2022-08-09T02:17:38.000Z","size":32,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-19T06:52:12.823Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/fwextensions.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}},"created_at":"2022-08-05T23:14:53.000Z","updated_at":"2025-10-15T09:32:26.000Z","dependencies_parsed_at":"2022-09-06T02:11:46.413Z","dependency_job_id":null,"html_url":"https://github.com/fwextensions/powertoys-keys","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fwextensions/powertoys-keys","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fwextensions%2Fpowertoys-keys","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fwextensions%2Fpowertoys-keys/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fwextensions%2Fpowertoys-keys/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fwextensions%2Fpowertoys-keys/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fwextensions","download_url":"https://codeload.github.com/fwextensions/powertoys-keys/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fwextensions%2Fpowertoys-keys/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30338579,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T14:50:13.961Z","status":"ssl_error","status_checked_at":"2026-03-10T14:49:32.490Z","response_time":106,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-11-10T21:26:39.566Z","updated_at":"2026-03-10T15:02:26.935Z","avatar_url":"https://github.com/fwextensions.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# powertoys-keys\n\n`powertoys-keys` is a simple command line script takes the JSON settings file from the PowerToys [Keyboard Manager](https://docs.microsoft.com/en-us/windows/powertoys/keyboard-manager) utility and converts it to a more usable [YAML](https://yaml.org/) format.  This makes it easier to bulk-edit the list of shortcuts.  It also supports mapping a **single** shortcut to **multiple** apps, without having to recreate that shortcut over and over.\n\n\n## Usage\n\n`powertoys-keys` requires [Node.js](https://nodejs.org/en/download/) to be installed on your computer.  \n\nOpen a Windows Terminal in a directory where you want to store your editable keyboard shortcuts file.  Then run:\n\n```shell\nnpx powertoys-keys export\n```\n\nAfter you confirm the temporary installation of the script, this will create a `Keyboard Manager Shortcuts.yaml` file in the local directory.  Open this file in your preferred text editor.  The contents will look something like the following (though the list of shortcuts and apps will obviously depend on your existing settings):\n\n```yaml\nversion: 0\nkeys:\n  inProcess:\n    - from: F1\n      to: F2\nshortcuts:\n  global:\n    - from: LWin D\n      to: \u003cDisable\u003e\n      ...\n  \"chrome, firefox, msedge\":\n    - from: LCtrl LAlt I\n      to: Up\n    - from: LCtrl LAlt K\n      to: Down\n      ...\n  notepad:\n    - from: LAlt S\n      to: LCtrl S\n      ...\n```\n\n\n### App lists\n\nThe shortcut mappings are grouped by the applications they apply to, under the `shortcuts:` section.  Each list of app-specific mappings starts with the app's process name, followed by a colon, like `notepad:` in the example above.  Mappings in the `global:` list apply to all apps.\n\n#### Multi-app shortcuts\n\nBesides specifying a single app, the app list can be a quoted, comma-delimited list of multiple app names.  In this example, all of the shortcuts in the `\"chrome, firefox, msedge\":` list apply to Chrome, Firefox and Microsoft Edge:  \n\n```yaml\n  \"chrome, firefox, msedge\":\n    - from: LCtrl LAlt I\n      to: Up\n    - from: LCtrl LAlt K\n      to: Down\n```\n\nThis makes it easy to share a set of shortcuts across many apps, without having to manually recreate them for each app in the *Keyboard Manager* UI.  \n\nEach list name has to be unique, but the same app can appear in multiple lists.  For instance, you could have Chrome-specific shortcuts in a `chrome:` list, in addition to the `\"chrome, firefox, msedge\":` list.\n\n```yaml\n  \"chrome, firefox, msedge\":\n    - from: LCtrl LAlt I\n      to: Up\n    - from: LCtrl LAlt K\n      to: Down\n  chrome:\n    - from: LWin B\n      to: LCtrl LShift O\n```\n\nNote that when the YAML file is imported into *Keyboard Manager*, all of the shortcuts in a multi-app list are duplicated, once for each app, since *PowerToys* doesn't natively support this feature.  This means that if you have 20 shortcuts in a list for 10 apps, **200** individual shortcuts will be shown in *Keyboard Manager* UI.  So don't go too crazy with lots of shared shortcuts!\n\n\n### Shortcut mappings\n\nEach mapping is defined using an object with `from` and `to` fields.  For instance, in the `notepad:` list above, the shortcut \u003ckbd\u003eAlt (Left)\u003c/kbd\u003e\u003ckbd\u003eS\u003c/kbd\u003e is mapped to \u003ckbd\u003eCtrl (Left)\u003c/kbd\u003e\u003ckbd\u003eS\u003c/kbd\u003e.  Pressing the `from` shortcut triggers the `to` shortcut in the app.  (The `-` before each `from` indicates that the `from/to` object is part of a list.)\n\nEach shortcut is defined by one or more keys, separated by spaces.  The raw key codes used in the *Keyboard Manager* JSON file are mapped to human-readable key names in the YAML file.  [See the full list ](src/key-codes.js) for the available key names.  \n\nModifiers, like \u003ckbd\u003ealt\u003c/kbd\u003e or \u003ckbd\u003ectrl\u003c/kbd\u003e, have names that specify the left modifier key (`LAlt`), the right (`RAlt`) or either (`Alt`).  Key names are currently case-sensitive, so they must be typed exactly as shown in the [list](src/key-codes.js).\n\nShortcuts that are meant to be disabled can be mapped to a \"key\" named `\u003cDisable\u003e`.  That will prevent the shortcut from working in the associated app. \n\n\n### Applying the new shortcuts\n\nOnce you have created the desired list of shortcuts, you must import them into *Keyboard Manager* by running:\n\n```shell\nnpx powertoys-keys import\n```\n\nThis converts your YAML file back into the required JSON format, substituting codes for the key names and expanding multi-app shortcuts into individual entries.  \n\nUnfortunately, this won't automatically apply the new settings.  To do that you must open *PowerToys*, then click *Keyboard Manager* in the left column, and then click the *Remap a shortcut* button.  After the *Remap shortcuts* dialog opens, click *OK* to apply the new shortcuts. \n\nNote that the new JSON file completely replaces the existing settings, which means that if you remove a shortcut in the YAML file, it will also be deleted from *Keyboard Manager* once you run the `import` command.  However, the script backs up the current JSON file as `default-backup.json` in the *Keyboard Manager* settings directory (usually `%LocalAppData%\\Microsoft\\PowerToys\\Keyboard Manager`).  It also creates a `default-original.json` backup the first time it runs, so you can get back to the settings you started with, if necessary.\n\n\n### International keyboards\n\nThis script hasn't been tested at all with international keyboards, so YMMV.\n\n\n## Command line options\n\n### `--settings-dir`\n\nThe script will look for the settings in the default directory for *Keyboard Manager*.  If you've installed *PowerToys* somewhere else, you can specify a path to a different directory with the `--settings-dir` flag:\n\n```shell\nnpx powertoys-keys export --settings-dir=\"C:\\path\\to\\PowerToy\\Keyboard Manager\"\n```\n\n\n### `--yaml-file`\n\nTo specify a different name for the YAML file, use the `--yaml-file` flag:\n\n```shell\nnpx powertoys-keys export --yaml-file=\"My Shortcuts.yaml\"\n```\n\nYou'll need to specify the same flag when running the `import` command so that the script knows which file to import.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffwextensions%2Fpowertoys-keys","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffwextensions%2Fpowertoys-keys","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffwextensions%2Fpowertoys-keys/lists"}