Nautilus window opens in wrong location on dual monitor setup
I use a dual monitor setup where the two monitors are above each other (both monitors 1920x1080px). The bottom monitor is set as the primary monitor.
Upon opening a new nautilus window the window geometry and position is read from gsettings. gsettings contains the correct coordinates for the window to open on the primary monitor (the bottom one) (e.g. top : 1300px, left : 300px, width : 600px, height : 500px). Though nautilus will always open its window in such a way, that approximately 100 pixels are visible on the top (secondary) monitor.
This is very disturbing as it prevents me from using nautilus efficiently. I always have to move the nautilus window after i have opened it.
I have had a quick look into the source code of nautilus on github. The problems seems to be in the method
sanity_check_window_position (int *left, int *top) in
eel-gtk-extensions.c. The following "sanity" check is performed:
gdk_monitor_get_geometry (gdk_display_get_monitor (gdk_display_get_default (), 0), &geometry); /* Make sure the top of the window is on screen, for * draggability (might not be necessary with all window managers, * but seems reasonable anyway). Make sure the top of the window * isn't off the bottom of the screen, or so close to the bottom * that it might be obscured by the panel. */ *top = CLAMP (*top, 0, geometry.height - MINIMUM_ON_SCREEN_HEIGHT);
gemotry.height is set to
1080px on my setup (because it is the height of one monitor). The window should open on the bottom monitor, so the
*top is currently set to
1300px from the gsettings. The "sanity" check will change top to
1080 - MINIMUM_ON_SCREEN_HEIGHT. This moves the window up to the secondary top monitor and opens the window on the wrong screen!
Instead of relying only on
geometry.height this sanity check should rely on the actual coordinates of the monitor.
Same problem may exists for the clamping of *left, though i have not tested / noticed a problem with left coordinate yet.