Sha*_*ani 6 command-line search google
有时当我在我的终端上工作时,我会遇到一些错误。要解决这些问题,我必须手动将错误消息粘贴到 google 并搜索解决方案。
是否可以选择消息并右键单击以获取“Google it”选项,而不必手动粘贴和搜索?
我不是在询问从终端执行 Google 搜索或从终端浏览网页。我想要的是更一般的东西。我希望能够通过右键单击(或使用键盘快捷键)选择一段文本并获得“Google 选择的文本”。我更喜欢在浏览器中进行搜索。
幸运的是,tualatrix 在 gnome-terminal 上做了一个小改动,并增加了在右键单击消息时在 Google 上搜索的支持。
不过,您需要添加第三方 PPA才能使其正常工作。在终端中运行这些命令:
sudo add-apt-repository ppa:tualatrix/personal
sudo apt-get update
sudo apt-get install gnome-terminal
Run Code Online (Sandbox Code Playgroud)
更新后,关闭所有终端窗口并重新打开。它将按预期工作。

热键绑定sh -c 'firefox "https://www.google.com/search?q=$(xclip -o)"'在系统设置- >键盘- >自定义
或者使用以下脚本,让您在谷歌搜索之前编辑鼠标选择。
#!/bin/bash
# get mouse selection
QUERY=$(xclip -o)
# edit selection
QUERY=$(zenity --entry --entry-text="$QUERY" --text='Google')
[ "$?" != 0 ] && exit 0
# search google in firefox (you can use google-chrome, chromium, opera ..)
firefox "https://www.google.com/search?q=${QUERY}"
exit 0
Run Code Online (Sandbox Code Playgroud)
要使用此脚本,请将其复制/粘贴到新的文本文件 (gedit ..) 中,并随意命名,例如google_clip.sh。设置执行权限,chmod +x /filepath/google_clip.sh或者在 Nautilus 中右键单击Properties -> Permissions -> 检查Execute。然后按键绑定。
| 归档时间: |
|
| 查看次数: |
800 次 |
| 最近记录: |