Automating windows arrangement on desktop

Recently, I have been working on the Debian NSLU2. During the process, I usually have at least three terminal windows opened in my Ubuntu PC. In the beginning, these terminal windows were randomly placed on the desktop, usually on top of each other and getting in the way. After awhile, I would have to manually resize and rearrange their positions to improve my productivity.

Then I thought why should I put up with this? What’s so great about the Ubuntu desktop is the instant ability to fix these annoyance. Within minutes, I did the following:

  1. creating a small script
  2. Add a launcher on the panel for the script
  3. Add a few settings to compiz
  4. Finally, a bit of trial and error adjustments

And this is the result. When I clicked the launcher icon for the script, I got three terminal windows neatly arranged.

Terminals

How this is done

The script:

#!/bin/bash

gnome-terminal --geometry=80x15 --title=nslu2-1 &
gnome-terminal --geometry=80x20 --title=nslu2-2 &
gnome-terminal --geometry=58x35 --title=nslu2-3 &

The geometry option is used to specify the terminal dimensions (in number of characters). The title option is used to temporarily allow compiz to identify each window as it opened. Note that the titles are not fixed; it will be changed to the current directory.

Next, the compiz settings. For this, you need to have CompizConfig Settings Manager (CCSM). Install it by:

sudo apt-get install compizconfig-settings-manager

Open CCSM via the Panel Menu:

System > Preferences > CompizConfig Settings Manager

Find the “Place Windows” plugin (somewhere near the bottom). Open the second tab “Fixed Window Placement”. Here is a screenshot (partially cropped, but showing the relevant part), together with the settings I used.

Terminals

Simple as that!

Post a Comment

Your email is never published nor shared. Required fields are marked *