An alternative is to use a program such as devilspie
to accomplish this. In case you've never heard of devilspie
:
excerpt
A window-matching utility, inspired by Sawfish's “Matched Windows”
option and the lack of the functionality in Metacity. Metacity lacking
window matching is not a bad thing — Metacity is a lean window
manager, and window matching does not have to be a window manager
task.
Devil's Pie can be configured to detect windows as they are created,
and match the window to a set of rules. If the window matches the
rules, it can perform a series of actions on that window. For example,
I can make all windows created by X-Chat appear on all workspaces, and
the main Gkrellm1 window does not appear in the pager or task list.
It should be in most distros' repos.
Example
So to center a xterm
window running vim
inside of it you'd do the following.
Make your Devil's Pie config. dir.
$ mkdir ~/.devilspie
Create a .ds
file specifying you're Devil's Pie rule
$ cat ~/.devilspie/something.ds
(if
(matches (application_name) "vim")
(begin
(geometry "600x400")
(center)
)
)
Run devilspie
. I like to run it debug mode (-d
) to start.
$ devilspie -d
Devil's Pie 0.22 starting...
Loading /etc/devilspie
/etc/devilspie doesn't exist
Loading /home/saml/.devilspie
Loading /home/saml/.devilspie/something.ds
1 s-expressions loaded.
Run our xterm
with vim
.
$ xterm -e vim

What's my window's name?
You can use the command xlsclient -l
to get a list of open windows. I find it the easiest way to determine a window's name for incorporation into devilspie
. You might also want to make use of xwininfo
too.
Example
$ xlsclients -l|less
...
Window 0x6800023:
Machine: grinchy
Name: vim
Icon Name: vim
Command: xterm -e vim
Instance/Class: xterm/XTerm
...
You can control a windows name like this:
$ xterm -title WeirdWindow -e vim
References