3

Trying to open nautilus in a fixed position from a script, but it looks like there is a bug with the "--geometry" option. So my question, does anyone know of another way to force the nautilus window position to a specific size and placement?

My script is going to be tied in with a bit of python to create an old school midnight commander type feature. This is a project of mine, so I'd like to build my own rather than use something already built.

Thanks for the help in advance...

2 Answers2

2

Instead of specifying --geometry parameter, try specifying it with -g parameter. If it still doesn't work, I would consider this a bug.

An alternative to using the nautilus' native --geometry parameter, would be to use wmctrl , which can be used to control any other type of graphical window. This app doesn't come by default, so you have to download it with sudo apt-get install wmctrl.

The command to position and scale the window would be wmctrl -r WINDOW_TITLE -e 0,XOFFSET,YOFFSET,WIDTH,HEIGHT. I've used this method on another question, to position two terminal windows with specific size and location (refer here)

Another , slightly better way , is to find out window id (a hex number) with xprop or wmctrl itself, and use that with -i -r parameters. Title of the Nautilus window changes as file folder changes, so this would be slightly more reliable.

Let me know if you'd like me to elaborate more on this.

Sergiy Kolodyazhnyy
  • 105,154
  • 20
  • 279
  • 497
  • Thanks for the information on this. I have been looking for something similar and have finally figured out a way to script the opening and placement of two nautilus windows using a bash script. I was able to pull the window ids and make the placements needed.

    As a side note, this also works on Arch.

    – Kent Seaton Jun 29 '15 at 03:10
0

Similar to Serge's answer this works for me:

nautilus && sleep .1 && wmctrl -Fr "Home" -e '0,3633,1605,930,514'
  • sleep .1 (sleep for 1/10th second for nautilus startup time) is how fast my system works. You might try sleep 1 or sleep 2 and work your way down.
  • Home is the name of my Nautilus window. If your nautilus opens to a different location the title bar window name will be different. In that case use it instead.
  • 3633,1605 is 3633 pixels to left and 1605 pixels down on my system. You can start at 300,200 for your system and increase appropriately.
  • 930,514 is 930 pixels wide and 514 pixels high for the nautilus window on my system. Yours might be 400x300 or something in between. Experiment to your preferences.

You need wmctrl to make this work:

sudo apt install wmctrl