Search Engine Help

I don’t believe we do anything to explicitly select the original input, do we?
I think we just focus on the HTML input field, and by default WebKitGTK selects its content (correct me if I’m wrong).

In any case, yes I think we should add an option to select / unselect the input. An option to choose where the cursor starts would be nice too.

1 Like

I’d like that if it could happen! Would save me from having to rely on a keyboard macro for this and other similar things.

If you are in a hurry, you can already implement this by running some JS / parenscript in the prompt buffer to unselect the input. This is probably what we are going to implement anyways.

As always, contributions are welcome :slight_smile:

Based on you guys’ work here, just wanted to add some more engines in case they are useful to others:

(in-package #:nyxt-user)

;;search engines setup | last one in list becomes default
;;order: "shortcut" "url for search, ~a determines where query is placed" "fallback url when query fails or an empty search"
(defvar *my-search-engines*
  (list
   '("afr" "https://amazon.fr/s?k=~a" "https://amazon.fr/") ;;amazon.fr
   '("a" "https://amazon.com/s?k=~a" "https://amazon.com/") ;;amazon
   '("doi" "https://dx.doi.org/~a" "https://dx.doi.org/") ;;doi
   '("gh" "https://github.com/search?q=~a" "https://github.com/") ;;git repos
   '("hns" "https://hns.to/~a" "https://hns.to/") ;;handshake addresses
   '("imdb" "https://www.imdb.com/find?q=~a" "https://www.imdb.com/") ;;imdb
   '("lns" "https://www.lens.org/lens/search/scholar/list?preview=true&q=~a" "https://www.lrns.org") ;;lens
   '("osm" "https://www.openstreetmap.org/search?query=~a" "https://osm.org") ;;osm
   '("sp" "https://startpage.com/do/search?sc=g4dHFVhCiD5Z20&query=~a&cat=web" "https://www.startpage.com") ;;startpage
   '("spi" "https://startpage.com/do/search?sc=g4dHFVhCiD5Z20&query=~a&cat=pics" "https://www.startpage.com") ;;startpage images
   '("wfr" "https://fr.wikipedia.org/w/index.php?search=~a" "https://fr.wikipedia.org/") ;;fr.wikipedia
   '("w" "https://en.wikipedia.org/w/index.php?search=~a" "https://en.wikipedia.org/") ;;wikipedia
   '("ddg" "https://duckduckgo.com/?q=~a" "https://duckduckgo.com/"))) ;;duckduckgo

(define-configuration buffer
  ((search-engines (mapcar (lambda (engine) (apply 'make-search-engine engine))
                                   *my-search-engines*))))
2 Likes

I happened to discover this eventually. I assume, this is what most people want. It should be mentioned in the manual.

@fbmnds Do you mean @kabouik 's last post?

I saw his post after I incidently discovered it by myself

I added a few more engines, though I’m having trouble with Startpage (it’s supposed to save preferences per cookies or in a unique URL, but I didn’t find how to use the unique cookie-less URL for custom searches, so I used the cookie but it’s far from optimal as it needs to be saved on the device in the first place, which makes the configuration difficult to share on multiple devices; help welcome):

(in-package #:nyxt-user)

;;search engines setup | last one in list becomes default
;;order: "shortcut" "url for search, ~a determines where query is placed" "fallback url when query fails or an empty search"
(defvar *my-search-engines*
  (list
   '("afr" "https://amazon.fr/s?k=~a" "https://amazon.fr/") ;;amazon.fr
   '("a" "https://amazon.com/s?k=~a" "https://amazon.com/") ;;amazon
   '("doi" "https://dx.doi.org/~a" "https://dx.doi.org/") ;;doi
   '("gh" "https://github.com/search?q=~a" "https://github.com/") ;;git repos
   '("hns" "https://hns.to/~a" "https://hns.to/") ;;handshake addresses
   '("imdb" "https://www.imdb.com/find?q=~a" "https://www.imdb.com/") ;;imdb
   '("lns" "https://www.lens.org/lens/search/scholar/list?preview=true&q=~a" "https://www.lrns.org") ;;lens
   '("osm" "https://www.openstreetmap.org/search?query=~a" "https://osm.org") ;;osm
   '("sp" "https://startpage.com/do/search?sc=g4dHFVhCiD5Z20&query=~a&cat=web" "https://www.startpage.com") ;;startpage
   '("spi" "https://startpage.com/do/search?sc=g4dHFVhCiD5Z20&query=~a&cat=pics" "https://www.startpage.com") ;;startpage images
   '("wfr" "https://fr.wikipedia.org/w/index.php?search=~a" "https://fr.wikipedia.org/") ;;fr.wikipedia
   '("w" "https://en.wikipedia.org/w/index.php?search=~a" "https://en.wikipedia.org/") ;;wikipedia
   '("17t" "https://t.17track.net/en#nums=~a" "https://t.17track.net/en") ;;17track
   '("ddg" "https://duckduckgo.com/?q=~a" "https://duckduckgo.com/"))) ;;duckduckgo

(define-configuration buffer
  ((search-engines (mapcar (lambda (engine) (apply 'make-search-engine engine))
                                   *my-search-engines*))))

@kabouik You might want to have a look at GitHub - aartaka/nx-search-engines: A collection of easy-to-setup search-engines for Nyxt browser., which’ll allow you to save the unique URL parameter in your Nyxt settings.

1 Like