Gmrun

来自 ArchWiki

Gmrun (Gnome Completion-Run) 是一款轻量级的应用程序启动器,类似于 GNOME Run、Application FinderKRunner 等。

安装

Gmrun 可以通过软件包 gmrun 安装。

用法

  • GUI 应用程序只需输入并按 Enter 键即可运行,终端应用程序可以使用 Ctrl+Enter 运行。在空输入框中按 Ctrl+Enter 将打开一个终端窗口。
  • Gmrun 具有 Tab 补全功能:按 Tab 键将显示一个可滚动的匹配项列表。
  • 在 Gmrun 中输入的网址将自动启动 Web 浏览器。
  • 电子邮件地址也是如此,使用 mailto: 前缀,例如 mailto:foo@bar.com,将启动您的电子邮件客户端。
  • 可以将更多快捷方式添加到 ~/.gmrunrc (参见下面的 #配置) 或您可以修改系统范围的文件 /etc/gmrunc
  • 您可以通过输入 ! 作为第一个字母进入搜索模式,标题应从“运行程序”更改为“搜索”,然后您输入的字母将自动从您的命令历史记录中显示建议。
  • Ctrl+r 将允许您在历史记录中向后搜索。
  • Ctrl+s 将在历史记录中向前搜索。
  • Ctrl+g 将取消搜索。
  • 如果在配置文件中定义了扩展名,则只需键入文件名即可通过正确的程序启动文件。
  • Esc 键关闭 Gmrun,而不运行任何程序。

配置

配置文件位于 /etc/gmrunrc,但您可以在 ~/.gmrunrc 中创建用户配置(推荐)。请注意,%u 扩展为输入的完整命令,%s 是快捷方式后的最后一部分(例如,如果您输入 URL https://archlinux.org.cn%u 将保留 https://archlinux.org.cn,而 %s 将缩短为 //archlinux.org.cn)。

这是一个示例配置文件。

~/.gmrunrc
# gmrun configuration file
# gmrun is (C) Mihai Bazon, <mishoo@infoiasi.ro>
# GPL v2.0 applies

# Set terminal
Terminal = urxvt
TermExec = ${Terminal} -e
AlwaysInTerm = ssh telnet ftp lynx mc vi vim pine centericq perldoc man

# Set window geometry (except height)
Width = 400
Top = 300
Left = 450

# History size
History = 256

# Shows last history line selected when invoked
ShowLast = 1

# Show files starting with '.'
# Default is 0 (off), set it to 1 if you want "hidden" files to show up
# in the completion window
ShowDotFiles = 0

# Timeout (in milliseconds) after which gmrun will simulate a TAB press
# Set this to NULL if do not like this feature.
TabTimeout = 0

# URL handlers
# If the entered text is "http://www.google.com" then:
#   - %u gets replaced with the whole URL ("http://www.google.com")
#   - %s gets replaced with "//www.google.com".  This is useful for URL-s
#     like "man:printf" --> %s will get replaced with "printf"
URL_http = firefox %u
URL_mailto = firefox -remote "mailto(%s)"
URL_man = ${TermExec} 'man %s'
URL_info = ${TermExec} 'info %s'
URL_pd = ${TermExec} 'perldoc %s'
URL_file = pcmanfm %s
URL_readme = ${TermExec} 'less /usr/doc/%s/README'
URL_info = ${TermExec} 'info %s'
URL_sh = sh -c '%s'
URL_paci = ${TermExec} 'pacman -S %s'
URL_pacs = ${TermExec} 'pacman -Ss %s'

# extension handlers
EXT:doc,rtf = AbiWord %s
EXT:txt,cc,cpp,h,java,html,htm,epl,tex,latex,js,css,xml,xsl,am,php,css,js,py,rb = gedit %s
EXT:mpeg,mpg,avi,mkv,flv = vlc %s
EXT:mp3,ogg,m4a,wmv,wma = deadbeef %s
EXT:ps = gv %s
EXT:pdf = epdfview %s
ShowDotFiles (1 或 0)
是否在自动完成菜单中显示点文件(例如 .gmrunrc)。
TabTimeout (1 或 0)
是否在输入内容时自动显示 Tab 补全菜单。
终端
在未输入其他内容时按下 Ctrl+Enter 要运行的命令。
TermExec
在终端中运行特定命令(例如 ls ~)时要运行的命令。
URL_http
在输入网址时要运行的命令。
URL_mailto
在输入电子邮件地址时要运行的命令。
EXT
扩展名:用于打开具有特定扩展名的文件的应用程序。
顶部和左侧
Gmrun 窗口的位置(以像素为单位,从各自的边缘)。
宽度
窗口的宽度,以像素为单位。
历史记录
存储的命令历史记录的长度。

添加自定义快捷键

可以轻松添加快捷方式。例如,要使用 g 作为 Google 搜索的快捷方式,请添加

URL_g = firefox 'https://www.google.com/search?q=%25s'

然后像这样使用

g:Arch

快捷键绑定

您可以使用桌面环境或窗口管理器的快捷键绑定设置来为 Gmrun 设置一个。