Plasma Krunner

From KDE Wiki Sandbox
Revision as of 17:38, 31 May 2021 by Reverier (talk | contribs) (Created page with "打开'''KRunner'''的最简单方法是使用全局快捷键 (默认情况下这个快捷键是<keycap> Alt + Space </ keycap>或<keycap> Alt + F2 </ keycap>). 在某些活...")

KRunner (使用 Alt-F2 或者 Alt-SPACE 快捷键来启动) 是Plasma桌面内置的快速启动器. 他的基本功能是从一个迷你的命令行启动特定程序, 不过它的功能也可以通过"runner"来扩展,以帮助用户完成许多其他的任务.

Note
你可能需要安装额外的 KRunner 插件包来使用这里列出的一些功能, 这取决于你的发行版. 注意, 开启大量的插件可能会减慢KRunner的启动速度, 你通过单击文本输入字段左侧的“设置”图标来进行调整.


特性

这个不完整的列表试图展示一些使用KRunner的基本例子. 你可以点击KRunner上的'?'按钮来发现更多用法.

启动或者终止程序运行

你可以通过输入你想要启动的应用程序的名称来启动程序——或者使用更简单的做法: 按方向键来查看你预先输入的最近使用的程序列表。

当你开始输入第一个字符时,KRunner就会开始查找匹配项。你 可以从能够自定义的应用程序菜单中找到与应用程序匹配的内容(为此,请在菜单中单击鼠标右键).

示例:

输入 输出
gwe (打开 Gwenview)

您也可以使用KRunner杀死应用程序。 键入关键字 kill ,后跟进程名称,KRunner将提供关闭应用程序(SIGTERM)或强行退出应用程序(SIGKILL)的选项。 KRunner会将部分进程名称与正在运行的进程匹配。

请注意,可以在"Terminate Applications"插件中更改关键字 kill ,以避免与接受进程ID的shell命令kill混淆。

直接安装

如果你在寻找尚未安装的应用程序,KRunner将建议一组与你的搜索匹配的应用程序。 KRunner已与Plasma软件中心 Discover集成,因此,将向您显示应用程序列表,使您可以继续直接安装。

shell指令

除了应用程序菜单中列出的应用程序外,“‘KRunner’还可以用于运行shell命令,包括启动二进制文件。注意,当输入shell命令时,“‘KRunner’将不提供命令自动补全功能, 也不识别只输入了一部分的指令。

运行这样的命令会弹出一个扳手图标,提供额外的选项。你可以选择打开终端并在终端里运行命令(如果你的命令生成了你想要读取的文本输出,这可能很有用),或者选择作为另一个用户(通过提供该用户的用户名和密码)来运行程序。

例子:

输入 输出
ls ~/Documents 显示文件夹 ~/Documents 的内容(在终端中)
cp ~/Documents/myFile ~/myFile 从 ~/Documents 拷贝myFile文件到 ~/
mplayer myMovie.mkv 使用mplayer播放myMovie.mkv

顺便, 如果你经常使用命令行, 你可能会喜欢man pages的集成功能. 只需要简单的输入你想查询的命令并加上前缀#, 就可以在浏览器里打开对应的man pages.

例子:

输入 输出
#ls 在浏览器中打开ls命令的使用指南
man:/grep 在浏览器中打开grep命令的使用指南

浏览网站

你可以简单地输入网站的URL, 然后就可以在默认浏览器中打开它. 你也可以输入浏览器书签的名称, KRunner也会显示出来, 选择即可打开. 如果你在浏览器中保留了以前的浏览历史记录,那么KRunner也能够从浏览器的历史记录中获取结果。

例子:

输入 输出
书签名 在浏览器中打开该书签
kde.org 在浏览器中打开 KDE homepage
http://userbase.kde.org/ 在浏览器中打开 Userbase

KRunner会在系统设置中找到你设置的Web快捷方式, 所以你也可以直接使用它们.

例子:

输入 输出
gg:KDE 在Google中搜索KDE
wp:krunner 在 Wikipedia 中搜索 krunner

KRunner 也能通过与KGet 集成, 提供从网络上下载文件的功能. 提供可下载文件的地址即可.

其他一些附加的启动选项也提供了快速搜索Wikipedia, Wikitravel和KDE Techbase的功能.

打开文件, 文件夹和设备

你可以通过KRunner来打开并访问本地文件和文件夹. 你也可以通过它来访问远程计算机上的内容. 请注意,KRunner使用kioslaves来访问ssh(fish:)和samba(smb:)

例子:

输入 输出
file:/home/ Dolphin 中打开 file:///home/ (the Home directory)
file:myMovie.mkv 打开 /home/myMovie.mkv
fish:you@server.com 使用fish (file over ssh)协议打开 fish:/you@server.com/
smb:myWindowsBox 使用samba协议打开 smb:/myWindowsBox

如果你不知道文件的路径, 可以尝试只输入文件名. 如果文件是最近打开过的文档, 那么KRunner会为你列出匹配的文件, 如果你启用了Baloo守护程序提供的“文件搜索”功能, 则还可以通过索引内容在计算机上搜索文件. 如果你在 Dolphin的侧边栏上添加过文件夹书签,KRunner也会在搜索结果中列出这些书签. 此外, 如果要访问计算机设备 (无论有没有挂载) 也是可以的. KRunner会提供一些关于设备的选项.

例子:

输入 输出
Home Dolphin中打开Home目录
可插拔设备名称 显示挂载此设备的选项或浏览设备中文件的选项

在会话, 窗口, 桌面与活动中的多任务

Several KDE applications allow you to save and load sessions. KRunner allows you to launch these sessions. You can either type in the name of the application or directly type in the name of the session. Runners exist for opening sessions saved in Kate, Konqueror, Konsole, etc.

KRunner is a multitasker's dream. If you have too many windows open, just type in the title of the window and switch directly to it. You can similarly type in the name of a virtual desktop and switch directly to it. If you roll with activities, switch activities by typing their name in. KRunner will find a match as soon as you type three characters in.

KRunner will even switch desktop sessions for you. Type in the keyword switch or new session to start a separate X session. You can switch back and forth between sessions by using the switch keyword.

Examples:

Input Output
Desktop 1 switches the virtual desktop to Desktop 1
myWorkActivity switches the activity to myWorkActivity
switch shows options to switch to an existing session or start a new one
new session starts a new session

Several plasma widgets can be launched as windowed applications. You can simply type the name of a widget and KRunner will launch a window for you.

Talk to people

Type in the name of a contact in your KAddressBook to get a list of options to contact them. Typing in an email address into KRunner will open a KMail composer window. You can also search through contacts in your Kopete contact list.

The addressbook and kopete runners don't seem to be working in SC 4.8.

Examples:

Input Output
kde@mail.kde.org compose a mail to the KDE mailing list
myContact show options to contact myContact

Listen to some music

You can control any modern audio player such as Amarok using KRunner. You can use several keywords (all configurable) to play, pause or skip songs. Typing in the name of an artist, album or song that is in Amarok's library will let you either play immediately, play next (queue) or play at the end (append) of the current playlist. You can use keywords to increase or decrease the volume of the player, or even to mute or quit it.

Examples:

Input Output
play song search plays a song immediately
pause pauses Amarok or your designated music player
next plays next song in playlist

Be on time

You can get the current date or time by typing in the keywords date or time. Selecting the result will copy it to your clipboard so you can paste it elsewhere. The format of the date and time respects your system settings.

Examples:

Input Output
date Today's date is ...
time The current time is ...

You can even get the date and time at another location by specifying the time zone or the city listed in the TZ database.

Examples:

Input Output
time UTC The current time in UTC is ...
time oslo The current time in Europe/Oslo is ...
time kolkata The current time in Asia/Kolkata is ...

There is a runner for interfacing with Korganizer and fetching events, but it doesn't seem to be working in SC 4.8.

Calculator

KRunner features a very versatile calculator that can be called by starting or ending a calculation with an = sign. In addition to basic arithmetic, you can call scientific functions like sqrt(), sin(), log(), etc. A list of the supported functions is here. Note that trigonometric functions like sin(), cos(), etc expect the angle in radians. KRunner understands pi in expressions.

Examples:

Input Output
32*12 = 384
= sqrt(4) + 32*sin(30*pi/180) 18

KRunner also supports combinatorics functions, like perm() or comb().

Examples:

Input Output
= perm(10,5) 30240
= comb(10,5) 252

KRunner can also handle symbolic mathematics and perform integration and differentiation on expressions

Examples:

Input Output
= integrate( -x/y^2, y ) -x/y
diff( log(x) ) = 1/x

You can also use KRunner to solve polynomial functions to find its roots.

Examples:

Input Output
= solve( x^2 + 4*x - 21 = 0 ) [3, -7]

KRunner intelligently handles units as part of the calculations. Try the following examples to see how.

Examples:

Input Output
= 2.5 kg * 10 m/s^2 25 N
220 V / 10 A = 22 ohms

Since KRunner understands most units, you can use it to convert them very quickly. Note that unit conversions don't require an = sign.

Examples:

Input Output
30 F -1.11111 degrees C (°C), 273.039 K, ...
27.8 km 1.09449e+06 inches (in), 17.2742 miles (mi), ...
5 gallons in liters 18.9271 liters (l)

KRunner knows currencies, too. Conversions between currencies is done by fetching the exchange rate from the European Central Bank website.

Examples:

Input Output
1 dollar 0.657002 pounds sterling (GBP), 0.742501 euros (EUR), ...
125 euros 110.606 pounds sterling (GBP), 15,785 yen (JPY), ...
30 JPY in RUB 9.40731 rubles (RUB)

Go places

If you have bookmarked locations in the Marble (in OpenStreetMap), KRunner can open the map directly.

Spell checking and special characters

KRunner can tell you whether your spelling is correct and/or suggest corrections. The default keyword to start the spellchecker is spell and can be configured.

Examples:

Input Output
spell linux Suggested words: Linux, lynx, ...

KRunner can also allow you to pick special characters if you can specify the hexadecimal unicode for the character, preceded by a # sign.

Examples:

Input Output
#03b2 β
#00b1 ±

Manage your computer

You can directly open system settings control modules from KRunner. Often, if you want to change something, just type associated terms and KRunner will find the control module with the settings you want.

Examples:

Input Output
keyboard opens the Keyboard settings control module
fonts opens the fonts settings control module
password opens the Password & User account control module

KRunner can also be used to adjust the screen brightness by using the keywords "screen brightness". You can specify a percentage or just turn the brightness halfway or fully down. Additionally, keywords exist to suspend, logout, shutdown or restart your machine.

Examples:

Input Output
screen brightness 100 increases screen brightness to 100%
sleep suspends computer to RAM
lock locks the screen
restart restarts computer
shutdown shutdowns computer

使用方法

打开KRunner

打开KRunner的最简单方法是使用全局快捷键 (默认情况下这个快捷键是 Alt + Space </ keycap>或<keycap> Alt + F2 </ keycap>). 在某些活动状态(例如空桌面)中,你只需点击桌面并开始在键盘上输入字符即可。 在某些部件和程序中(例如搜索和启动), 已经内置了'''KRunner''''.

你也可以右键你的工作区, 然后从菜单中选择<menuchoice>显示KRunner</menuchoice>或者从命令行中输入<code>krunner</code>来启动它.

===使用 KRunner===

使用 <keycap>Tab/Ctrl+j 或者 Shift+Tab/Ctrl+k 来浏览上下页结果. 使用 arrow keys 在某个结果的不同选项之中移动. 使用 Enter (or left click) 选定一个结果.

探索KRunner

单击扳手图标可显示配置选项,您可以在其中启用/禁用/配置将处理搜索的运行程序。其他选项可用于更改屏幕上显示 krunner 的位置。如果你乐意的话,甚至可以将样式更改为面向任务的样式。

点击 '?' 图标可以打开一个滚动列表, 里面有所有可用的runner和对应的使用语法. 这是寻找新功能的好方法!

提示, 技巧与常见问题

你可以在特殊的"single runner"模式下使用KRunner。在此模式下,KRunner 将只使用一个runner来处理您的搜索。相当多的runner都已经支持了此选项, 但仍有少部分没有支持。直接从KRunner打开全局快捷键控制模块,然后选择"运行命令界面"以查看可用的内容, 并为你想要的模式设置全局快捷方式,并在该模式下启动"KRunner"。你可以拥有许多运行模式, 这取决于你能找到多少快捷键。

这个 博客 提到了一些KRunner计算器的高级用法.