3

I want to write a single bash script/configuration/whatever to open up multiple windows with a predefined arrangement by executing a single command.

For example, when I get notified about problems with the mail server, I want to execute connect_mailserver.sh which opens up a window-container containing

  • a window showing tail -f /var/log/mail.log
  • a window showing htop
  • a browser window showing all mail-related checks in Nagios
  • a shell for doing stuff on that server
  • ...

All the windows should be started in predefined positions but I should also be able to move and resize them.

I believe there are many elegant solutions for that, maybe with screen or emacs. Maybe there is a better tool for that? Do you have a similar solution?

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
Ethan Leroy
  • 161
  • 3

2 Answers2

2

Probably not as elegant as you may wish, but I'd use wmctrl for this.

xterm -T mail.log -e tail -f /var/log/mail.log &
until wmctrl -F -r mail.log -e0,<posx>,<posy>,<width>,<height>
do sleep .1s
done

Of course you may use other apps than xterm. wmctrl can only match window titles or window IDs. If you cannot set your window title, you'll have to find its ID by grep-ing the output of wmctrl -lp for the relevant PID.

L. Levrel
  • 1,453
  • 8
  • 23
0

Use

xterm -geometry 120x50+100+100 -e 'command'

The geometry parameter reads like this: LINESxCOLUMNS+XSTART+YSTART

If you want to find out the geometry parameters, open up several xterms, and start "xwininfo" in another, then clicking on the window you wish to know the geometry parameter of.

gerhard d.
  • 2,168
  • 12
  • 21