Comment 62 for bug 733349

Revision history for this message
André Desgualdo Pereira (desgua) wrote : Re: Minimize windows upon clicking application's launcher

I've made a script to workaround this issue. See at askubuntu: http://askubuntu.com/questions/36433/why-cant-i-use-the-unity-launcher-icon-to-minimize-applications-windows/39851#39851
See this working: http://www.youtube.com/watch?v=YfLxVsvUZTs .

**Simplified Instructions**

**1)** We will need <a href="http://apt.ubuntu.com/p/xdotool">XDoTool</a> and <a href="http://apt.ubuntu.com/p/compizconfig-settings-manager">Compiz</a>.

   You can install these from the *Ubuntu Software Center* or by clicking <a href="http://apt.ubuntu.com/p/xdotool">here (xdotool)</a> and <a href="http://apt.ubuntu.com/p/compizconfig-settings-manager">here (Compiz)</a>

**2)** Open Compiz (<kbd>Alt</kbd> + <kbd>F2</kbd> and type `ccsm` and hit <kbd>Enter</kbd>)

**3)** Go to Commands and add `~/.minimize.sh` to one command (for example command 8):

**4)** Then go to Button Binding and make a shortcut for it (for example alt+button1).

**5)** Now go to "General Options" and set a Button Binding to minimize (use the same modifier key of step "4" and Button2 - *if you want you can change the script as you like to fit another button*).

**6)** Make a file named .minimize.sh at your home folder (`gedit ~/.minimize.sh`). Paste this and save:

<pre>
#!/bin/bash
#
# by desgua
#
# To minimize a window with Unity
#
# note: it wont work if multiple windows
# from the same app are open
######################################
sleep 0.1
xdotool click --clearmodifiers 1
win=$(xdotool getactivewindow)
eval $(xdotool getmouselocation --shell)
xdotool mousemove -window $win 0 2
xdotool click 2
xdotool mousemove $X $Y
exit 0
</pre>

**7)** Make it executable.

**8)** Enjoy! ;-)