xfce4-terminal Automation
See also the larger blog post that spawned this: OpenBSD Blog #10: ksh profiles and startup automation
The xfce4-terminal
executable has a bunch of neat options that can assist in
scripting the setup of a terminal setup for a specific purpose or project.
The one I’m using right now is the command line option to open up a tab. I also have each tab run a command to do a different bit of setup to get my development environment ready for my current project.
The general form is:
xfce4-terminal --tab -T <title> -x <rest of line is command to run>
Which, if run within an existing xfce4-terminal window, will open a new tab, label it with the title, and then run the given command in that tab.
Here’s the lines from my actual shell script:
xfce4-terminal --tab -T 'Vim(Dev)' -x ssh -t deimos 'export DEV=ft1 ; ksh -l' xfce4-terminal --tab -T 'Error Log' -x ssh -t deimos 'export DEV=ft2 ; ksh -l' xfce4-terminal --tab -T 'SQLite' -x ssh -t deimos 'export DEV=ft3 ; ksh -l' xfce4-terminal --tab -T 'Ratf' -x ssh -t phobos
All four open SSH sessions. The first three set an environment variable DEV
,
which is checked in .profile
.
For the specifics of the SSH startup process and why I’m using an environment variable versus some other solution, see ssh-startup-commands.