This guide has been written by WebUpd8 reader Neil Rodgers and it shows how to create your own standalone Compiz session in Ubuntu (the instructions below are for 11.10, but they may work in other Ubuntu versions). Using a custom Compiz session gives you flexibility to load only what you want, so you can get a lightweight session, while still using Compiz.
In the screenshot above you can see Unity 2D panel, Dockbarx (dockx), slingshot-launcher and Compiz drawing the wallpaper. But of course, there are many different combinations of docks, panels, etc. you can use to create your own environment. I chose to mimic Unity. Don't ask why. I love using Unity, like to tinker and was bored one night.
Things I've installed:
sudo apt-get install compizconfig-settings-manager compiz-plugins-extra
sudo add-apt-repository ppa:nilarimogard/webupd8 sudo apt-get update sudo apt-get install dockbarx dockbarx-themes-extra
Marlin (we'll use Compiz set to draw the background, but you can skip this if you want):
sudo add-apt-repository ppa:marlin-devs/marlin-daily sudo apt-get update sudo apt-get install marlin
If you want to use DockX, you'll also need a menu. You can use Cardapio, a menu Indicator or Slingshot launcher. To install Slingshot, use the commands below:
sudo apt-add-repository ppa:elementaryart/unstable-upstream sudo apt-get update sudo apt-get install slingshot-launcher
1) As explained here, the first step is to create the Compiz xsession. This will create a session called Compiz in your session list in LightDM.
gksu gedit /usr/share/xsessions/compiz-session.desktop
You now have an empty file. Copy and paste this code into it:
[Desktop Entry] Name=Compiz Comment=This session logs you into Compiz standalone Exec=/usr/local/bin/compiz-session Type=Application
You can call this session whatever you like by changing Name=Compiz to Name=(your custom name) in the code above. Save and close the file when you are done.
2) Now we will make the compiz-session launcher in /usr/local/bin. This launcher will start the compiz-session with dbus.
gksu gedit /usr/local/bin/compiz-session
Then copy and paste this code into the file:
#!/bin/bash if test -z "$DBUS_SESSION_BUS_ADDRESS"; then eval `dbus-launch --sh-syntax --exit-with-session` fi compiz --replace ccp & wmpid=$! sleep 1 if [ -f ~/.compiz-session ]; then source ~/.compiz-session & else xterm & fi # Wait for WM wait $wmpid
Save and close this file then make it executable using the command below.
sudo chmod 755 /usr/local/bin/compiz-session
3) The above code mentions the file ~/.compiz-session. This file will be read at the start of your Compiz session and will load whatever commands you put in it. We need to create it and choose what we want to load in our session. This will be a hidden file in your home folder. This is where you can get creative and piece together different components to make something unique.
Or right click on an empty spot in your home folder and choose create new file. This is what I have in mine.
#!/bin/bash gnome-settings-daemon & unity-2d-panel & nm-applet & bluetooth-applet & dockx &
The first entry for gnome-settings-daemon will load all your system settings and themes etc. Then we have our panel, network manager, bluetooth and finally our dock. Put what you want in here (for instance, to use Nautilus for drawing the background, add "nautilus -n &"; instead of "dockx" you can use "avant-window-navigator" for instance, and so on) then save and close.
4) Now we can log out and try the new session but before you do make sure you keep reading so you know what to expect. Save this guide in your home folder so you can get back to it after logging in. When you first log in you'll notice your panel and dock will load with a black, sometimes glitchy looking screen as your wallpaper. We'll fix this but first lets take a few seconds to tweak DockBarX. Right click on an empty spot in the dock and choose "Properties". You can modify whatever other settings you like but these will give you the Unity launcher clone:Dock:
- Type = panel
- Position = left
- Behavior = panel
- Size = 42
- Offset = 24
Appearance - Theme = unite_v
Window List: uncheck previews if it is checked as they don't seem to be working
Plugins: make sure Unity quicklists and badges are checked
5) Ok, now onto the glitchy black background. This is because Nautilus handles the desktop and wallpaper and we didn't load it in the session. You can add it to the .compiz-session file if you want or you can have Compiz draw the wallpaper (if you use desktop icons or have to have the right click menu on the desktop then stick to loading nautilus). To start CCSM open a terminal by pressing "Ctrl+Alt+t" and type "ccsm" to launch CompizConfig Settings Manager. Add it to your dock for now (right click the icon and select "pin to launcher".
Optional step: Create a custom profile for your session in CCSM. Compiz will load with the "default" profile which is used for other sessions such as Gnome fallback or even Unity2d if you run it in that environment. If you just use Unity3d then you don't need to do this because Unity3d automatically loads the "Unity" profile and your changes in CCSM will not affect that session.
Activate the jpeg, png, svg and text plugins in the "image loading" CCSM section. Now activate the "wallpaper" plugin under "utilities", choose "new" and select a background (don't select the default Ubuntu wallpaper, it's not an actual .png and it will fail to load; if it doesn't load right away it will on the next login,more on logging off in the next step).
Now setup slingshot-launcher by enabling "commands" and entering "slingshot" (no quotes) in an empty field. Choose your preferred keys or screen edge or both. I made mine open gnome-shell style by setting the edge binding to the top left corner so it launches with the mouse (I've also created a launcher with an Ubuntu icon that launches slingshot and added it to my dock).
To get Slingshot not to overlap with the top panel or dock, open CCSM, make sure the "Place Windows" plugin is enabled, then on the "Fixed Window Placement" tab, under "Windows with fixed position", click new and under "Positioned windows" enter "class=Slingshot" (without the quotes), 50 for X Position and 25 for Y Position (you can change these if these values don't look ok for you).
Now maximize a window and you'll see that it's titlebar doesn't merge with the unity2d panel. Fix this by going to Effects > Window decoration > Decoration windows and changing "all" to "!state=maxvert". Now tweak whatever else you'd like and we'll move to the next part.
6) If you try to log off the normal way through the shutdown menu it doesn't work. Its made to log out of a gnome-session, not a compiz-session. So we can work around this a couple ways and I'm sure there are more, but the first is pretty straight forward. Kill the compiz-session process. You can do this via system monitor or by typing "pkill compiz-session" (again no quotes) in a terminal. There is a script I've found here, in comment #8 that also works. You can even make a launcher that points to the script or runs the pkill command and add it to DockBarX if you want.
This is the first guide I have written about anything so please excuse me if there are mistakes or its hard to follow. I'm also not an expert with using Ubuntu and or Linux but love using it and love the choice it offers. Feel free to offer suggestions, corrections or any other feedback. Thanks! - Neil