{"id":13433977,"url":"https://github.com/bit2pixel/chrome-control","last_synced_at":"2026-01-21T20:43:44.028Z","repository":{"id":53984904,"uuid":"186236981","full_name":"bit2pixel/chrome-control","owner":"bit2pixel","description":"A JXA script and an Alfred Workflow for controlling Google Chrome","archived":false,"fork":false,"pushed_at":"2025-02-20T13:47:07.000Z","size":1593,"stargazers_count":193,"open_issues_count":9,"forks_count":25,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-08T23:04:37.657Z","etag":null,"topics":["alfred","alfred-workflow","chrome","javascript","jxa"],"latest_commit_sha":null,"homepage":"https://medium.com/@bit2pixel/how-i-navigate-hundreds-of-tabs-on-chrome-with-jxa-and-alfred-9bbf971af02b","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/bit2pixel.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":"2019-05-12T09:48:06.000Z","updated_at":"2025-02-20T13:47:10.000Z","dependencies_parsed_at":"2022-08-13T05:40:52.453Z","dependency_job_id":null,"html_url":"https://github.com/bit2pixel/chrome-control","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/bit2pixel%2Fchrome-control","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bit2pixel%2Fchrome-control/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bit2pixel%2Fchrome-control/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bit2pixel%2Fchrome-control/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bit2pixel","download_url":"https://codeload.github.com/bit2pixel/chrome-control/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244049924,"owners_count":20389603,"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":["alfred","alfred-workflow","chrome","javascript","jxa"],"created_at":"2024-07-31T02:01:41.848Z","updated_at":"2026-01-21T20:43:44.018Z","avatar_url":"https://github.com/bit2pixel.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"Chrome Control\n==============\n\n![Chrome Control](img/banner.png)\n\nA JXA script and an Alfred Workflow for controlling Google Chrome\n(Javascript for Automation). Also see my [How I Navigate Hundreds of Tabs on Chrome with JXA and Alfred](https://medium.com/@bit2pixel/how-i-navigate-hundreds-of-tabs-on-chrome-with-jxa-and-alfred-9bbf971af02b) article if you're interested in learning how I created the workflow.\n\nUsage\n-----\n\nMake this file an executable\n```sh\nchmod +x ./chrome.js\n```\n\nThen run: \n```sh\n./chrome.js\n```\n\n\n\u003e MacOS will ask you to allow permissions for this tool to control Chrome.  \n\u003e Feel free to inspect the code before accepting.\n\nIntegration\n-----------\n\nYou can use `chrome-control` to create fun integrations with your favorite tools (Alfred, vim, vscode, iterm2, ...).\n\n### Alfred\n\nI've created an Alfred Workflow to use Chrome Control.\nYou can find it under the intergrations directory.\n\nAlfred Chrome Control commands:\n  - `tabs`: Lists all tabs\n  - `close url \u003ckeywords\u003e`: Close tabs with URLs matching these keywords\n  - `close title \u003ckeywords\u003e`: Close tabs with titles matching these keywords\n  - `dedup`: Close duplicate tabs\n\n![Alfred](img/tabs.gif)\n\n\nCommands\n--------\n\n### Close duplicate tabs\n\n```sh\n./chrome.js dedup\n```\n\n\n### Close all tabs by `titles` containing strings \n\u003e Strings are separated by spaces and `case insensitive`.\n\n```sh\n./chrome.js close --title \"inbox\" \"iphone - apple\"\n```\n\n```sh\n./chrome.js close --title inbox iphone\n```\n\n### Close all tabs by `URLs` containing strings\n\u003e Strings are separated by spaces and `case insensitive`.\n\n```sh\n./chrome.js close --url \"mail.google\" \"apple\"\n```\n\n```sh\n./chrome.js close --url google apple\n```\n\n### List all open tabs in all Chrome windows\n\n```sh\n./chrome.js list\n```\n\nThe output is `JSON`, so you can pipe it to `jq`.\n```sh\n./chrome.js list | jq .\n```\n\nReturns a struct like this:\n\n```json\n{\n  \"items\": [\n    {\n      \"title\": \"Inbox (1) - \u003chidden\u003e@gmail.com - Gmail\",\n      \"url\": \"https://mail.google.com/mail/u/0/#inbox\",\n      \"winIdx\": 0,\n      \"tabIdx\": 0,\n      \"arg\": \"0,0\",\n      \"subtitle\": \"https://mail.google.com/mail/u/0/#inbox\"\n    },\n    {\n      \"title\": \"iPhone - Apple\",\n      \"url\": \"https://www.apple.com/iphone/\",\n      \"winIdx\": 0,\n      \"tabIdx\": 1,\n      \"arg\": \"0,1\",\n      \"subtitle\": \"https://www.apple.com/iphone/\"\n    }\n  ]\n}\n```\n\n\u003e `arg` and `subtitle` are used for [Alfred](https://www.alfredapp.com/) integration.\n\n### Close a specific tab in a specific window\n\n\u003e `Window Index` and `Tab Index` is the `arg` returned by the `list` command.\n\n```js\n./chrome.js close 0,13\n```\n\n\n### Focus on a specific tab in a specific window\n\n```js\n./chrome.js focus 0,13\n```\n\n### Show help\n\n```sh\n./chrome.js \n```\n\n### Don't prompt the user\n\n`--yes` flag will cause no questions to be asked to the user. It'll close all tabs straight away.\n\n\u003e Attention: Use this with caution. Make sure you don't have any unsaved work, emails, ... etc.\n\n### Prompt user in Chrome\n\n`--ui` flag will cause the questions to be asked using a Chrome dialog instead of text in command line.\n\n```sh\n./chrome.js close --url apple --ui\n```\n\n![Dialog](img/ui.png)\n\n## How did you create the banner and icon?\n\nIt took around 4 hours using Photoshop. I wanted to use Illustrator but I realized that I completely forgot how to use it.\n\nDrawing the shapes are pretty easy but I spent most of the time on the following:\n- Picking harmonious colors.\n- Figuring out how to make it less dull, ended up using a shadow under the window which made a significant difference.\n- Figuring out how to represent the infrared waves.\n- Finding a way to export the PNG to ICNS.\n\nPlanning to write an article on that soon.\n\n## Bug Fixes \u0026 Pull Requests\n\nIf you find any bugs please feel to create an issue or create a pull request.\n\n\u003e I can only accept pull requests to the source code and not the binary files for ensuring the repo stays sanitized. If you have any feature requests for the workflow, I'd be happy to add them in after a discussion.\n\n\n## License\n\nCopyright (c) 2019 Renan Cakirerk\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbit2pixel%2Fchrome-control","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbit2pixel%2Fchrome-control","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbit2pixel%2Fchrome-control/lists"}