Failed to launch Google in Firefox from Terminal for Search.

Problem: have a keyboard shortcut for google current selection in screen capture mode from terminal on Firefox

You can copy the sentence to the Screen clipboard in copy mode by pressing enter

. However, I want to be able to click g

to place the following command on the Screen clipboard as the first parameter:

#!/bin/sh
q=$1
open "http://www.google.com/search?q=$q"

      

I am doing the same at the moment

  • Ca Esc [select area] enter
  • Cz [to hide the current window]
  • google Ca]

How can you put the screen clipboard in a command ?

+1


a source to share


3 answers


Here's how someone modified their .screenrc file to sync with the X clipboard. You can try changing it to send the selected text to Firefox instead of xsel.



+1


a source


I'm still trying to figure out the exact syntax, but take a look at using "bind" with "writebuf" (and possibly "eval") in the .screenrc file.

EDIT

You can bind keys in the .screenrc file in your home directory. For instance.

bind g eval 'writebuf' 'exec . /bin/sh/ -c "cp /tmp/screen-exchange ~/foo.txt"'

      

The eval command is executed when you use screen g on screen. Eval takes any number of arguments and runs them as a Tcl script.



writebuf flushes your file copy / paste buffer to / tmp / screen -exchange.

The second line starts with exec , which runs a program external to the Tcl interpreter. In this case, I select / bin / sh (a * nix shell) and pass an arbitrary system command. The above example copies the file / tmp / screen -exchange, but you can:

open < /tmp/screen-exchange

      

Once the line is added to ~ / .screenrc, restart the screen, copy the text and try

C-a g

      

+1


a source


open "http://www.google.com/search?q=`xclip -o`"

      

This works in the X copy buffer, not Screen, but the X buffer is usually what you want as it is given by simply selecting text.

+1


a source







All Articles