An alternative is to use a program such as
devilspie to accomplish this. In case you've never heard of
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
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.
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
.ds file specifying you're Devil's Pie rule
$ cat ~/.devilspie/something.ds
(matches (application_name) "vim")
devilspie. I like to run it debug mode (
-d) to start.
$ devilspie -d
Devil's Pie 0.22 starting...
/etc/devilspie doesn't exist
1 s-expressions loaded.
$ 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
$ xlsclients -l|less
Icon Name: vim
Command: xterm -e vim
You can control a windows name like this:
$ xterm -title WeirdWindow -e vim