You could probably enjoy running gconf-editor
— or maybe even dconf-editor
since 12.04, — and navigate directly to the org.gnome.desktop.default-applications.terminal
key:
The exec-arg
parameter must be changed to Guake's -e
. For the lazy:
gsettings set org.gnome.desktop.default-applications.terminal exec 'guake --new-tab'
gsettings set org.gnome.desktop.default-applications.terminal exec-arg '-e'
As is the case with most programming, solving the problem was extremely hard. I had to study a bunch about Bash variables, and how to use export
and source
(or the POSIX dot operator, .
), and how bash loads, and what interactive -i
bash mode was, etc etc.
I found man bash
and man test
to also be useful. Here's how to do what I want to do, which is:
- Write a script to open 3 tabs.
- cd into a different folder in each tab (ie: run a unique command).
- get each tab to have a unique title by modifying its local PS1 variable
- Ensure each tab stays open after the script is run
1st, add this to the bottom of your ~/.bashrc
file:
# Function to allow a user to arbitrarily set the terminal title to anything
# Example: `set-title this is title 1`
set-title() {
# Set the PS1 title escape sequence; see "Customizing the terminal window title" here:
# https://wiki.archlinux.org/index.php/Bash/Prompt_customization#Customizing_the_terminal_window_title
TITLE="\[\e]2;$@\a\]"
PS1=${PS1_BAK}${TITLE}
}
# Back up original PS1 Prompt 1 string when ~/.bashrc is first sourced upon bash opening
if [[ -z "$PS1_BAK" ]]; then # If length of this str is zero (see `man test`)
PS1_BAK=$PS1
fi
# Set the title to a user-specified value if and only if TITLE_DEFAULT has been previously set and
# exported by the user. This can be accomplished as follows:
# export TITLE_DEFAULT="my title"
# . ~/.bashrc
# Note that sourcing the ~/.bashrc file is done automatically by bash each time you open a new bash
# terminal, so long as it is an interactive (use `bash -i` if calling bash directly) type terminal
if [[ -n "$TITLE_DEFAULT" ]]; then # If length of this is NONzero (see `man test`)
set-title "$TITLE_DEFAULT"
fi
2nd, create this script to open 3 unique tabs with 3 unique cd commands and 3 unique titles:
open_tabs.sh:
gnome-terminal --tab -- bash -ic "export TITLE_DEFAULT='title 1'; cd ..; exec bash;"
gnome-terminal --tab -- bash -ic "export TITLE_DEFAULT='title 2'; cd ../..; exec bash;"
gnome-terminal --tab -- bash -ic "export TITLE_DEFAULT='title 3'; cd ../../..; exec bash;"
Now open up a terminal and run the open_tabs.sh
script:
./open_tabs.sh
Voila! It's magical! These 3 new tabs are now shown at the top of my terminal, and each has done the proper cd
command I set, and each has the proper title I set!
This will all be placed into my dotfiles project: https://github.com/ElectricRCAircraftGuy/eRCaGuy_dotfiles.
Full and final solution: see here: Open Terminal with multiple tabs and execute application
Best Answer
Did you read
guake --help
?