So I have a small script that is supposed to launch two terminal windows upon startup. I have added it to the startup applications and it is sitting in ~/.local/bin which exists in my $PATH. Here is the script:


sleep 5 &&

mate-terminal --geometry=87x47+0+0
mate-terminal --geometry=87x47+802+0

Now when I run it from an existing terminal or via Alt+F2 (Ubuntu Mate) it works properly (although the vertical dimensions do not go above 46 despite an input of 47). I would like it to "snap lock" between my top and bottom panels but it is close enough for now.

My main concern is that when I reboot, only the first window launches. The second window launches only after I have closed the first. Would it work if I were to send the first window to the background by adding a &?

1 Answer 1


You script is basically this:

sleep 5 && mate-terminal --geometry=87x47+0+0
mate-terminal --geometry=87x47+802+0

This means "wait five seconds, then launch the terminal, when that's done, launch the second terminal". "Done" here means the terminal have exited and given back control to the script.

What you probably want is

sleep 5
xtoolwait mate-terminal --geometry=87x47+0+0
xtoolwait mate-terminal --geometry=87x47+802+0

xtoolwait will return control to the rest of the script as soon as the X client that it is launching (the terminal) has mapped its window.

xtoolwait should be installed with your X server software, but if it's not, it ought to be available as a package from your ordinary distribution.

Failing that (it seems to have been removed as a Debian and Ubuntu package), you may use

sleep 5
mate-terminal --geometry=87x47+0+0 &
mate-terminal --geometry=87x47+802+0 &

to just start the terminals as background processes as you yourself suggested.

When I last cared about where on my desktop things appeared, some 15+ years ago, xtoolwait was part of the standard X11 distribution, if I remember correctly. Since then I've taken to running one application per virtual desktop, and rarely use anything other than a terminal with tmux and a browser.

I'm slightly surprised to see that xtoolwait is no longer part of the standard X11 package, but I assume the world will go on without it.

Just use & at the end of the commands.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .