Tweaking Ubuntu Unity To Show All Of An Apps Windows

In OS X, clicking on a dock icon shows all open windows for the app. In Ubuntu, clicking on a launcher icon only shows the most recently used open window. This is annoying if you want to copy files between two folders or view all Xpad note windows.
Read on to see how I modified and recompiled Unity to get the OS X like behaviour.

This has been reported as a bug here
A previous suggestion for how to change this is here
The above suggestion does not work for Ubuntu 14.04 Unity 7.2.
Using these instructions, I was able to figure out how to tweak and recompile Unity.

Warning: This is for advanced users only. Software updates can render the desktop unusable. To recover, Ctrl-Alt-F1, login, rm ~/.compiz-1/

1. Install the build dependancies.
sudo apt-get build-dep unity
sudo apt-get build-dep nux

2. Create a directory called /SourceCache/staging/ or /home/”username”/staging

3. In that directory create a script called unity.sh containing the following to set environment variables.

#!/bin/bash

PREFIX=/SourceCache/staging

export XDG_DATA_DIRS="$PREFIX/share:$XDG_DATA_DIRS"
export LD_LIBRARY_PATH="$PREFIX/lib/"
export PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig/"

4. Change the file permissions

chmod +x unity.sh

Execute the script once before doing builds.

5. In the staging directory:

apt-get source unity

6. There will now be a unity… directory in the staging directory where … is version information.

7a. Ubuntu 14.04 Open the file unity…/launcher/ApplicationLauncherIcon.cpp

or

7b. Ubuntu 16.04 Open the file unity…/launcher/WindowedLauncherIcon.cpp

8. Near the end of the ActivateLauncherIcon(ActionArg arg) method you will find the following lines:

else // #3 above
{
Focus(arg);
}

9. Change the code to the following and save:

else // #3 above
{
for (auto const& win : GetWindows(WindowFilter::USER_VISIBLE))
wm.Raise(win->window_id());
Focus(arg);
}

10. In the unity... directory

mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/SourceCache/staging/ -DCMAKE_BUILD_TYPE=Debug -DCOMPIZ_PLUGIN_INSTALL_TYPE=local -DGSETTINGS_LOCALINSTALL=ON
make -j4
make install

This builds Unity and installs it in ~/.compiz-1

11. Logout and login to use the custom version.

To go back to the standard Unity, remove the ~/.compiz-1 directory.

Updated June 7, 2016: Updated for Ubuntu 16.04

2 thoughts on “Tweaking Ubuntu Unity To Show All Of An Apps Windows”

Leave a Reply

Your email address will not be published. Required fields are marked *