Is there a way to customize evince to search on Google a selected phrase? Like in Firefox where I select a text and right-click--> "Search Google for ..."

If evince isn't customizable, is there any other pdf reader that can do that (and how)?

I'm on Linux Mint - mate desktop (if that matters).

UPDATE: Since firefox seems to be buggy, answers with different mainstream web browsers (chrome, opera etc) are accepted.


I found out that

firefox -remote "openURL(http://www.google.com/search?q=$(xsel), new-tab)"

works in terminal.

I tried to use it in keyboard shortcuts (linux Mint with Mate) and it doesn't work. Any ideas?

  • 3
    You could configure xbindkeys to do a firefox "$(xsel)" upon a key or mouse button press combination. Then that'd work from any application. Aug 6 '14 at 15:17
  • @Braiam: won't that open a firefox instance every time? Aug 6 '14 at 15:27
  • I suppose you wanted to ping @StéphaneChazelas instead
    – Braiam
    Aug 6 '14 at 15:44
  • Yes, indeed I did. Aug 6 '14 at 15:46
  • 1
    Recent firefox releases try to contact an already running firefox by default (and don't support running two instances on the same profile). Aug 6 '14 at 15:58

By combining:

I got it to work by adding to keyboard shortcuts (not xbindkeys).

So all the steps are:

Control center --> scroll down to Keyboard Shortcuts --> Press Add and give a name (e.g. "Google it!" and the command:

sh -c 'firefox -remote "openURL(http://www.google.com/search?q=$(xsel),new-tab)"'

Don't forget to assign the key combination for activating the shortcut!

One problem I found out is that if the search string ends with ) the shortcut won't work.


@John1024 solved the problem mentioned: Escape closing parentheses from URL with firefox -remote

  • also with xclip : askubuntu.com/a/222340/47206
    – user32012
    Feb 8 '17 at 12:05
  • If this doesn't work, try assigning the command sh -c 'firefox --new-tab http://www.google.com/search?q="$(xsel)"' (you may have to sudo apt install xsel).
    – Avia Efrat
    Jan 10 '20 at 13:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.