Crie seu próprio Command Runner com o gnome-terminal:
Primeiro, crie um arquivo $HOME/.cmdrunrc
O conteúdo deve ser:
# 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"'
Em seguida, crie um arquivo .desktop ou um shell script com este comando:
gnome-terminal --title="Command Runner" --hide-menubar --geometry="50x1" -x bash -ic "cd ~; bash --rcfile .cmdrunrc"