All Projects → bit2pixel → Chrome Control

bit2pixel / Chrome Control

Licence: mit
A JXA script and an Alfred Workflow for controlling Google Chrome

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Chrome Control

Chrome Bookmarks Alfred Workflow
Chrome/Canary/Chromium/Microsoft Edge bookmarks search workflow for Alfred
Stars: ✭ 241 (+67.36%)
Mutual labels:  alfred, alfred-workflow, chrome
Alfred Show Network Info
Alfred 4 Workflow - See network info and discover local devices
Stars: ✭ 77 (-46.53%)
Mutual labels:  alfred, alfred-workflow
Alfred Firefox
Search and control Firefox from Alfred
Stars: ✭ 142 (-1.39%)
Mutual labels:  alfred, alfred-workflow
Alfred Vscode
Alfred 3 workflow that allows you to browse and open Visual Studio Code projects or simply open specified folders/files
Stars: ✭ 141 (-2.08%)
Mutual labels:  alfred, alfred-workflow
Alfred Pdf Tools
Optimize, encrypt and manipulate PDF files.
Stars: ✭ 69 (-52.08%)
Mutual labels:  alfred, alfred-workflow
Tldr Alfred
Alfred workflow for TLDR
Stars: ✭ 70 (-51.39%)
Mutual labels:  alfred, alfred-workflow
Alfred Hl
🔆 Syntax highlight code in the clipboard
Stars: ✭ 80 (-44.44%)
Mutual labels:  alfred, alfred-workflow
Alfred.qrcode
A QRcode generator with python-qrcode for Alfred Workflows.
Stars: ✭ 57 (-60.42%)
Mutual labels:  alfred, alfred-workflow
Alfred Calculate Anything
Alfred Workflow to calculate anything with natural language
Stars: ✭ 92 (-36.11%)
Mutual labels:  alfred, alfred-workflow
Deepl Alfred Workflow2
DeepL Alfred Workflow
Stars: ✭ 93 (-35.42%)
Mutual labels:  alfred, alfred-workflow
Alfred Workflow
Alfred Workflow教程与实例; CDto: 打开Terminal并转到任意文件夹或文件所在目录; Effective IP:查询本机和外网IP地址,解析任意URL和域名的IP地址,以及进行归属地和运营商查询; UpdateAllNPM: 更新所有Node.js全局模块; UpdateAllPIP: 更新所有Python模块
Stars: ✭ 98 (-31.94%)
Mutual labels:  alfred, alfred-workflow
Alfred Fuzzy
Fuzzy search helper for Alfred 3+ workflows
Stars: ✭ 67 (-53.47%)
Mutual labels:  alfred, alfred-workflow
Alfred Time
Start and stop tracking time with Toggl, Harvest, Everhour or Clockify through Alfred 4
Stars: ✭ 65 (-54.86%)
Mutual labels:  alfred, alfred-workflow
Alfred Open With Vscode Workflow
Alfred 3 workflow for opening files or folders in Visual Studio Code.
Stars: ✭ 74 (-48.61%)
Mutual labels:  alfred, alfred-workflow
Play Song
An Alfred workflow for quickly and easily playing music in iTunes / Apple Music
Stars: ✭ 62 (-56.94%)
Mutual labels:  alfred, alfred-workflow
Alfred Ssh
SSH workflow for Alfred for Mac with powerful hostname expansion/completion
Stars: ✭ 78 (-45.83%)
Mutual labels:  alfred, alfred-workflow
Alfred Awesome Lists
Alfred workflow to search awesome lists
Stars: ✭ 118 (-18.06%)
Mutual labels:  alfred, alfred-workflow
Alfred Lock
Alfred 3 workflow to lock your Mac
Stars: ✭ 54 (-62.5%)
Mutual labels:  alfred, alfred-workflow
Alfred Appscripts
Alfred workflow to search and run/open AppleScripts for the active application
Stars: ✭ 56 (-61.11%)
Mutual labels:  alfred, alfred-workflow
Alfred Google Translate Workflow
Alfred Google Translate Workflow. Alfred 多語言翻譯 Workflow,含有拼字校正、近似詞建議功能。(Temporally broken, use https://github.com/zetavg/alfred-google-translate-workflow/pull/8)
Stars: ✭ 85 (-40.97%)
Mutual labels:  alfred, alfred-workflow

Chrome Control

Chrome Control

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.

Usage

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.

Integration

You can use chrome-control to create fun integrations with your favorite tools (Alfred, vim, vscode, iterm2, ...).

Alfred

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 tabs
  • close url <keywords>: Close tabs with URLs matching these keywords
  • close title <keywords>: Close tabs with titles matching these keywords
  • dedup: Close duplicate tabs

Alfred

Commands

Close duplicate tabs

./chrome.js dedup

Close all tabs by titles containing strings

Strings are separated by spaces and case insensitive.

./chrome.js close --title "inbox" "iphone - apple"
./chrome.js close --title inbox iphone

Close all tabs by URLs containing strings

Strings are separated by spaces and case insensitive.

./chrome.js close --url "mail.google" "apple"
./chrome.js close --url google apple

List all open tabs in all Chrome windows

./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 and subtitle are used for Alfred integration.

Close a specific tab in a specific window

Window Index and Tab Index is the arg returned by the list command.

./chrome.js close 0,13

Focus on a specific tab in a specific window

./chrome.js focus 0,13

Show help

./chrome.js 

Don't prompt the user

--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.

Prompt user in Chrome

--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

Dialog

How did you create the banner and icon?

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.

Bug Fixes & Pull Requests

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.

License

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].