2

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?

  • Which desktop environment are you using? (KDE, gnome, lxde, ...). A session manager can store and restore windows (with positions), but it depends on your desktop. – Giacomo Catenazzi Feb 12 '16 at 20:06
  • Oh right, forgot to mention it. I'm using Mate, so all Gnome stuff should work. – Ethan Leroy Feb 12 '16 at 20:12
  • 1
    it's been a while, but the old xterm utility used to take a -geometry parameter that let you specify a size and position – Jeff Schaller Feb 12 '16 at 20:41
1

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.

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.