Forked from bit2pixel/chrome-control because the original repo isn't seem to be active any more, with these changes,
- Apply performace patch from bit2pixel/chrome-control/pull/7
- Disable prompt for "Are you sure" for duplication removal
- Search keyword in both title and url
- for example
[Hello World](https://exampledomain.com/hw)
can he searched by eitherhello
,world
,hw
orexampledomain
.
- for example
- New feature to search for bookmarks. Command is
b
- Change command for Tabs searching to
t
git clone https://github.com/d4rkb1ue/chrome-control.git
./install.sh
Or just download and double click,
A JXA script and an Alfred Workflow for controlling Google Chrome (Javascript for Automation). Also see my How I Navigate Hundreds of Tabs on Chrome with JXA and Alfred article if you're interested in learning how I created the workflow.
Make this file an executable
chmod +x ./chrome.js
Then run:
./chrome.js
MacOS will ask you to allow permissions for this tool to control Chrome.
Feel free to inspect the code before accepting.
You can use chrome-control
to create fun integrations with your favorite tools (Alfred, vim, vscode, iterm2, ...).
I've created an Alfred Workflow to use Chrome Control. You can find it under the intergrations directory.
Alfred Chrome Control commands:
tabs
: Lists all tabsclose url <keywords>
: Close tabs with URLs matching these keywordsclose title <keywords>
: Close tabs with titles matching these keywordsdedup
: Close duplicate tabs
./chrome.js dedup
Strings are separated by spaces and
case insensitive
.
./chrome.js close --title "inbox" "iphone - apple"
./chrome.js close --title inbox iphone
Strings are separated by spaces and
case insensitive
.
./chrome.js close --url "mail.google" "apple"
./chrome.js close --url google apple
./chrome.js list
The output is JSON
, so you can pipe it to jq
.
./chrome.js list | jq .
Returns a struct like this:
{
"items": [
{
"title": "Inbox (1) - <hidden>@gmail.com - Gmail",
"url": "https://mail.google.com/mail/u/0/#inbox",
"winIdx": 0,
"tabIdx": 0,
"arg": "0,0",
"subtitle": "https://mail.google.com/mail/u/0/#inbox"
},
{
"title": "iPhone - Apple",
"url": "https://www.apple.com/iphone/",
"winIdx": 0,
"tabIdx": 1,
"arg": "0,1",
"subtitle": "https://www.apple.com/iphone/"
}
]
}
arg
andsubtitle
are used for Alfred integration.
Window Index
andTab Index
is thearg
returned by thelist
command.
./chrome.js close 0,13
./chrome.js focus 0,13
./chrome.js
--yes
flag will cause no questions to be asked to the user. It'll close all tabs straight away.
Attention: Use this with caution. Make sure you don't have any unsaved work, emails, ... etc.
--ui
flag will cause the questions to be asked using a Chrome dialog instead of text in command line.
./chrome.js close --url apple --ui
It took around 4 hours using Photoshop. I wanted to use Illustrator but I realized that I completely forgot how to use it.
Drawing the shapes are pretty easy but I spent most of the time on the following:
- Picking harmonious colors.
- Figuring out how to make it less dull, ended up using a shadow under the window which made a significant difference.
- Figuring out how to represent the infrared waves.
- Finding a way to export the PNG to ICNS.
Planning to write an article on that soon.
If you find any bugs please feel to create an issue or create a pull request.
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.
Copyright (c) 2019 Renan Cakirerk
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.