I am using Unity 2D with Compiz. And I want the workspaces button to trigger the expo view mode in Compiz. Can anyone help me?
The workspace button won't do the trick, but you can add to the launcher bar a custom button that will trigger the compiz Expo effect (thanks to Andrew from webupd8.org ).
Install xdotool (and compizconfig-settings-manager if you don't have it already) by typing in a terminal:
sudo apt-get install xdotool compizconfig-settings-manager
There is also a unity 2d tweak program, from which you can enable compositing and some other tweaks for unity 2d:
Start Compiz Config Settings Manager and set up your desired compiz effects and keyboard shortcuts. WARNING: Do NOT enable the desktop cube or the Unity plugins, as these will break the classic session. (enabling desktop cube disables all compiz plugins together with all their settings). Switching the compiz profile to "unity" instead of "default" inside the Preferences section of Compiz Config Settings Manager also breaks the classic session.
Make a expo.desktop shortcut to launch the following command:
xdotool key --clearmodifiers super+s
This will start the Expo effect. Replace super+s with the actual keyboard shortcut if you changed it. (And you can use the same procedure for other effects - I use also another launcher to trigger super+w, the Scale plugin)
You can also find a ready-made desktop file in the original post: http://www.webupd8.org/2011/05/create-custom-unity-launcher-to-trigger.html
For the record, Unity 2D should work with Compiz too. There very likely is some glitches here and there as the developers of Unity 2D do not spend time testing with Compiz but only with Metacity.
You can't. The whole point of Unity 2D is for use without Compiz. If you want Compiz support, use Unity 3D.
Use Unity 3D (instead of unity 2D, if you are using compiz).