ubuntu kde_在(k)Ubuntu上的KDE中从快捷键启用Google搜索

ubuntu kde

ubuntu kde

KDE has an extremely powerful scripted user interface through the use of the dcop utility. You can control virtually any KDE application by entering dcop commands through shell scripts or from the shell itself. These actions can then be tied to menu items, and even hot keys. KDE can also be installed on Ubuntu through the kubuntu-desktop package.

通过使用dcop实用程序,KDE具有非常强大的脚本化用户界面。 通过Shell脚本或从Shell本身输入dcop命令,您几乎可以控制任何KDE应用程序。 然后可以将这些操作绑定到菜单项,甚至是热键。 也可以通过kubuntu-desktop软件包将KDE安装在Ubuntu上。

I had asked my friend Caveman a while back if it was possible to select text in any application and do a Google search via a hotkey. He came back 30 minutes later with a solution, which I’m posting for you here.

我曾问过我的朋友凯夫曼(Caveman)一段时间,是否可以在任何应用程序中选择文本并通过热键进行Google搜索。 30分钟后,他回来了,提出了解决方案,我正在这里为您发布。

First, make sure you have the xsel package installed by running the following command:

首先,通过运行以下命令确保已安装xsel软件包:

sudo apt-get install xsel

须藤apt-get install xsel

Now we’ll create a shell script named gsrch.sh and put it in your home folder.

现在,我们将创建一个名为gsrch.sh的shell脚本,并将其放在您的主文件夹中。

kwrite ~/gsrch.sh

kwrite〜/ gsrch.sh

Enter in the following text. Make sure that there isn’t a line break on the second line (and pardon the funky formatting)

输入以下文本。 确保第二行没有换行(请原谅时髦的格式)

#!/bin/bash

#!/ bin / bash

dcop `dcopfind -a ‘konqueror-*’` konqueror-mainwindow#1 newTab “http://www.google.com/search?q=`xsel -p -o`&ie=UTF-8&oe=UTF-8″

dcop`dcopf​​ind -a'konqueror-*'`konqueror-mainwindow#1 newTab“ http://www.google.com/search?q=`xsel -p -o`&ie = UTF-8&oe = UTF-8”

Now enable execute permissions on the shell script:

现在,在shell脚本上启用执行权限:

chmod u+x ~/gsrch.sh

chmod u + x〜/ gsrch.sh

Now we are ready to add this to an item to the KDE menu. Run kmenuedit to get to the KDE menu editor, and add a new item wherever you feel like:

现在,我们准备将其添加到KDE菜单的项目中。 运行kmenuedit进入KDE菜单编辑器,并在需要的地方添加一个新项:

You can name the item whatever you want, but you will need to browse to the correct path for the command script on your system. Change the work path to be your home directory, and make sure that the “Enable launch feedback” checkbox is Not checked.

您可以随意命名该项目,但是您需要浏览到系统上命令脚本的正确路径。 将工作路径更改为您的主目录,并确保未选中“启用启动反馈”复选框。

Click on the hotkey button in the bottom right hand corner of this window, and set an appropriate hot key. I used Win+G, but you can set it to anything you’d like:

单击此窗口右下角的热键按钮,然后设置适当的热键。 我使用了Win + G,但是您可以将其设置为任何您想要的:

Now we can test it out by selecting text in any window. For instance, I wanted to figure out what this error message means, so I selected the text, and then hit the Win+G hotkey:

现在我们可以通过在任何窗口中选择文本来对其进行测试。 例如,我想弄清楚此错误消息的含义,因此选择了文本,然后按Win + G热键:

And easy as pie, I’ve got a google search window all ready to go:

和馅饼一样简单,我已经准备好了一个Google搜索窗口:

KDE is just amazing! 

KDE太神奇了!

翻译自: https://www.howtogeek.com/howto/ubuntu/enable-google-search-from-shortcut-key-in-kde-on-kubuntu/

ubuntu kde

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值