applications-menu icon indicating copy to clipboard operation
applications-menu copied to clipboard

Search the web

Open jepotter1-archive opened this issue 6 years ago • 13 comments

When no applications are found, there should be an option to search the web as well as searching AppCenter.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

jepotter1-archive avatar Apr 27 '18 17:04 jepotter1-archive

Another idea is introducing "shortcuts" like DuckDuckGo's bangs.

For example to search on Wikipedia you type !w search_term

https://duckduckgo.com/bang?q=wikipedia

ghost avatar May 10 '18 02:05 ghost

This should work with the users default browser and default search engine.

I noticed Firefox and Chromium support a --search argument. @cassidyjames opened a issue at epiphany to support it: https://gitlab.gnome.org/GNOME/epiphany/issues/630 @alcinnz opened one for Odysseus: https://github.com/alcinnz/Odysseus/issues/156

So the next challenge is calling the default browser. xdg-open seems to be the standard, but that doesn't support arguments like --search. xdg-settings get default-web-browser can be used to retrieve the default browser, but this gives the desktop file... (and the blog post below has other issues with it) https://stackoverflow.com/questions/3124556/clean-way-to-launch-the-web-browser-from-shell-script https://blog.codef00.com/2011/02/18/the-default-browser-on-linux-debacle/ The $BROWSER environment variable is a non-standard: https://github.com/elementary/default-settings/issues/109 But @alcinnz had a good point:

Here's the standard APIs you can use to find and run the default browser (as well as the default app for any URI scheme or MIMEtype): https://valadoc.org/gio-2.0/GLib.AppInfo.html

peteruithoven avatar Jan 21 '19 23:01 peteruithoven

screenshot from 2019-01-22 06-25-10

https://github.com/biswaz/applications-menu/

This is far from perfect. I've reused code from appcenter plugin.

biswaz avatar Jan 22 '19 00:01 biswaz

@biswaz feel like trying your hand at a pull request?

peteruithoven avatar Jan 22 '19 01:01 peteruithoven

Yes, I will make a pull request after a little tidying up.

biswaz avatar Jan 22 '19 04:01 biswaz

@peteruithoven Using google-chrome --search hoho just opens up the "url" http://hoho/

I was able to get the default browser by getting the application for the mime type "text/html". Now the challege is to use the search engine of users' choice. @cassidyjames What about a setting in switchboard ?

biswaz avatar Jan 22 '19 08:01 biswaz

I have to admit that indeed Chromium doesn't support the --search argument, they don't show a error, I must not have been paying attention. I've opened an issue: https://bugs.chromium.org/p/chromium/issues/detail?id=924076

peteruithoven avatar Jan 22 '19 10:01 peteruithoven

@biswaz I stated as much on Slack, but there's unfortunately a surprisingly subtle blocker on browsers supporting a Switchboard setting for a default search engine: autocompletion.

There's no standard amongst the dominant search engines (Google, Bing, DuckDuckGo, etc) as to how they provide these results. As such we have to integrate them one at a time if we want to support autocompletions.

alcinnz avatar Jan 22 '19 20:01 alcinnz

Autocompletion feature seems too far of a goal for now. Especially since there is no standard being followed.

biswaz avatar Jan 23 '19 14:01 biswaz

Yes, I don't think it should be part of the application launcher search anyways, because that has privacy implications. But many browsers will want to make sure it works for them, and all I'm saying is that this should work with those browsers.

Using a --search flag works well that way.

alcinnz avatar Jan 23 '19 20:01 alcinnz

@alcinnz except a --search flag is also completely non-standardized and not implemented in all (or even the majority of) browsers. So that's also a nonstarter.

cassidyjames avatar Jan 24 '19 00:01 cassidyjames

Hmmm, I'm not sure what to advise then. It wouldn't be hard to add a search engine configuration option for this feature to use, the challenge is with getting browsers to use it as well.

I do still think I'll offer --search from Odysseus, and maybe contribute to Epiphany and Midori. But I'll also follow this thread to see what else I can do.

alcinnz avatar Jan 24 '19 00:01 alcinnz

I just went ahead and implemented this.

Search implementation: https://github.com/elementary/applications-menu/pull/176

Switchboard configuration: https://github.com/elementary/switchboard-plug-applications/pull/37

[Edit: I misunderstood above posts, I didn't realize people meant autocomplete.] Just launch a URL in the browser and be done with it. Privacy-wise, nothing is ever sent to anywhere until they click/enter to complete the action. Use a sensible default, like DuckDuckGo, then let users be happy by picking from a menu of providers. We can also disable the feature by default but I really think it's something people expect from a modern desktop OS.

Autocomplete is also out for pretty much everything -- DuckDuckGo can't provide them if they wanted to (by their policy), and Google and Bing charge money to actually return search results. So no privacy concerns for something we can't even do 👍

Totally open to taking out Baidu and Yandex, I can see people being wary of those options. I just didn't want to have options only from the US. These just seemed to be the common options I see in other implementations.

mattolenik avatar Jan 27 '19 22:01 mattolenik