4

When I'm developing software I normally have one terminal with various tabs open running different things, as an example one of them is running foo

whilst the other running boo

This is fine until I power down my PC and the layout is lost. This leads me to have a daily fumble around as I try to get to get everything setup. Is there a way to automate this?

Zanna
  • 70,465
Dr Goat
  • 43

1 Answers1

3

Yes, there is a way to automate it via -t and -e flags to gnome-terminal.

For instance, here's a script I've used quite recently for this question:

#!/bin/bash
gnome-terminal --tab -e "bash -c 'printf \"\033]0;TEST1\007\"; sleep 7'" \
               --tab -e "bash -c 'printf \"\033]0;TEST2\007\"; ping -c 4 8.8.8.8'"

What happens there is that there will be launched gnome-terminal window with two tabs , and each will run its own command. The rest is simple - open Startup Applications and add that script as one of the commands to be launched upon logging-in. Remember to make the script executable and give full path to script as a command.

Sergiy Kolodyazhnyy
  • 105,154
  • 20
  • 279
  • 497
  • The tabs automatically close after the command is done :/ – Dr Goat Dec 21 '16 at 20:32
  • @DrGoat you want to keep the tabs open ? In that case make it `-e "bash -c 'foo; bash'" That way once command is done, it will drop to new instance of shell. Unlike other terminals, gnome-terminal doesn't have "hold window" option, so you have to use a bit of trickery to keep it open – Sergiy Kolodyazhnyy Dec 21 '16 at 20:59
  • @serg gnome-terminal has a "hold window" option. Go to Edit -> Profile Preferences -> Title and Command -> When command exits -> set to "Hold the terminal open". – wjandrea Dec 22 '16 at 05:09
  • @wjandrea That causes often unintended side effects though, e.g. you can no longer close a terminal window by exiting the shell with exit or CTRL+D. – Byte Commander Dec 22 '16 at 08:56