How to set default display for new windows in Gnome 3

7,081

Solution 1

Kind of old question I guess, but I reckon there are more people with this problem.

I don't think there is a setting to open all programs on the primary display on Gnome.

But as a workaround you can enable workspaces only on the primary display, and make rules for all the programs you want to force to primary.

Start gnome-tweak-tool.

Workspaces -> Turn on "Workspaces only on primary display"

Extensions -> Turn on "Auto move windows"

Press the gear to enter settings, press "Add Rule", choose program and workspace number.

Make a rule for each program you want to display on primary.

Solution 2

TLDR (this solution comes with NO WARRANTY):

  1. Comment out or delete the <primary>yes</primary> line(s) in your ~/.config/monitors.xml file;
  2. Restart Gnome with Alt+F2rEnter;
  3. With the focus on the primary monitor, experiment launching the apps that were arbitrarily opening windows in the secondary monitory.

I've accidentally solved this problem in my dual monitor setup. Don't even understand why it worked, but it worked:

While inspecting the ~/.config/monitors.xml file, I mistakenly thought that both monitors were flagged with the <primary>yes</primary> entry. So I tried to fix what I thought was a bad config in what I tought was the entry for the secondary monitor, changing it to <primary>no</primary>. After restarting Gnome, it worked like a charm ―case solved! But later, when I was looking at that file again in order to write this answer, I've noticed that there were actually two configurations in it, each listing my two monitors, and only the built-in notebook monitor had the <primary> tag under it in both of them...

What I have actually done was:

<configuration> (currently in use)
  <logicalmonitor> (built-in display)
    <primary>yes</primary>  -->  <primary>no</primary>
    ...
  </logicalmonitor>
  <logicalmonitor> (external display, no <primary> tag)
    ...
  </logicalmonitor>
</configuration>
<configuration> (alternative)
  ...
</configuration>

I undid the change and (after restarting Gnome again) the bad behavior came back. Deleting or commenting out that line gives the same results as changing the yes to no. I would recommend to just comment it out.

Did some tests, it didn't break anything until now, as this specific setting isn't respected anyway. For example, without modifying the monitors file (with the built-in monitor flagged as "primary: yes"), the external display always ends as the primary monitor when I switch from "External Only" to "Join Displays" using the Super+P default keyboard shortcut.

In summary, it's a mess. But a bit less messier with this serendipitous solution.

Share:
7,081

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    I have 2 displays, a monitor and a TV. The first one I use all the time and it has set as primary in Gnome settings, but a TV is turned on only when watching movies from a sofa. Mainly, everything is going as expected, but some apps opens at the TV which is turned off at the moment, thus, I have to turn it on and drag window to the monitor and it happens all the time with a certain apps, i.e. qBittorrent.

    I spent a lot of time with Google but I failed to find a way to let all apps appear on primary display.

  • Francesco Casula
    Francesco Casula about 6 years
    Just tried on stretch with gnome shell, didn' t work. It keeps opening windows on the secondary monitor.
  • anders
    anders almost 6 years
    First of, did you do this: Workspaces -> Turn on "Workspaces only on primary display" ? Are you sure you have the correct screen as your primary screen? When you add the rule to 'Auto move windows' make sure workspace 1 is selected. When multi monitors are properly aligned and setup, everything opens up on the last screen I used it. Without using any extension. Try adjusting your display positions, try different things, corners of screen matching etc. If I redock my laptop, every screen(3 of them) shows everything just like it was before I unplugged it. Same when I open applications.
  • Paul Rougieux
    Paul Rougieux almost 4 years
    I do have Gnome "Tweaks/workspaces" set to "workspaces on primary display only" but still the evince pdf viewer always opens on the primary display when called from the command line, not from the secondary display. I find it's is rather the other setting "workspaces span displays" which helps displaying the file on the secondary display (when opened from the file explorer). I cannot also achieve this when pdf files are opened from the command line, after a restart of the shell.