Unity命令运行器

我在寻找Unity的命令运行器。 我知道快捷键ALT + F2下有默认的跑步者。 但正如在该问题中解释的那样, Run命令不运行命令行程序,它不允许运行命令行程序而不向命令添加一些前缀。

总之,我正在寻找命令运行器:

  • 有自动完成
  • 有上次使用命令的历史
  • 允许运行命令vim test.txtgedit test.txt不带任何前缀,后缀等。
  • 如果运行命令行程序,退出程序后应关闭终端窗口

从不同的命令运行程序我检查gmrun ,但它没有自动完成或历史记录。 另一方面, xfrun4中描述了xfrun4 – 在14.04中,xfrun4命令 xfrun4 ,但需要一些“!”前缀才能工作。

你知道一些可以与Unity集成并满足这些要求的命令运行器吗?

使用gnome-terminal创建自己的Command Runner:

首先创建一个$HOME/.cmdrunrc文件

内容应该是:

 # include .bashrc to load aliases from the .bashrc in the command runner source .bashrc # create a separated history file for the command runner HISTFILE=~/.cmdrun_history # shorten the command prompt PS1='\w\$ ' # function to check an array if it contains an element containsElement () { local e for e in "${@:2}"; do [[ "$e" == "$1" ]] && return 0; done return 1 } # your guis which will not open a additional terminal window on execution guis=(firefox mousepad gedit geany leafpad nautilus thunar pcmanfm xterm) # after this commands finished the terminal will be closed automatically close_after=(vi nano top) # the function that will be executed with every command custom_run() { if [ -n "$*" ]; then # write the real command to the history without "custom_run" history -s "$*" history -a # check if the command is an alias pure_cmd=$(echo "$*" | xargs | cut -d' ' -f1) if [ $(type -t "$pure_cmd") == "alias" ]; then # get the real command from the alias pure_cmd=$(type "$pure_cmd" | grep -oP "(?<=»)[^']+(?=«)") pure_cmd=$(echo "$pure_cmd" | cut -d' ' -f1) fi # check if command opens a gui or should be closed after it finished if containsElement "$pure_cmd" "${guis[@]}"; then bash -ic "($* &) &>/dev/null" elif containsElement "$pure_cmd" "${close_after[@]}"; then gnome-terminal -x bash -ic "$*" else gnome-terminal -x bash -ic "$*; bash" fi else # remove last command ("custom run") from history, if nothing is entered history -d $((HISTCMD-1)) fi exit 0 } # write the function "custom_run" before every command if the user presses return bind 'RETURN: "\e[1~ custom_run "\e[4~"\n"' 

然后使用以下命令创建.desktop文件或shell脚本:

 gnome-terminal --title="Command Runner" --hide-menubar --geometry="50x1" -x bash -ic "cd ~; bash --rcfile .cmdrunrc"