Não foi possível iniciar o Google no Firefox a partir do terminal de pesquisa da área de transferência da tela
-
23-08-2019 - |
Pergunta
Problema: para ter um atalho de teclado para o Google uma seleção atual no modo de cópia da tela do terminal para o Firefox
Você pode copiar a sentença para área de transferência do ecrã em modo de cópia pressionando enter
. No entanto, eu quero ser capaz de imprensa g
para colocar área de transferência do ecrã para o comando abaixo como o primeiro parâmetro:
#!/bin/sh
q=$1
open "http://www.google.com/search?q=$q"
Eu faço o mesmo no momento por
- C-a Esc [selecionar a área] entrar
- C-Z [colocar a janela corrente fora do caminho]
- google C-a]
Como você pode colocar área de transferência do ecrã para o comando ?
Solução
Here's a description of how someone modified their .screenrc file to sync it with the X clipboard. You might try modifying it to send the selected text to Firefox instead of xsel.
Outras dicas
open "http://www.google.com/search?q=`xclip -o`"
This works on X's copy buffer rather than Screen's but the X clipboard is usually what you want since it is set by simply highlighting text.
I'm still trying to work out the exact syntax but take a look at using 'bind' with 'writebuf' (and possibly 'eval') within your .screenrc file.
EDIT
You can bind keys in the .screenrc file in your home directory. E.g.,
bind g eval 'writebuf' 'exec . /bin/sh/ -c "cp /tmp/screen-exchange ~/foo.txt"'
This runs the eval command when you use the g key in screen. Eval takes any number of arguments and runs them as a Tcl script.
writebuf dumps your screen copy/paste buffer into a file at /tmp/screen-exchange.
The second string starts with exec which will run a program external to the Tcl interpreter. In this case, I choose /bin/sh (a *nix shell) and pass an arbitrary system command. The example above copies the /tmp/screen-exchange file but you might:
open < /tmp/screen-exchange
Once the line has been added to ~/.screenrc, restart screen, copy some text and try
C-a g