Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is one of those things that looks like it might have a simple solution but is rather time consuming once you start investigating PyTile, Xnee and the likes.

I know, I should just use a tiling window manager etc., but I suppose it can be done in an EWMH compliant window manager (like OpenBox), and I am just hoping somebody already has a working solution.

Ok, so I want to press a key combination while I am in an OpenBox session (Lubuntu LXDE to be more precise) and have my terminal appear below my then resized Chromium window (say ~60% Chromium and ~40% Terminal).

share|improve this question
up vote 1 down vote accepted

I have written a small script that puts Chromium at 60% of the screen, launches a terminal, and puts it under Chromium:


screen_width=` wmctrl -d | awk '{print $9}' | cut -d x -f 1`
screen_height=`wmctrl -d | awk '{print $9}' | cut -d x -f 2`

browser_height=$[$screen_height * 60 / 100 - $titlebar]
# unmaximize browser
wmctrl -b remove,maximized_vert,maximized_horz -r "$browser"
wmctrl -r "$browser" -e "0,0,0,$screen_width,$browser_height"

# start terminal and wait till its window has appeared
$terminal_cmd &
sleep 1

# put terminal under browser
terminal_top=$[$screen_height * 60 / 100 + $titlebar]
terminal_height=$[$screen_height * 40 / 100]
wmctrl -r :ACTIVE: -e "0,0,$terminal_top,$screen_width,$terminal_height"

You can change some properties (like the terminal and browser used, and the height of the window titlebar). Note that $browser is (a part of) the browser (window) title (like "Chromium", "Google Chrome" or "Firefox"), not the command to launch the browser.

In case you don't want Chromium to resize, it gets a little trickier, but it can be done by getting the window coordinates with wmctrl -G -l.

I don't know how to assign keybindings in OpenBox, and whether it works in that WM, but at least it works in Unity when I run it on the command line.

share|improve this answer
Excellent answer, thank you. – Erik Sep 17 '12 at 17:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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