Fedora 17, Gnome 3, Windows disappear on undocking -- xrandr workaround

The behavior of Gnome 3 with more than one monitor is a bit counterintuitive, at least for me.

Depending on the value of

gsettings set org.gnome.shell.overrides workspaces-only-on-primary


you get one of two behaviors. If this variable is set to "true" (default) then however many workspaces you may happen to have on your "main" monitor, you always get and see the same workspace on the external monitor. So you as you navigate up and down on the main monitor, what you see on the external monitor never changes.  So you get N + 1 workspaces, where N is the number on the main monitor and the 1 neverchanging workspace lives on the external monitor.

If, on the other hand, this variable is set to "false", than you get just as many workspaces on the external monitor as you do on your main monitor and they move in tandem or lockstep as you navigate through your dynamic workspaces. You can also obviously drag windows back and forth between workspaces. (I actually haven't done the experiment as to what happens if the variable is set to true and a window straddles the two workspaces - that would be interesting.) So this is more like N + N workspaces.

Another odd thing is that the workspace preview or "pager" window only shows the main workspaces but never shows the extra ones. To me this feels like a bug, but one that has yet to be addressed and there is no workaround as far as I know.

By toggling this config variable you can get the behavior that more nearly matches your workflow.

But how about the following scenario? You're happily working away while docked (or with an accessory monitor plugged in) and then you undock. The windows that were on the external monitor are lost and there is no way to induce them to come back (I've tried). But it's even worse than that (because after all you could have simply manually dragged them all back prior to undocking). Certain applications seems to "remember" where they last opened their windows or accessory windows and persist in opening them in the now non-existent, non-viewable and inaccessible workspace!

How to handle this? I found a script on a email discussion at work that basically allows you to use xrandr to inform the X windows system that the external monitor has gone away and to presume that the main monitor is now the only one. The exact monitor names may vary (I just ran xrandr without any arguments to discover what would work for me but if you write an undock script that looks something like this:


#!/bin/sh
xrandr --output LVDS-1 --mode 1600x900
xrandr --output VGA-1  --off
xrandr --output DP-1   --off
xrandr --output DP-2   --off
xrandr --output DP-3   --off



prior to undocking, then all your windows will behave as you would like them to.

Addendum: Maybe I'm making this too complicated. Having a script is always nice but on the other hand you can always go to system settings | Display and just turn the external monitor on | off if you want to handle this from a GUI. Amounts to pretty much the same thing.

Newer Addendum: There was still a case when waking up the laptop from sleep the external display would "think" it was connected as judged by the xrandr output but no signal was being received on the monitor and it was stay blacked out.  Repeat invocations of xrandr would not fix this. Resetting the X server would (Ctrl-Alt-Bkspace) but this killed all running X apps. It seems now that opening a pseudoTTY (Ctrl-Alt-F2) and then going back to the X display (Ctrl-Alt-F1) seems to reset the X server enough to sync all the monitors back but without killing any X apps.

Comments

Popular posts from this blog

Hit failing alternator with a hammer to confirm diagnosis of failing alternator due to bad brushes

alternatives --install gets stuck: failed to read link: No such file or directory

Using SSH, SOCKS, tsocks, and proxy settings to create a simultaneous "dual use" work/home computer