elementary / applications-menu

Applications Menu for elementary OS and the Pantheon desktop environment
https://elementary.io
GNU General Public License v3.0
104 stars 37 forks source link

Search the web #89

Open jepotter1-archive opened 6 years ago

jepotter1-archive commented 6 years ago

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!](https://www.bountysource.com/issues/58178368-search-the-web?utm_campaign=plugin&utm_content=tracker%2F62023936&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F62023936&utm_medium=issues&utm_source=github).
ghost commented 6 years ago

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

peteruithoven commented 5 years ago

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

biswaz commented 5 years ago

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.

peteruithoven commented 5 years ago

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

biswaz commented 5 years ago

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

biswaz commented 5 years ago

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

peteruithoven commented 5 years ago

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

alcinnz commented 5 years ago

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

biswaz commented 5 years ago

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

alcinnz commented 5 years ago

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.

cassidyjames commented 5 years ago

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

alcinnz commented 5 years ago

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.

mattolenik commented 5 years ago

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.