fogine / rofi-search

Interactive Google / DuckDuckGo search via rofi
MIT License
96 stars 7 forks source link

[Bug] Duckduckgo not working #10

Closed jonas-w closed 1 year ago

jonas-w commented 2 years ago

With environment variable

Okay i followed your usage guide and set ROFI_SEARCH to ddgr. When i start rofi-search it displays: {"prompt":"search","input action":"send"} and waits for input but doesn't open the search gui. When i type something into the commandline and hit enter this error pops up (e.g. "a"):

undefined:1
a
^

SyntaxError: Unexpected token a in JSON at position 0
    at JSON.parse (<anonymous>)
    at ReadStream.<anonymous> (/usr/lib/node_modules/rofi-search/rofi-search:80:36)
    at Array.forEach (<anonymous>)
    at ReadStream.<anonymous> (/usr/lib/node_modules/rofi-search/rofi-search:78:22)
    at ReadStream.emit (node:events:527:28)
    at emitReadable_ (node:internal/streams/readable:601:12)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)

Node.js v17.7.2

Without environment variable

Okay after that i tried it without the environment variable set but no googler installed. Then the GUI opens and when i type something in it, it immediately crashes and shows this error:

Can not find "googler" executable.
BlocksMode-Message: 18:57:03.494: Child 257334 exited abnormally

Which makes sense because googler isn't installed. But shouldn't there be a fallback if googler is not installed to use ddgr?

Information about system and installation

I'm using endeavouros with i3-gaps. I use the linux-zen kernel. I installed it using AUR but the rofi-blocks-git PKGBUILD file was faulty. So i installed rofi-blocks via makepkg -si and an edited version of the PKGBUILD file. More information on that in the AUR Package comments for rofi-blocks-git.

fogine commented 2 years ago

I updated rofi-blocks aur package. I see that googler github project is archived and its latest version is broken... so I'll need to remove the support for it. For google search you will need to setup google API keys..

How do you execute rofi-search exatly?

First simplest method is to

jonas-w commented 2 years ago

Okay thank you, installing rofi-blocks works now fine. I started rofi-search in the command line without the environment variable:

Can not find "googler" executable.
BlocksMode-Message: 11:50:15.438: Child 160750 exited abnormally

Googler is not installed and ddgr is installed. It seems like it doesn't search for ddgr

fogine commented 2 years ago

Hm, thats weird, something is off here, it definitely searchers for ddgr HERE I just checked, installed ddgr from aur and it works.. Do you have latest rofi versin? Mine is v 1.7.3

fogine commented 2 years ago

It seams like you have ROFI_SEARCH env variable set to googler in which case it would fail as you described...

jonas-w commented 2 years ago

Yes I have the latest rofi version mine is also 1.7.3. I installed rofi-search via aur and ddgr via aur.

Here a gif to show you what happens: render1648293428743

jonas-w commented 2 years ago

Okay if no environment variable is set it automatically sets it to googlr with the default config: https://github.com/fogine/rofi-search/blob/76c7c6f4019944c85a58ea434cd6535985a272f2/rofi-search#L33

fogine commented 2 years ago

If you set ROFI_SEARCH variable, you need to execute it like this:

export DDG_ARGS='["-n", 3]'
export ROFI_SEARCH='ddgr'

rofi -modi blocks -blocks-wrap /absolute/path/to/rofi-search -show blocks \ 
-lines 4 -eh 4 -kb-custom-1 'Control+y' -theme /path/to/your/theme.rasi

rofi-search command works only with default configuration (which in your case does not work for some unknown reason..).

EDIT: you can get default theme for rofi-search here: https://gist.github.com/fogine/b79bfdbf48ec70c698c977c13043b816

jonas-w commented 2 years ago

Theme is a bit weird. When starting with googler and rofi-search it looks normal. But if i search something with your command the highlighted text i searched nearly has the same color as the background color and the text seems to be invisible image

fogine commented 2 years ago

yeah, I'll need to update the default theme, with recent rofi version its broken a little bit..

fogine commented 1 year ago

colortheme fixed in rofi-search@1.1.0 (also removes googler support)