How to properly start compiz in Gnome

In virtually every compiz tutorial you read on the net you will find the following advice on starting compiz when you log in:

Open System -> Preferences -> Sessions and add “compiz --replace” to the startup programs list.

That is wrong and it should be expunged from the internet IMHO. If you do that, your GDM will first start metacity, then start nautilus (desktop) and gnome-sesssion-manager, which in turn will start compiz. So you’re starting one window manager only to replace it with another shortly afterwards. You can see this clearly because it takes a while for compiz to start up and load your window decorator (like emerald) after replacing metacity.

The proper way to do this is to tell Gnome to use compiz as your default window manager and not use metacity at all. Simply put this in your ~/.gnomerc (create that file if it does not exist yet):

  1. export WINDOW_MANAGER=/usr/bin/compiz

Spread the word!

Creative Commons Attribution-ShareAlike

Comments

#1 Timo Hochberger

Thanks, worked for me.

#2 yochai (http://www.techcollective.com)

This is great. But one thing--- doesn't having fusion-icon running also restart the window manager yet again? do you know of anyway to have fusion-icon running (it has some perks) but without it restarting the window manager as it loads?

thanks

#3 Sander Marechal (http://www.jejik.com)

@yochai: Yes. Start it with “compiz-icon -n”. The -n switch will stop compiz-icon from reloading compiz when it starts.

#4 LeTic (http://www.letic.fr)

Hey mate, I knew about that tip that I am using on my work box for a while, but with pretty much the same configuration at home (sid, amd64, nvidia hardware, twinview) I can't get it to start automatically. I can start Compiz with no problem from fusion-icon but it won't start with the gnome-session...

An echo $WINDOW_MANAGER after logging show me the correct value, so my question is do you have any idea how to troubleshoot the gnome session logging ? I couldn't find anything in Xorg, gdm, or user logs, don't know where I can find a starting point.

Thanks in advance for any clue.
LeTic

#5 Sander Marechal (http://www.jejik.com)

LeTic: Take a look at your ~/.xsession-errors file. As for compiz not starting, try to figure out how you can start compiz manually. If you open a terminal and execute /usr/bin/compiz, does it start? Perhaps you need a different executable.

But you do need to start a window manager. I've tried putting e.g. compiz-manager as $WINDOW_MANAGER but that doesn't work. Perhaps in your case /usr/bin/compiz is just a wrapper around the real command that starts the compiz window manager?

#6 LeTic (http://www.letic.fr)

Hey Sander,

Didn't have the chance to go back to this with the silly season. I still can't understand this issue...

The content of .gnomerc is actually used as $WINDOW_MANAGER contains the good value, and when adding any commands inside the file, the results are displayed at the very beginning of the .xsession-errors file.

When I ran compiz manually, first thing during my session it starts with no problem.

I even installed snoopy to try to debug this and at no point it tried to run compiz.

There is no error message in the xsession-errors concerning this so I am a bit lost for words now...

The worst thing is, it is working perfectly fine on my work box.

I you have any more ideas...
Thanks for the help
LeTic

#7 LeTic (http://www.letic.fr)

Me again :o)

I uninstalled metacity to test and compiz is started with my session. But it is crippled : the window decorator isn't started and trying to run it manually doesn't work. Changing the settings in CCSM doesn't have any impact.

During that session I tried running compiz manually again and then it works fine...

There seems to be 2 totally different behaviour to my compiz, I wonder if it isn't taking its configuration from different places. I'm gonna try deleting all compiz configuration and see if it works.

I'll keep you updated
LeTic

#8 Sander Marechal (http://www.jejik.com)

It sounds like something strange is going on with that specific machine. As you said, it's working fine on your other machine.

The only thing that I can think of is that you have a setting somewhere that prevents users from specifying their own window manager. Perhaps there is some global configuration setting that tells GDM to ignore $WINDOW_MANAGER from ~/.gnomerc. Try setting $WINDOW_MANAGER globally somewhere under /etc, for example in /etc/gdm/gdm.comf? Perhaps that will work.

#9 LeTic (http://www.letic.fr)

I was working from home today so I got some time to solve my issue finally !

Here is the debugging I did after my last post. I hope this will help other people
- Put the .gnomerc in /root and test a gnome session from root -> it works
- Check with lsof which device/file were open when root was logged and check their permissions but my user already was in the video group
- Create a new dummy user, put him only in the video group and put the .gnomerc -> it works
- Follow the scripts from /etc/gdm/Xsession (first script executed in ~/.xsession-errors) with echo of relevant variables
- Check that there were no specific script in the home folders (.xsession, .profile etc)
- The above script exec several others that I followed as well (/etc/X11/Xsession.d/* and debug with echos to find any difference between my test user and mine
- When I was sure that all variable had the same value and that the scripts were running the same exectuable : /usr/bin/gnome-session (previously was x-session-manager) I started to look in the home folder
- I already tried to remove gconf folder as it the one holding the compiz config with no results, and check the x session script, so I tried to find a session file somewhere else.
- Found one in .gnome2/session
* the file contains 2 lines with metacity remove them -> end up with no window manager
* replace them with compiz works but the session crash at the end
* removing the file works !

So here it is. If compiz is not working when you have the .gnomerc file containing the correct export WINDOW_MANAGER line then you must have the same issue as I encountered. I have been upgrading my SID for years copying the home partitions when I was changing PC. So my home went through lots of different gnome version and end up with a broken .gnome2/session file. Just remove it and it will solve your issue :o)

I hope it can help user troubleshooting there gnome session if they have similar issue.

Hope you don't mind posting this here.
Thanks for the help mate
LeTic

#10 Sander Marechal (http://www.jejik.com)

Thanks for posting this LeTic!

#11 Oriol (http://www.eldiade.com)

Thanks pal, it worked for me! I'm already spreading the word.

#12 Anonymous Coward

Hi,

This is a great tip. I was wondering if the same goes for XFCE. I am using XUbuntu and I want to know whether creating the ~/.gnomerc file would work under XFCE or do I need a different file.

Thanks.

#13 Sander Marechal (http://www.jejik.com)

Maybe, if you use GDM to start XFCE, but it's probably a different file. Try asking the XFCE people. I've never used XFCE so I can't help you with that.

#14 Anonymous Coward

Well, I obviously did the reasonable thing of just trying it and it seems to work. It seems that XUbuntu uses GDM (found it on the UBuntu forums).

Thanks again for the tip.

#15 Charlie

Why not just change the desktop>gnome>applications>window_manager setting to "/usr/bin/compiz" ?

#16 Sander Marechal (http://www.jejik.com)

Charlie: I haven't tried that, but that could work just as well.

#17 svyatoslav

How would you do this with fedora 11?

I start compiz by using fusion fusion-icon

#18 Sander Marechal (http://www.jejik.com)

Svyatoslav, go to System->Preferences->Desktop effects and enable them. When you start fusion-icon, make sure to add the "-n" flag so it does not attempt to restart compiz again. See also comment #2 and #3 above.

#19 klarsen

It looks like newer versions of GDM are no longer sourcing ~/.gnomerc. Instead add the same line to ~/.xprofile.

#20 mr.Anonymous

- gconf key /desktop/gnome/applications/window_manager deprecated now
- export $WINDOW_MANAGER in ~/.xprofile... just only setting $WINDOW_MANAGER variable %)
solution: set gconf key /desktop/gnome/session/required_components/windowmanager = compiz.

http://en.gentoo-wiki.com/wiki/Compiz-Fusion#Gnome

#21 Photon

Thanks for your hint! It didn't work for me, though, I ended up without any window manager at all. But I found a solution here: http://wiki.archlinux.org/index.php/Compiz#GNOME Also for users of an nVidia graphics card: If you want to enable antialiasing in Compiz, do following:

1. Enable antialiasing in the nVidia settings
2. Create following startup script (let's call it compiz-start):

$ gedit /usr/bin/compiz-start

which contains following (you may experiment with the compiz start options, just read the above wiki.archlinux.org link):

------------------------------------
#!/bin/bash

nvidia-settings --load-config-only && compiz --replace --sm-disable --ignore-desktop-hints ccp

------------------------------------

4. Edit /usr/share/applications/compiz.desktop and choose the script as exec-file (replace the line "Exec=compiz ccp" with "Exec=compiz-start"

#22 Igor

Thanks a lot!
It really works!

#23 PC2st (http://pc2st.wordpress.com/)

Wooooooooow :)
I never could run 'compiz --replace' successfully neither 'fusion-icon -f'...
But your way is really work :D That's greet.
Thank you for the properly solution.

#24 jcp

Hy thanks for your tips! In my .xsession-errors (here you can find many things to clean up) I found that it was looking for /usr/bin/compiz.real (don't know why) so I did:
cd /usr/bin
ln ./compiz ./compiz.real -s
not elegant but works for me

#25 Marius Andersen

This method is outdated, according to the /usr/bin/gnome-wm script which does the actual work of reading the WINDOW_MANAGER variable. Instead, change the appropriate gconf value:

# gconftool-2 --set -t string /desktop/gnome/session/required_components/windowmanager compiz


This changes the window manager GNOME will use from "gnome-wm" to "compiz". In addition, one should make a /usr/share/applications/compiz.desktop file specifying the parameters GNOME should use for starting Compiz. It may look as follows:

[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Compiz
Exec=/usr/bin/compiz ccp  # make sure ccp is included
NoDisplay=true
X-GNOME-WMSettingsModule=compiz
X-GNOME-Autostart-Phase=WindowManager
X-GNOME-Provides=windowmanager
X-GNOME-WMName=Compiz
X-GnomeWMSettingsLibrary=compiz


If you are installing Compiz on Debian, then aptitude will create this file automatically. Just open it and make sure the Exec line includes ccp, otherwise the previous settings aren't loaded.

Finally, start the CompizConfig Settings Manager and ensure that the Window Decorator plugin is enabled.

Source: http://wiki.archlinux.org/index.php/Compiz

#26 trusktr

Actually, there is an *official* way to do this properly:

In Gnome, open up Configuration Editor (command: gconf) and set the key /desktop/gnome/session/required_components/windowmanager to "compiz".

And follow the exact instructions as described in the Arch Wiki.

Wait, the previous guy just mentioned this is a different way. hehe. Consider this confirmation. ;)

#27 Dario

I have tried the method described in the Arch Linux Wiki, the result is that i have no window manager at all. This happens every time i set to "compiz" the windowmanager key.
I have also tried to leave that key to the "gnome-wm" value and to set the environment variable WINDOW_MANAGER to "/usr/bin/compiz", in this way compiz starts but windows borders and the most of the effects are are missing. The "decoration" plugin seems enabled in Compiz Config. Does someone know how to fix?

#28 Anonymoose

I ran into the same thing with my Arch/gnome install, not sure if it's a gnome 2.32 thing or what. I finally gave up and started using fusion-icon there. The above method works fine for Debian though. The Arch wiki hasn't changed yet so apparently nobody knows or particularly cares.

#29 Baobab

here is how i could start automatically Compiz in Oneiric Ocelot without using "compiz --replace" in the startup apps :

edit the following file :
sudo vim /usr/share/gnome-session/sessions/gnome-classic.session


remove "notifications" at the end of line 4, said differently replace following line :
RequiredProviders=windowmanager;notifications;


by this one :
RequiredProviders=windowmanager;


retart the session, or reboot and it is done !

Note : check in the general parameters of Compiz :
- compatibility with Gnome
- Composite
- OpenGL
are all ticked !

#30 rocketman221

Cool! It still works with the gnome classic session on Debian Wheezy.
I have tried editing the "gnome-fallback.session" file which never worked.
Post a new comment

Registration is not required to post comments, but cookies must be enabled. One of the advantages of registration is that you can edit your comments later on (editing not yet implemented). You can register or login here.




Your e-mail address will not be published, but your website URL will. All links that you post will tagged rel="nofollow" to throw off spammers. You are allowed to use the following XHTML tags in your comment: <em> <strong> <u> <b> <i> <strike> <blockquote> <big> <small> <ul> <ol> <li> <a href=""> <pre> <code> <tt> <br>. Please allow up to 60 second processing time after you post a comment. Our spam filters may take some time.