Diff for "Unity-ReplaceDodgeWindowsBehavior"


Differences between revisions 6 and 7
Revision 6 as of 2012-04-29 21:40:47
Size: 6457
Editor: cpe-76-186-247-50
Comment: Remove "link"
Revision 7 as of 2012-04-30 00:58:21
Size: 6456
Editor: cpe-76-186-247-50
Comment: Cleanup
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
So, I've been running Ubuntu 12.04 since around Beta 1, and one thing that really bothered me was the missing "Dodge Windows" behavior. I had gotten so particular and used to the behavior that it completely disrupted my workflow when I migrated over to Ubuntu 12.04. So, I've been running Ubuntu 12.04 since around Beta 1, and one thing that really bothered me was the missing ''Dodge Windows'' behavior. I had gotten so used to the behavior that it completely disrupted my workflow when I migrated over to Ubuntu 12.04.
Line 17: Line 17:
There are currently 2 methods to installing a custom Unity build. You can either use my PPA, which is easier, or you can build the patched Unity from source. Since the PPA method is much easier, it is currently the recommended method. You can choose either one, but '''not''' both. '''NOTE''': There are currently 2 methods to installing a custom Unity build. You can either use my PPA, which is easier, or you can build the patched Unity from source. Since the PPA method is much easier, it is currently the recommended method. You can choose either one, but '''NOT''' both.
Line 19: Line 19:
So, without further ado, let's get started. Open up a Terminal window and follow the steps below. So, without further ado, let's get started. Open up a terminal window and follow the steps below.
Line 186: Line 186:
When using this, do '''not''' delete anything in the ''staging'' folder. More specifically, do '''not''' delete the ''bin'', ''include'', ''lib'', and ''share'' folders. You will have unwanted side-effects (i.e. Compiz/Unity will keep crashing)! When using this, do '''NOT''' delete anything in the ''staging'' folder. More specifically, do '''NOT''' delete the ''bin'', ''include'', ''lib'', and ''share'' folders. You will have unwanted side-effects (i.e. Compiz/Unity will keep crashing)!

Replace Dodge Windows Behavior in Unity

So, I've been running Ubuntu 12.04 since around Beta 1, and one thing that really bothered me was the missing Dodge Windows behavior. I had gotten so used to the behavior that it completely disrupted my workflow when I migrated over to Ubuntu 12.04.

There has been a valiant effort to recreate this behavior: http://ubuntuforums.org/showthread.php?t=1936037. For the most part, the script works pretty well, but I wanted the "real" option back. In this bug report, #930148, one user, damianatorrpm (around comment #141), has created a couple patches that will revert the Canonical changes and re-add the behavior back to the source. I applied the patch to latest release of Unity (at this time of this writing, it's 5.12.0) and it works! Not only the behavior work as expected, the option is back in CCSM and has no nasty side-effects.

Another feature I really like is the ability to be able to click a program's icon on the Launcher and minimize/unminimize that window. Jonathan French (ojno), the developer behind this patch, has not only made this a reality, but also got this to work in conjunction with the 'Spread Windows' functionality. He's even set up a PPA which contains the latest Unity and his patch to make it easier for end-users to get it.

To make things easier, I've gone ahead and patched the vanilla Unity source to incorporate both of these behaviors. Furthermore, I've uploaded the changes to my Github. You can see this here: https://github.com/isaacj87/unity

The relevant commits are here:

NOTE: There are currently 2 methods to installing a custom Unity build. You can either use my PPA, which is easier, or you can build the patched Unity from source. Since the PPA method is much easier, it is currently the recommended method. You can choose either one, but NOT both.

So, without further ado, let's get started. Open up a terminal window and follow the steps below.

PPA Method (Recommended)

NOTE: If you used the alternative method originally, please remove ~/.compiz-1 and the 'staging' folder before using the PPA method.

Add the PPA

First, we'll need to add my PPA repository:

Code:

sudo apt-add-repository ppa:ikarosdev/unity-revamped

...after that, all we need to do is update our system:

Code:

sudo apt-get update && sudo apt-get dist-upgrade

...you're done! Simply log out and back in and enjoy.

Removal

If you'd like to revert back to the official Unity packages, simply use PPA-purge to revert back. First, let's ensure that it's installed:

Code:

sudo apt-get install ppa-purge

...then, we'll remove my PPA:

sudo ppa-purge ppa:ikarosdev/unity-revamped

Alternative Method (Compiling Unity from Source):

NOTE: I tried this on a fresh installed of Ubuntu 12.04 32-bit. I can't say for sure if it'll work on older or other versions.

Install the Dependencies

The first thing to do is to install all the dependencies needed to grab the source (from my Github) and build Unity:

Code:

sudo apt-get install git git-core

Code:

sudo apt-get build-dep unity

Getting the Modified Source

Now, we'll need a place to compile Unity. I usually like to create a folder called staging and dump everything in there. You're welcome to put the source wherever you like, but remember to change it accordingly for the tutorial:

Code:

mkdir ~/staging

...Now, we move into the directory:

Code:

cd ~/staging

Okay, the next step is to grab the modified source from my Github. While still in the staging directory, run this command:

Code:

git clone git://github.com/isaacj87/unity.git

Preparing Our Environment

Once it's done pulling the source, we'll need to prepare our environment to build. We'll create a simple bash script and make it executable:

Code:

gedit unity.sh

...When the blank gedit window opens, copy and paste the following text into the file:

Code:

PREFIX=/home/YOURUSERNAMEHERE/staging

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

You'll need to change YOURUSERNAMEHERE to your username. Once you've done that, save the file and close the window. Make the file executable and run it:

Code:

chmod +x unity.sh

Code:

./unity.sh

Build Unity

Okay, now let's build Unity! We'll need to create a build folder for the compile. Let's move into the Unity source directory and create that folder and move into it: Code:

cd unity

Code:

mkdir build && cd build

Now, we'll prepare the build, compile and install:

Code:

cmake .. -DCMAKE_INSTALL_PREFIX=/home/YOURUSERNAMEHERE/staging/ -DCMAKE_BUILD_TYPE=Debug -DCOMPIZ_PLUGIN_INSTALL_TYPE=local -DGSETTINGS_LOCALINSTALL=ON

(Once again, remember to change YOURUSERNAMEHERE to your username!)

Code:

make -j4

Code:

make install

Once that's finished, log out and back in. Ensure that Compiz Config Settings Manager (CCSM) is installed and go into the Unity plugin configuration. Turn on the Dodge Windows effect and it should work. Minimize an application to the launcher and click its icon again to unminimize it. If multiple windows of the same program are opened, the spread function should work as usual.

Warning!

When using this, do NOT delete anything in the staging folder. More specifically, do NOT delete the bin, include, lib, and share folders. You will have unwanted side-effects (i.e. Compiz/Unity will keep crashing)!

Removal

If you'd like to revert back to "stock" Unity, simply remove the ~/.compiz-1 folder and you should be back to normal.

Code:

rm -r ~/.compiz-1

Credits: Dodge Windows patch by damianatorrpm and Jonathan French (ojno) for the wonderful minimize behavior code.

Unity-ReplaceDodgeWindowsBehavior (last edited 2012-08-06 17:01:49 by cpe-76-186-247-50)