Compiz-Switch is a simple program to switch Compiz off and on easily.

If you are looking for a simple yet effective way to switch between Compiz and the window manager of your desktop environment, then this is for you.
Compiz-Switch provides this on a single click.
- If Compiz is running, it will switch to the default window decorator of your desktop environment.
- If Compiz is not running, it will be launched immediately.
There is no need to compile anything and the only dependency is a GNOME, KDE or Xfce environment with a running version of Compiz.
Available versions
-
Ubuntu (this includes Kubuntu and Xubuntu)
compiz-switch_0.4.3~ubuntu-1_all.deb
Compiz runs differently on Ubuntu 10.04 Lucid Lynx.
I don't have the time to upload a new package right now, but here's how you can fix the script after you have installed the deb above on Lucid:sudo sed 's/\.real//g' -i /usr/bin/compiz-switch -
Compiz compiled from (git) source (any distribution)
compiz-switch-0.4.0~source.tar.gz -
Suse
compiz-switch-0.4.0~suse.tar.gz
If you'd like to have a version for your distribution as well, please go here.
Installation
If you are on Ubuntu, all you need to do is download the deb linked above and double-click it afterwards.
For other distributions, first download and extract the archive – e.g. for the "source" version, do
wget http://blogage.de/files/3531/download -O- | tar -xzf -
Then change to the extracted folder (directory depends on the version you downloaded):
cd compiz-switch-0.4.0~source
Now you can choose between the usual way to install and checkinstall. The latter will install a basic deb-package that you can remove via apt-get or Synaptic/Adept. (This should also work for Suse/rpm.)
For Compiz compiled from source it's best to install via make install.
Usual way (make install)
All you need to do is (make sure you are root when not using sudo):
sudo make install(there's no nee to 'make' anything first)
Do not remove the folder afterwards – you'll need it, in case you want to remove Compiz-Switch again.
In order to do so, navigate to the directory again and run:
sudo make uninstallCheckinstall
First you need to install checkinstall itself:
sudo apt-get install checkinstall
Then use this command to install:
sudo checkinstall
Usage
After you installed Compiz-Switch it should show up in the menu under:
GNOME
Applications → Accessories → Compiz-Switch
KDE
K-menu → Utilities → Compiz-Switch
Xfce
Applications → Accessories → Compiz-Switch
Panel icon
- If you want the icon to show up in the panel, all you have to do in GNOME and KDE is drag & drop the icon from the menu to the panel.

- For Xfce this is unfortunately a little more complicated, because it doesn't support d&d for that. Here's a little workaround:
- First run Applications → Accessories → Appfinder
Then do a right-click on the panel and choose Add New Item in the context menu and double-click Launcher.
Now you can drag & drop Compiz-Switch from the Appfinder in the field with the New Item icon.
Finally remove the New Item entry and choose Close.
Additional options
To get a list of all available options, run:
compiz-switch --helpKill and restore Screenlets along with Compiz
Version 0.4 supports quitting all running Screenlets when switching off Compiz.
There are two options available how to restore them, when running Compiz again (use only one of them at a time, of course):
- Restore exactly the Screenlets you were running before
Add the-sargument when using Comiz-Switch to use this:compiz-switch -s - Restore only the Screenlets you added to you autostart programs
(usingscreenlets-manager) – the argument for that is-sa:compiz-switch -sa
Use the icon as a status icon (experimental)
When adding the -c argument, the icon for Compiz-Switch will change according to the status of Compiz
compiz-switch -c
This seems to work only in the GNOME panel, if you stored a starter for Compiz-Switch there.
You can, of course, use multiple arguments at a time, e.g.
|
Previous Versions
-
Ubuntu (this includes Kubuntu and Xubuntu)-
compiz-switch_0.2.0~ubuntu_i386.deb -
compiz-switch-0.2.0~ubuntu.tar.gz -
compiz-switch_0.4.0~ubuntu-1_all.deb - compiz-switch_0.4.1~ubuntu_all.deb
-
-
Compiz compiled from (git) source (any distribution)
compiz-switch-0.2.0~source.tar.gz -
Suse
compiz-switch-0.2.0~suse.tar.gz
Icon Design
By gavintlgold, also founder of FusionCast.
Trackbacks
No trackbacks, yet.
thanks man. just the thin iv been looking for:)
[quote]Under my XFCE desktop, your script switch between compiz and... kwin :-( Maybe a problem to detect the current desktop environment ?[/quote] That's because I couldn't find a way to detect the DE in use - so instead of that, the program checks which window manager is installed, in that order:
Metacity (GNOME)
Kwin (KDE)
Xfwm (Xfce)
You have obviously kwin installed, that's why it launches that one instead of xfwm4.
I'm working on a workaround and I think I have found one this very minute. Please check again later for an update.
As for checkinstall: I always considered it somewhat hacky but I guess there's no harm adding it to the Install section.
Thanks for the feedback.
Cool, i have recorded a video, it's in youtube; it's not very useful but it's something =).
Excellent wee app - works wonderfully with Linux Mint KDE edition 4.0 Daryna.
Great work, thanks!
I always searched for something like this ... I only miss one feature ... automatically disable compiz when running a laptop on battery and automatically switch compiz on when running on AC.
Excelent!
I was looking for this.
Thanks.
Thanks a lot for this useful app!
That is cool. At first, I thought it was a clone of fusion-icon, but now I realise this closes compiz if it's running, and it opens it if it's not, and that's it. Thanks for this.
Can I find a similar script for turning XGL on and off? I've got an ATI graphics card, and this would make running games a lot easier.
I wrote my own script for this this but this is a much better package.
Excellent application! Try to get this into the compiz package repository!!!
Great little script, thanks for sharing. I noticed that it doesn't seem to work with more than one user running compiz at the same time. To get it to work, I replaced line 36 with this:
COMPIZ_RUNNING=`ps -u $USER | grep $COMPIZ_BIN | awk '{print $1}'`
AFAIK, the $USER environment variable should always be set. I also changed
killall $COMPIZ_RUNNING
to
kill $COMPIZ_RUNNING
in the switch to xfwm4 section, but as I don't have xfce, that is totally untested. I hope this helps anyone that has multiple compiz users on their computer.
thx man for sharing this.
really usefull script!
i installed with the deb. I'm using eeeXubuntu it works really well. Thanks man!
Every time I try to download either the .deb package or the source, I get a 404 error. Am I missing something?
Just what I was looking for and tested in Ubuntu Hardy Heron beta with the stock desktop effects.
Works like a charm :D
I'd second the feature of automatically disabling Compiz when a laptop switches to battery power, but I think that will need to be implemented by Gnome Power Management etc.?
p.s I'll let others know about this on my site soon :)
Yeah, I think it's generally time for an update. I have a working version on my computer with the ability to kill Screenlets with Compiz and restore them when switching to Compiz again.
As far as I know, I just failed to configure this correctly when making the deb package, because the architechture shouldn't be relevant at all.
I'll look into this.
On my ubuntu hary installation it switches compiz off, but not on.
I have just uploaded the new version (the deb package should be suitable for all architectures now).
Please try again with this one.
I have the same trouble as Stefan, right after installing (0.4) it would only work to switch compiz on. And now after a reboot it only works as a restart button for metacity. What I noticed though is that the compiz-switch command is still running in the console after the switch is complete. I kinda thought it was supposed to terminate itself and thus be super memory slim ^-^
Basic state after X starts is: Compiz is activated
1st time:
diddl@ubuntu:~$ compiz-switch -o
/usr/bin/compiz-switch: line 233: [: too many arguments
Checking for Xgl: not present.
Detected PCI ID for VGA: Flags: bus master, VGA palette snoop, stepping, fast Back2Back, 66MHz, user-definable features, ?? devsel, latency 0
Flags: bus master, VGA palette snoop, 66MHz, medium devsel, latency 64
01:00.0 0300: 10de:0402 (rev a1) (prog-if 00 [VGA controller])
Checking for texture_from_pixmap: present.
Checking for non power of two support: present.
Checking for Composite extension: present.
Comparing resolution (1680x1050) to maximum 3D texture size (8192): Passed.
Checking for nVidia: present.
Checking for FBConfig: present.
Checking for Xgl: not present.
((at that point I do not get back the console prompt and I do a ctrc-c))
((which then goes on to crash compiz whereupon I go Alt-Tab-1 and kill compiz so that gnome starts metacity as a fallback))
((after switching back I can see this in my console window where i issued ctrl-c))
*** glibc detected *** /usr/bin/compiz.real: double free or corruption (!prev): 0x000000000078f8a0 ***
--------------------------------------
2nd try (after restarting X)
This time I will issue the second compiz-switch -o in a new console window :)
diddl@ubuntu:~$ compiz-switch -o
/usr/bin/compiz-switch: line 233: [: too many arguments
Checking for Xgl: not present.
Detected PCI ID for VGA: Flags: bus master, VGA palette snoop, 66MHz, medium devsel, latency 64
01:00.0 0300: 10de:0402 (rev a1) (prog-if 00 [VGA controller])
Checking for texture_from_pixmap: present.
Checking for non power of two support: present.
Checking for Composite extension: present.
Comparing resolution (1680x1050) to maximum 3D texture size (8192): Passed.
Checking for nVidia: present.
Checking for FBConfig: present.
Checking for Xgl: not present.
((opening 2nd terminal prompt))
diddl@ubuntu:~$ compiz-switch -o
/usr/bin/compiz-switch: line 233: [: too many arguments
Checking for Xgl: not present.
Detected PCI ID for VGA: Flags: bus master, VGA palette snoop, 66MHz, medium devsel, latency 64
01:00.0 0300: 10de:0402 (rev a1) (prog-if 00 [VGA controller])
Checking for texture_from_pixmap: present.
Checking for non power of two support: present.
Checking for Composite extension: present.
Comparing resolution (1680x1050) to maximum 3D texture size (8192): Passed.
Checking for nVidia: present.
Checking for FBConfig: present.
Checking for Xgl: not present.
Thanks Deeta, now I need your output of
ps -o comm= -C compiz.real
when Compiz is active and also when it's not running.
Just want to confirm the bug by Deeta. When I installed compiz-switch on hardy, the same thing happened. I think this has something to do with Hardy (or gnome) trying to preserve the state it was in (i.e Compiz or No Compiz). So when I using compiz and ran compiz-switch, compiz-switch attempted to change to metacity, but it just lagged a bit (window borders disappeared) and then compiz restarted.
nice easter egg by the way.
ZOMGxuan, I need the output of the above mentioned command to fix this -- because it works flawlessly on my Hardy install and I'm a little clueless right now, what fails for you guys there.
((when compiz is running after booting))
diddl@ubuntu:~$ ps -o comm= -C compiz.real
compiz.real
((pretty unspectacular.. hope that is what you were looking for))
((switching to metacity by using 'no desktop effects'))
diddl@ubuntu:~$ ps -o comm= -C compiz.real
compiz.real
((same outsput... strange... but yeah compiz seems off, no desktop zoom, no wobbly windows.... ))
((just switched compiz on again and noticed something weird))
diddl@ubuntu:~$ ps -o comm= -C compiz.real
compiz.real
compiz.real
((despite my lack of gnu/linux knowledge I feel the vibe of wonky hardy configuration of my compiz... this means it does not really terminate when I shut compiz down, aye?))
Aha! That is weird and obviously a bug in Hardy.
The question is, whether I should work around it or not...
I will try to reproduce this here somehow.
Thank you very much for the feedback.
@ZOMGxuan: can you confirm that on your system?
And are you using a Nvidia card too?
With the help of the Zorael in the Ubuntu Forums I have created a pretty dirty hack. Not that it will appeal to anyone but me, but at least I can switch compiz off and on now without slowing my system to a crawl :D
Here it is:
#!/bin/bash
while true;
do
if [ "$(pidof compiz.real)" ] && [ "$(pidof metacity)" ];
then
killall --signal=9 compiz.real
echo CompiZombie detected and terminated
sleep 2s
else
sleep 2s
fi
done
Hi,
thanks for this little app, it's very usefull. I have only one problem, if I use only 'compiz-switch', I have to run it 4 times, to change really from compiz to metacity, and to go back to compiz only once is necessary. If I put the '-o' at the end it works perfectly.
Thanks
dell XPS M1330 + Ubuntu 8.04 LTS + compiz-switch 0.4.1
I still have the same problem with 0.4.1 as with 0.4.0.
(of course I stopped my script before trying :)
The output has a variation in a slightly minor way though. (different line and error message in the beginning)
diddl@ubuntu:~$ compiz-switch -o
/usr/bin/compiz-switch: line 239: [: compiz.real: unary operator expected
Checking for Xgl: not present.
Detected PCI ID for VGA: Flags: bus master, VGA palette snoop, stepping, fast Back2Back, 66MHz, user-definable features, ?? devsel, latency 0
Flags: bus master, VGA palette snoop, 66MHz, medium devsel, latency 64
01:00.0 0300: 10de:0402 (rev a1) (prog-if 00 [VGA controller])
Checking for texture_from_pixmap: present.
Checking for non power of two support: present.
Checking for Composite extension: present.
Comparing resolution (1680x1050) to maximum 3D texture size (8192): Passed.
Checking for nVidia: present.
Checking for FBConfig: present.
Checking for Xgl: not present.
((at that point it again does not return to the command prompt))
Please try again with the latest version. The problem is, I'm tapping around in the dark here as I can't reproduce any of your problems.
I have scrapped the -o argument in the latest version, because s² seems to have problems with it -- and Deeta, trust me the script is not running anymore (you can check that in 'ps -A') once the switch is done (the window manager you switched to takes over).
But to avoid this confusion I tweaked the switch a bit, so now you are able to use the terminal prompt after the switch (it's not visible when switching to Compiz but it works nonetheless).
www=wobbly windows working ^-^
!www= no wobbly windows
((fresh boot: www, so lets try to turn em off))
diddl@ubuntu:~$ compiz-switch
((!www, success... now for trying to turn them on again))
diddl@ubuntu:~$ compiz-switch
/usr/bin/compiz-switch: line 220: kill: compiz.real: arguments must be process or job IDs
((!www, failure :-/, lets confirm it))
diddl@ubuntu:~$ compiz-switch
/usr/bin/compiz-switch: line 220: kill: compiz.real: arguments must be process or job IDs
((!www, failure :-/, yet again ))
diddl@ubuntu:~$ compiz-switch
/usr/bin/compiz-switch: line 220: kill: compiz.real: arguments must be process or job IDs
((!www, failure :-/, yeah I am stupid for trying again ^-^ ))
diddl@ubuntu:~$ pidof compiz.real
6251
diddl@ubuntu:~$ killall -9 compiz.real
diddl@ubuntu:~$ compiz-switch
diddl@ubuntu:~$ Checking for Xgl: not present.
Detected PCI ID for VGA: Flags: bus master, VGA palette snoop, 66MHz, medium devsel, latency 64
01:00.0 0300: 10de:0402 (rev a1) (prog-if 00 [VGA controller])
Checking for texture_from_pixmap: present.
Checking for non power of two support: present.
Checking for Composite extension: present.
Comparing resolution (1680x1050) to maximum 3D texture size (8192): Passed.
Checking for nVidia: present.
Checking for FBConfig: present.
Checking for Xgl: not present.
((www, yay! success... so lets try to turn em off again))
diddl@ubuntu:~$ compiz-switch
diddl@ubuntu:~$ *** glibc detected *** /usr/bin/compiz.real: double free or corruption (!prev): 0x000000000078fd90 ***
diddl@ubuntu:~$ compiz-switch
/usr/bin/compiz-switch: line 220: kill: compiz.real: arguments must be process or job IDs
diddl@ubuntu:~$
@Forlong: I completely understand ^-^ trying to work around some compiz bug which does not even manifest on your machine must be horribly tedious ;-) So a big thanks :D +textual token of appreciation :)
And yeah I trust you that the switch terminated itself :) I just do not know too much about Gnu/Linux and silently assumed until now that 'not returning to prompt'='app still running'
I hope my console output helps to some degree :) (as I do not really know which parts are relevant to you and which are not)
I'm sorry, I did a stupid mistake there. Please try again with the latest version I just uploaded.
you are certainly getting somewhere :D while the reliability of switching on/off is still somewhat fickle it is at least succeeding to switch it on and off now if one keeps pressing the compiz-switch-icon :D
With me It seems that everytime compiz crashes in this way when turned off: "*** glibc detected *** /usr/bin/compiz.real: double free or corruption (!prev): 0x000000000078fd30 ***" one of the Compiz-Zombies is raised.
So what Compiz-Switch 0.4.3 does with my box seems to be the following:
1. if CompizZombie=false and Compiz=ON then activate metacity
no-brainer as this is the normal behavior ^-^
2. if CompizZombie=false and Compiz=OFF then activate compiz
again normal behavior ^-^
3. if CompizZombie=true and Compiz=OFF then kill zombie (but does not activate compiz)
This is what has improved in 0.4.3 for me, while not doing what it is expected to do this prevents undue accumulation of dead Zombies.. err Compiz ;-) and after all when pressing the button again it works. Yay! right direction :D
4. if CompizZombie=true and Compiz=ON then fail to deactivate compiz and tell me
"/usr/bin/compiz-switch: line 224: [: compiz.real: binary operator expected" (when two compiz.real processes present)
or
"/usr/bin/compiz-switch: line 224: [: too many arguments" (when six compiz.real processes were present)
Case four only happens if I use the Appearance Preferences panel in between to toggle compiz instead of using compiz switch.
Hello, I don't understand if the effect is 'permanent': does this application allow to switch compiz off and prevent it to be reloaded on next boot? If not, how can I disable compiz being automatically activated on boot?
Many thx
Ok, sorry. The answer was much simpler than I thought.
Just delete the file ~/.kde/share/config/compizasWM and compiz won't be loaded at kde start.
very good work! Exactly what i am looking for. I just added functions to kill & restart kiba-dock alongside with compiz, no it's perfect for my needs.
Please bare with me here... I'm pretty new to Ubuntu, and Linux. I had the Compiz Switch on my old laptop, and it worked fine... I was running Gutsy. I have Hardy now on my new laptop (Hardy Wubi, if that makes a difference.) The switch will turn off Compiz, but does not turn it back on. I have to go to system/preferences/appearance, and hit normal and all is fine. I like the one button approach though. Any ideas as to why it won't just turn compiz back on?
Thanks,
Sam
deactivate compiz.. and can't reactivate.. -.-
I have spent a few days writing a script myself... gah i feel so stupid, but anyway, I think mine has its uses as well. for instance, mine can be used better for single applications, and it can be contained in shortcuts for game launchers etc etc
http://ubuntuforums.org/showthread.php?t=1207203
knock yourselves out, there it is
Thank YOU!!! This has resolved in 2 minutes something that has been bugging me for weeks.....Txs ;-))
I know the Original Post is quite old, but this still works great on Jaunty. Thank you, Forlong!
Great! Thanks for this!
I have an old comp with not much RAM and I really need to sometimes turn Compiz on and off in order for certain applications to run smoothly. This is a great help.
The 'compiz-switch -s -c' on the panel works great (Ubuntu/Gnome user here). Thanks again!
Hi guys.. I have posted this in Compiz forum, xfce forum, openSuse Forum, on #IRC and elsewhere... No responses any where :(
If I run compix-switch or fusion-icon, and then select xfwm4 from its menu, it refuses to load, terminal gives me these errors:
Code:
* Setting window manager to Xfwm4
** (xfwm4:6218): CRITICAL **: Xfconf could not be initialized
** (xfwm4:6218): WARNING **: Missing data from default files
* Setting window manager to Xfwm4
** (xfwm4:6230): CRITICAL **: Xfconf could not be initialized
** (xfwm4:6230): WARNING **: Missing data from default files
But If I now run "xfwm4 --replace &" from the terminal, it loads xfwm4 no problem.
(icewm seems to work ok from the fusion-icon menu)
Where do I look for these problems? What exactly is the call that fusion-icon makes when I click a WM in the fusion-icon menu? And where is it?
Can anyone point me in the right direction?
I have now uninstalled both fusion-icon and compiz-switch, in case they were out of date or conflicting. If I reinstalll, which first? both or just one?
This is great!!
I tought of doing a script... but then I found this one :D
Thank you very much!
Hi,
Thanks for that useful script. Anyhow some strange behavior I experienced. I am working on Debian Lenny and I compiled compiz from source (0.8.4). If I executed compiz-switch -o in the terminal, everything went fine. Executing compiz-switch by clicking on the icon did not work properly (no window decoration compared to the execution in the terminal). The reason was the missing environment variable LD_LIBRARY_PATH=":/usr/local/lib", when compiz-switch was executed from the menu/panel. All other variables were present. Strange!
Maybe that helps somebody.
Alex
Confirmed, Ubuntu 10.04 Lucid Lynx LTS Released today
Compiz Switch installs fine but nothing happens when pressed.
Sorry, seems like compiz.real doesn't exist anymore on Lucid. Run this to fix the script:
sudo sed 's/\.real//g' -i /usr/bin/compiz-switch
It works, thanks!
Confirming that the fix works on Lucid Lynx
Thanks for that fix for Ubuntu Lucid.
I was getting very frustrated with it not working to switch off compiz (it worked to switch it on) as I sometimes need to get rid of compiz when playing foobillard (snooker game). I could do it with terminal, but the desktop icon for compiz-switch was so incredibly useful!!
Thanks again.
Hi,
This is very interesting application, and as a previous comment, I'm interested in such tool for use on laptop to save energy in battery-mode.
I'm thinking to use your code and integrate it in a more complete applet (allowing to unactivate compiz, cam and put cpu to powersave mode when on battery)
works great with ubuntu 10.04 after i applied the script patch...excellent tool...thanks!
yeah after running this script it works fine,thanks
fuckin' awesome. this has got to be the best program on all the panels on my screen. Very utalitarian.




Ubuntu
Ubuntu forums
Compiz
Compiz Fusion forum
Great idea!
Some details:
Instead of using "sudo make install", and keep the folder and do "sudo make uninstall", you can use "sudo checkinstall": it'll make a deb package and install it. And to uninstall, just remove the package.
(In this case, to make a valid package, you need to edit the Version settings and set it with a number. This package *must not* be distributed, it doesn't manage dependencies.)
Under my XFCE desktop, your script switch between compiz and... kwin :-( Maybe a problem to detect the current desktop environment ?