Jump to content

alfred-chrome - Open URL in Google Chrome (also with specific profile)


Recommended Posts

Also available here: http://www.packal.org/workflow/alfred-chrome

 

Introduction

 

This workflow allows you to open a URL in Google Chrome.

 

To trigger the workflow, type chrome or cr. Optionally you can add a URL.

Between the results you will a list of profiles to use to open the URL (or simply to open a new window).

If you hold the `Alt` key while selecting the result item, the window will be open using incognito mode.

 

Installation
 
Double click (or open in Alfred settings) the Alfred Chrome.alfredworkflow file.

This workflow is for Alfred 3 only therefore it works on macOS 10.9+ (Mavericks and following).

 
Uninstallation
 
Remove the workflow via Alfred settings.

 

Specifying a different flavor of Chrome

 

If you use Canary version of Chrome or similar applications, like Chromium, you can instruct the workflow to use it.

To do it:

 

  1. In the Workflows settings, select Alfred Chrome workflow.
  2. Open the Configure workflow and variables by clicking on the second icon on right section of the workflow header.
  3. Under the Workflow Environment Variables section, create a variable called ALFRED_CHROME_NAME and enter the same name you see in your Applications folder.
  4. Click on Save and you're good to go! :)
Edited by ShogunPanda
Link to comment
  • 1 month later...

Ehi @polen, do you get any error or notification?

 

If not, can you please try the following steps and paste the output here?

 

1. Open Alfred Preferences 
2. Go to Workflows settings 
3. Right click on “Alfred Chrome” and then click on “Open in terminal” 
4. Press enter in the terminal 
5. Type “./alfred-chrome $QUERY“ (without quotes, where $QUERY must be replaced with whatever you usually type in Alfred) and press enter again 
 

This way I should be able to address any issue. Thanks!

  Paolo

Link to comment
  • 2 weeks later...

I'm having some trouble with this workflow. When I enter "chrome in $USER $URL" I get an invalid url message. "chrome $URL" works fine.

 

Where would I track down the correct variable for $USER? Profile names doesn't seem to work, and neither does the folder names in the Chrome application support folder.

Link to comment
  • 1 month later...
  • 2 weeks later...
  • 1 month later...
  • 4 weeks later...

Hi,
Getting an error while trying to initialize the shortcut
Error logs when 
“./alfred-chrome $cr“ from terminal,

-bash: “./alfred-chrome: No such file or directory

 

Error logs in application window,
 

Starting debug for 'Alfred Chrome'

[2017-04-16 22:18:15][ERROR: input.scriptfilter] Code 1: Google Chrome cannot be found.
Nothing to do! :(
[2017-04-16 22:18:15][ERROR: input.scriptfilter] JSON error: JSON text did not start with array or object and option to allow fragments not set. in JSON:
Google Chrome cannot be found.
Nothing to do! :(


I am syncing Alfred preferences via Dropbox

Link to comment

The same for me

 

On 4/16/2017 at 8:04 PM, doctorwho said:

Error logs in application window,


Starting debug for 'Alfred Chrome'

[2017-04-16 22:18:15][ERROR: input.scriptfilter] Code 1: Google Chrome cannot be found.
Nothing to do! :(
[2017-04-16 22:18:15][ERROR: input.scriptfilter] JSON error: JSON text did not start with array or object and option to allow fragments not set. in JSON:
Google Chrome cannot be found.
Nothing to do! :(

 

Edited by artdev
Link to comment
  • 2 weeks later...
  • 2 months later...
  • 2 weeks later...

@loudestnoise Download only the main.swift file from my GitHub. Then compile it to an executable on your Mac either with Xocde or in Terminal.app by running

swiftc main.swift -o alfred-chrome-fixed

or whatever output name you want. I'm not sure if you need to install Xcode for that.

 

Then right click on Alfred Chrome in the Alfred Workflows Tab to open the workflow directory in Finder. Copy the compiled executable there and change the script Alfred Chrome is using by right-clicking the "cr" and / or "chrome" Script Filter, then Configure Object and then changing the Script File to your new file.

That's what I did, hope it helps.

Edited by aheidelberg
Link to comment
  • 4 months later...

Hi all!

First of all, sorry for the long absence in supporting this workflow.

@aheidelberg Thanks for finding a workaround while I was MIA :)

 

Today I've update the Workflow to version 4.0.0.

This update includes a rewrite in Go of the helper, which slims down workflow size by more than a half.

I also checked Chrome source and I now the profiles detection has vastly improved, support explicitly Chrome, Chrome Canary and vanilla Chromium.

 

Finally, in order to specify a different Chrome flavor, you know have to use the environment variable ALFRED_CHROME_NAME, which you can easily edit in the workflow configuration window (second icon in the settings) rather than editing obscure files. 

For more information about this, checkout the first post of this thread.

 

Let me know if it works properly and thanks again for liking this!

See ya!

  Paolo

Link to comment
  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...