Jump to content

Alfred2 workflow for google search suggestion, instant search, and current site search


Recommended Posts

The initial motive is to automatically use current front browser's site for site search. Current it includes google suggestion, instant search, site search and related search.

 

Suggestions are welcome.

 

Check it out in Github: http://zhaocai.github.com/alfred2-google-workflow/

 

 

It is also an example to use bundler to include gems in an alfred workflow. The command is bundle install --standalone.

workflow.png

Usage 1. Search Suggestion

Keyword g: provide google search suggestions based on {query}.

2. Instant Search

Keyword gi: get instant google search results in Alfred based on {query}.

3. Site Search

Keyword gs: get instant google search results of front browser's site in Alfred based on {query}.

Supported browsers are: Safari, Google Chrome, Opera, OmniWeb, etc.

You can use site:example.com query if you do not want to search for current front browser's site.

4. Related Search

Keyword related: get related google search results of front browser's site in Alfred based on {query}.

Supported browsers are: Safari, Google Chrome, Opera, OmniWeb, etc.

You can use related:example.com query if you do not want to search for current front browser's site.

Installation

Two ways are provided:

  1. You can download the Google.alfredworkflow and import to Alfred 2. This method is suitable for regular users.

  2. You can git clone or fork this repository and use rake install and rake uninstall to install. This method create a symlink to the alfred workflow directory: "~/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows". This method is suitable for developers.

Reference

  1. Site Search Workflow for Alfred 2
  2. Google Search in-line results workflow
Edited by zhaowu
Link to comment

Just WOW!

I love your workflow!

Thank you for sharing!

 

You should definetely submit your workflow to

http://www.alfredworkflow.com/

 

 

Would it be much work to change the Instant Search to google.de?

That would be so great!

 

Domenic

change the Instant Search to google.de should be easy. You just need to change the line in the `instant.rb` file

 

`    :arg      => URI.escape("http://www.google.com/search?as_q=#{query}&lr=lang_")`

http://www.google.com -> http://www.google.de

 

I am working on some updates. will upload this later. 

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

This is a great workflow though it doesn't appear to work with Firefox, any chance of adding support? (I'm using FF Aurora 22.0a2)

Firefox does not support applescript. I do not know a good way to get the tab url from it.

Link to comment
  • 3 weeks later...
  • 4 months later...

try to run the script `/usr/bin/ruby ./instant.rb {query}` from the command line and check the output.

 

Also check the log: ~/Library/Logs/Alfred-Workflow.log

It seems to be a Ruby error (I'm using 10.9 GM). This is the error when running from command line:

/usr/bin/ruby /Users/martin/Dropbox/Alfred_v2/Alfred.alfredpreferences/workflows/user.workflow.FD7614C1-3388-4F55-885A-5C04C0B50D3F/instant.rb test
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- alfred (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /Users/martin/Dropbox/Alfred_v2/Alfred.alfredpreferences/workflows/user.workflow.FD7614C1-3388-4F55-885A-5C04C0B50D3F/instant.rb:20:in `<main>'

Any ideas on how to fix it?

 

Thanks

Link to comment

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