Okay, that looks like an old answer and things aren't as bad in 14.04 as they once were. Yes, the monitor on the left is usually the primary monitor and it is set this way by default.
The unity desktop is actually called the ubuntu-desktop and the reason for this is because unity is actually a compiz plugin so you are actually using a compiz desktop. With that said, you can install compizconfig-settings-manager to achieve the settings you desire.
Either look for it in the ubuntu software center or open a terminal and execute the following commands to install it, whatever you prefer:
sudo apt-get update
sudo apt-get install compizconfig-settings-manager
After installation, search for ccsm in your apps or type the command:
ccsm
to start it up.
Now, click on "general options" and navigate to the "Display Settings" tab.
For the setting "Overlaping Output Handling" you can set which output device (monitor) is preferred as the primary monitor. You can set this to "smart mode" to automatically choose the primary monitor, to prefer the "larger output" (bigger screen) or "smaller output" (smaller screen).
Also, you can go down to where it says "outputs" if they are both the same size and you can click on either one of the outputs which will open the option to move the device up or down. You can also choose edit and you should be able to manually edit the dimensions to change one smaller or larger.
ccsm settings and standard desktop settings are sort of like state and federal law in the United States: federal law (ccsm settings) always trumps state law (standard desktop settings).
Best Answer
Only minimize windows on one screen
The script below can be used to (only) minimize windows on the left screen or only on the right screen.
The script is run with either
1
or2
as argument, depending on which screen you'd like to minimize the windows.The script
How to use
The script needs both
wmctrl
andxdotool
Copy the script into an empty file, save it as
min_screen.py
To run it:
to minimize windows on the left screen, and
to minimize windows only on the right screen
Notes
Unity
, but unlike workspaces (viewports), handling the screens should not make a difference.tkinter
windows for example). If that is an issue, please mention. Can be solved.Explanation
The script first looks up the right edge of the left screen, by looking up the string with
+0+
in the output ofxrandr
, looking like:The first section,
1680
, is the widht of the left screen. Subsequently, all we have to do is look into the window list (wmctrl -lG
) and see which of the windows is "below" or "above"1680
, and act accordingly, minimizing with the commandxdotool windowminimize <window_id>
(or not).Th "test" finally (
mmiz
):xprop -id <window_id>
is to check if we are dealing with a "normal" window (instead of e.g. your desktop, which is also listed as a window), and if the window is already minimized.See also the comment in the script.
Binding the script to a keyboard shortcut
1. On Lubuntu
To edit global keyboard shortcuts in Lubuntu see Lubuntu minimize all show desktop keyboard shortcut?
In this case: save script from this answer into a file on the computer, make this file executable, open
/.config/openbox/lubuntu-rc.xml
and replaceby
where
/path/to/show_desktop.py
is (of course) the path to the script, and either1
or2
the targeted screen. Make the script executable.Restart computer to reload config.
2. Unity/Gnome
Make the script executable and choose: System Settings > "Keyboard" > "Shortcuts" > "Custom Shortcuts". Click the "+" and add the command:
...to a shortcut of your choice