3

I've been using Ubuntu since 10.04, and seriously loving life. I'm on 12.04 and it's great.

As some super users would know:

gnome-open /home/username/somefile.txt

will open a window in gnome.

Is it possible to open a window and place it a corner of the window from the command line?

gnome-open /home/username/somefile.txt -top -left

(I know the command is made up) This would be the equivalent of opening the file and pressing Ctrl + Alt + 9.

Thank you all

Mochan
  • 1,688

1 Answers1

1

There's no real way of doing this with gnome-open itself, as it is impossible to pass geometry options to the program that will open your designated file.

The only feasible way to specify window geometry would be to set it beforehand in various profiles for your favourite programs by using devilspie, so that when you run

gnome-open ~/my.pdf

devilspie will load your profile for say evince, and set the window geometry as the window appears. If you are using compiz, see this question for how to specify window settings, as devilspie might not work with all window managers.

Devilspie can be installed from the repositories, and I discuss it in much more detail in this other question. In brief, the configuration file for the target program must be in ~/.devilspie and end in .ds. Below is an example of one tailored for gedit, labelled gedit.ds:

; gedit geometry

(if (is (window_class) "Gedit") (geometry "662x742+0+27"))

You will need to specify your own desired geometry that is appropriate for your screen, and put devilspie in startup applications. You can run killall devilspie and then devilspie & so that any configuration changes to files in ~/devilspie are re-read.