Jump to content

How to make Google Search with Suggestions the default.


Guest

Recommended Posts

Currently I have setup "g" as a keyword for Google search with suggestions. I was wondering if there's a way to make this the default for Alfred like it is for Spotlight.

Link to comment
5 hours ago, lukerooneyio said:

would like the suggestions to pop up without having to enter a keyword.


Alfred doesn’t work that way, I’m afraid. You can add a hotkey that takes you straight to a workflow, but you can’t include a workflow’s results in Alfred’s default results.

Link to comment
On 11/30/2020 at 9:23 AM, deanishe said:

Alfred doesn’t work that way, I’m afraid. You can add a hotkey that takes you straight to a workflow, but you can’t include a workflow’s results in Alfred’s default results.

@deanishe is right in pointing this out. Rather, I would even go ahead and make a guess that Alfred's not designed to be used this way.

 

However, in the spirit of tinkering, if we're okay with ugly, unwieldy hacks to just see what's possible, what you're asking @lukerooneyio, can be done.

Edit: learnt this cool trick from: https://github.com/biati-digital/alfred-calculate-anything

 

Be warned:
It is ugly
It is possible that it has performance issues
It leads to inconsistency

 

That out of the way, here's how one could go about achieving the end result of "google search suggestions in Alfred without explicitly typing a keyword".

 

Oh wait, let me clarify: we will be using keywords all right, just that, from the user's point of view, it appears as if there are no keywords involved.

 

Here, I searched for "screen", and you can see three google auto-suggestions: "screen recorder", "screener", "screenshot"

image.thumb.png.d83816025904264afe648615a9a72e2b.png

Apart from messy implementation, the two biggest issues I see with this hack are:

  1. Predictability: Alfred's default fallback searches always appear at the very bottom. This one, on the other hand, could appear anywhere (right at the top, somewhere in the middle like this screenshot, or not at all if Alfred thinks that there are other much better matching results)
  2. Consistency: In Alfred's default search, I expect results to show instantly, and I don't expect them to change once they display on screen. Here, the google suggestions take time to show up and finalize. See the GIF: Before it finalizes on "sketches, sketchup ...", the results briefly read "speed test, sports ..."default-suggestions.gif.4f4c10597599dcbd36557b4b5cebdf68.gif

 

I believe now we're truly done with disclaimers and "why this might not be a good idea", here's the implementation, where I added 26 extra script filters to @deanishe excellent searchio workflow: (one script filter for each small-case letter)

695425335_CleanShot2020-11-30at13_40.02@2x.png.8bb1550431900dd28d412bdea7d9a724.png

 

This is how the default google search script filter in searchio ran:

# keyword google
# with space
# argument required

./search google-en "$1"

 

This is how each of the script filters I added runs:

# keyword s
# without space
# argument required

# choose only top 3 results
# note the "s$1"
res=$(./search google-en "s$1" | /usr/local/bin/jq '.items[:3]')
echo "{\"items\": $res}"

 

Edited by Mr Pennyworth
Added where I learnt this trick from
Link to comment

Took me a minute to figure out what you'd done there. That's another very clever solution.

 

48 minutes ago, Mr Pennyworth said:

I would even go ahead and make a guess that Alfred's not designed to be used this way.

 

OTOH, it also kinda is.

 

It'd be a terrible idea to convert all your workflows to run like this. But one workflow adding max. 3 results is just pure clever, imo.

 

48 minutes ago, Mr Pennyworth said:

Here, the google suggestions take time to show up and finalize.

 

No luck fiddling with the "Run Behaviour" settings?

 

Edited by deanishe
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...