{"id":13583552,"url":"https://github.com/arbal/brave-control","last_synced_at":"2025-04-06T21:32:22.555Z","repository":{"id":41550347,"uuid":"336392273","full_name":"arbal/brave-control","owner":"arbal","description":"Control Brave Browser from the command line. List, close, deduplicate and bring focus to open tabs. Also includes Alfred workflow integration.","archived":false,"fork":true,"pushed_at":"2021-02-06T04:49:49.000Z","size":1644,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-06T00:39:18.055Z","etag":null,"topics":["alfred","alfred-workflow","automation","brave","brave-browser","browser","cli","command-line","command-line-tool","deduplication","focus","jxa","tabs","workflow"],"latest_commit_sha":null,"homepage":"https://github.com/arbal/brave-control","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"d4rkb1ue/chrome-control","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arbal.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":"2021-02-05T21:23:05.000Z","updated_at":"2023-09-08T18:18:13.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/arbal/brave-control","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arbal%2Fbrave-control","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arbal%2Fbrave-control/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arbal%2Fbrave-control/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arbal%2Fbrave-control/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arbal","download_url":"https://codeload.github.com/arbal/brave-control/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247555871,"owners_count":20957851,"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","automation","brave","brave-browser","browser","cli","command-line","command-line-tool","deduplication","focus","jxa","tabs","workflow"],"created_at":"2024-08-01T15:03:34.955Z","updated_at":"2025-04-06T21:32:22.244Z","avatar_url":"https://github.com/arbal.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# About This Fork\n\nForked from [d4rkb1ue/chrome-control](https://github.com/d4rkb1ue/chrome-control) to make an equivalent command line utility for [Brave Browser](https://github.com/brave/brave-browser). Predicably, it is named [brave-control](https://github.com/arbal/brave-control) and the script is named [brave.js](https://github.com/arbal/brave-control/blob/master/brave.js).\n\n### Commands used for curious readers:\n\n1. Modify code \u0026 comments. Commit.\n\n```sh\nperl -pi -e 's/chrome([^\\w-])/brave$1/g' ./chrome.js\nperl -pi -e 's/Google Chrome/Brave Browser/g' ./chrome.js\nperl -pi -e 's/Chrome/Brave/g' ./chrome.js\n\ngit add ./chrome.js \u0026\u0026 git commit -m 'Modified chrome.js to use Brave Browser' \u0026\u0026 git push\n```\n\n#### **NOTE: In order to preserve history, it is important to commit any file rename operations separately from any file content changes.**\n\n2. Use [git-mv](https://git-scm.com/docs/git-mv) to rename script. Commit.\n\n```sh\ngit mv -v ./chrome.js ./brave.js\ngit commit -m 'Renamed chrome.js to brave.js' \u0026\u0026 git push\n```\n\n3. Use [hub](https://hub.github.com/) to rename this repo. Described in [github/hub#390](https://github.com/github/hub/issues/390#issuecomment-457858483).\n\n```sh\nhub api -XPATCH repos/arbal/chrome-control -f name=brave-control\ngit remote set-url origin https://github.com/arbal/brave-control.git\n```\n\n#### Notes from earlier [d4rkb1ue/archrome-control](https://github.com/d4rkb1ue/chrome-control) fork:\n\n\u003e Forked from [bit2pixel/chrome-control](https://github.com/bit2pixel/chrome-control) because the original repo isn't seem to be active any more, with these changes,\n\n\u003e 1. Apply performace patch from [bit2pixel/chrome-control/pull/7](https://github.com/bit2pixel/chrome-control/pull/7/)\n\u003e 2. Disable prompt for \"Are you sure\" for duplication removal\n\u003e 3. Search keyword in both title and url\n\u003e     - for example `[Hello World](https://exampledomain.com/hw)` can he searched by either `hello`, `world`, `hw` or `exampledomain`.\n\u003e 4. New feature to search for bookmarks. Command is `b`\n\u003e 5. Change command for Tabs searching to `t`\n\n\n## How To Install\n\n```sh\ngit clone https://github.com/arbal/brave-control.git\n./install.sh\n```\n\nOr just download and double click,\n- [Brave Control.alfredworkflow](https://github.com/arbal/brave-control/raw/master/integrations/Alfred/Brave%20Control.alfredworkflow)\n\n\n\nBrave Control\n==============\n\n![Brave Control](img/banner.png)\n\nA JXA script and an Alfred Workflow for controlling Brave Browser\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 ./brave.js\n```\n\nThen run:\n```sh\n./brave.js\n```\n\n\n\u003e MacOS will ask you to allow permissions for this tool to control Brave.\n\u003e Feel free to inspect the code before accepting.\n\nIntegration\n-----------\n\nYou can use `brave-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 Brave Control.\nYou can find it under the intergrations directory.\n\nAlfred Brave 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./brave.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./brave.js close --title \"inbox\" \"iphone - apple\"\n```\n\n```sh\n./brave.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./brave.js close --url \"mail.google\" \"apple\"\n```\n\n```sh\n./brave.js close --url google apple\n```\n\n### List all open tabs in all Brave windows\n\n```sh\n./brave.js list\n```\n\nThe output is `JSON`, so you can pipe it to `jq`.\n```sh\n./brave.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./brave.js close 0,13\n```\n\n\n### Focus on a specific tab in a specific window\n\n```js\n./brave.js focus 0,13\n```\n\n### Show help\n\n```sh\n./brave.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 Brave\n\n`--ui` flag will cause the questions to be asked using a Brave dialog instead of text in command line.\n\n```sh\n./brave.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%2Farbal%2Fbrave-control","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farbal%2Fbrave-control","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farbal%2Fbrave-control/lists"}