summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--simple-ccsm-enable-desktop-effects.patch292
1 files changed, 292 insertions, 0 deletions
diff --git a/simple-ccsm-enable-desktop-effects.patch b/simple-ccsm-enable-desktop-effects.patch
new file mode 100644
index 0000000..4763ed6
--- /dev/null
+++ b/simple-ccsm-enable-desktop-effects.patch
@@ -0,0 +1,292 @@
+From a9248818957ed0cc3e903e016767da7f260cbe1e Mon Sep 17 00:00:00 2001
+From: Patrick Niklaus <marex@opencompositing.org>
+Date: Sun, 11 May 2008 20:00:25 +0200
+Subject: [PATCH] Added enable desktop effects button
+
+Use simple-ccsm to handle enabling compiz and asking the user for overrides, when needed.
+---
+ simple-ccsm.desktop | 5 +-
+ simple-ccsm.glade | 73 +++++++++++++++++++++-----------
+ simple-ccsm.in | 116 +++++++++++++++++++++++++++++++++++++++++++++++++-
+ 3 files changed, 164 insertions(+), 30 deletions(-)
+
+diff --git a/simple-ccsm.desktop b/simple-ccsm.desktop
+index 76c64e0..7847e8d 100644
+--- a/simple-ccsm.desktop
++++ b/simple-ccsm.desktop
+@@ -1,9 +1,10 @@
+ [Desktop Entry]
+ Encoding=UTF-8
+-Name=Simple CompizConfig Settings Manager
+-Comment=Configure Compiz with CompizConfig
++Name=Desktop Effects
++Comment=Configure Compiz desktop effects
+ Icon=simple-ccsm
+ Exec=simple-ccsm
+ Terminal=false
+ Type=Application
+ Categories=Compiz;Settings;DesktopSettings;
++StartupNotify=true
+diff --git a/simple-ccsm.glade b/simple-ccsm.glade
+index 5916537..19e8315 100644
+--- a/simple-ccsm.glade
++++ b/simple-ccsm.glade
+@@ -13,50 +13,73 @@
+ <property name="border_width">10</property>
+ <property name="spacing">12</property>
+ <child>
+- <widget class="GtkHBox" id="hbox3">
++ <widget class="GtkVBox" id="vbox2">
+ <property name="visible">True</property>
+- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+- <property name="spacing">5</property>
+- <child>
+- <widget class="GtkLabel" id="label11">
+- <property name="visible">True</property>
+- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+- <property name="label" translatable="yes">Profil:</property>
+- </widget>
+- <packing>
+- <property name="expand">False</property>
+- <property name="fill">False</property>
+- </packing>
+- </child>
++ <property name="spacing">12</property>
+ <child>
+- <widget class="GtkComboBox" id="profileChooser">
++ <widget class="GtkCheckButton" id="enableEffects">
+ <property name="visible">True</property>
+- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
++ <property name="label" translatable="yes">_Enable desktop effects</property>
++ <property name="use_underline">True</property>
++ <property name="response_id">0</property>
++ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+- <property name="position">1</property>
++ <property name="padding">3</property>
+ </packing>
+ </child>
+ <child>
+- <widget class="GtkButton" id="applyButton">
++ <widget class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+- <property name="can_focus">True</property>
+- <property name="receives_default">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+- <property name="response_id">0</property>
+- <signal name="clicked" handler="ApplyProfile"/>
++ <property name="spacing">5</property>
+ <child>
+- <widget class="GtkImage" id="image5">
++ <widget class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+- <property name="stock">gtk-apply</property>
++ <property name="label" translatable="yes">Profile:</property>
+ </widget>
++ <packing>
++ <property name="expand">False</property>
++ <property name="fill">False</property>
++ </packing>
++ </child>
++ <child>
++ <widget class="GtkComboBox" id="profileChooser">
++ <property name="visible">True</property>
++ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
++ </widget>
++ <packing>
++ <property name="position">1</property>
++ </packing>
++ </child>
++ <child>
++ <widget class="GtkButton" id="applyButton">
++ <property name="visible">True</property>
++ <property name="can_focus">True</property>
++ <property name="receives_default">True</property>
++ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
++ <property name="response_id">0</property>
++ <signal name="clicked" handler="ApplyProfile"/>
++ <child>
++ <widget class="GtkImage" id="image1">
++ <property name="visible">True</property>
++ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
++ <property name="stock">gtk-apply</property>
++ </widget>
++ </child>
++ </widget>
++ <packing>
++ <property name="expand">False</property>
++ <property name="fill">False</property>
++ <property name="position">2</property>
++ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+- <property name="position">2</property>
++ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+diff --git a/simple-ccsm.in b/simple-ccsm.in
+index b743a57..c90d13d 100755
+--- a/simple-ccsm.in
++++ b/simple-ccsm.in
+@@ -134,6 +134,12 @@ AnimationSettings = {
+ 'minimizeAnimationBox': "minimize_effects"
+ }
+
++CompizName = "compiz"
++# Change to your default
++CompizStartCommand = "compiz-manager --replace"
++CompizDryRunCommand = "CM_DRY=yes compiz-manager"
++CompizNoChecksCommand = "SKIP_CHECKS=yes compiz-manager"
++
+ # Utility Functions
+ def EnablePlugin(plugin, active):
+ # attempt to resolve conflicts...
+@@ -862,7 +868,7 @@ class MainWin:
+ notebook.set_current_page (Pages[page])
+
+ # Window
+- window = self.GladeXML.get_widget("mainWin")
++ self.Window = self.GladeXML.get_widget("mainWin")
+
+ # Icon
+ theme = gtk.icon_theme_get_default()
+@@ -871,7 +877,12 @@ class MainWin:
+ theme.load_icon("simple-ccsm", 32, 0),
+ theme.load_icon("simple-ccsm", 48, 0),
+ )
+- window.set_icon_list(*iconList)
++ self.Window.set_icon_list(*iconList)
++
++ # Enable effects button
++ self.EnableEffectsButton = self.GladeXML.get_widget("enableEffects")
++ self.EnableEffectsButton.connect ("toggled", self.EnableDesktopEffectsChanged)
++ self.Notebook = self.GladeXML.get_widget("notebook")
+
+ # Profile Chooser
+ self.ProfileChooser = self.GladeXML.get_widget("profileChooser")
+@@ -885,10 +896,28 @@ class MainWin:
+ self.EdgePage = EdgePage(self.Context, self.GladeXML)
+
+ self.Update()
+- window.show_all()
++ self.Window.show_all()
++
++ def CheckForCompiz(self):
++ composited = self.Window.is_composited()
++ if composited:
++ # Now do the dirty work - check if it is really Compiz
++ psCMD = "ps -e".split(" ")
++ ps = subprocess.Popen(psCMD, stdout=subprocess.PIPE)
++ grepCMD = "grep compiz".split(" ")
++ grep = subprocess.Popen(grepCMD, stdin=ps.stdout, stdout=subprocess.PIPE)
++ grep.wait()
++ lines = grep.stdout.readlines()
++ for l in lines:
++ name = l.replace("\n", "").split(" ")[-1]
++ if name == CompizName:
++ return True
++
++ return False
+
+ def Update(self):
+ self.Context.Read()
++ self.Block += 1
+
+ self.AnimationPage.Update()
+ self.EffectPage.Update()
+@@ -898,6 +927,87 @@ class MainWin:
+ self.EdgePage.Update()
+
+ self.SetProfile()
++ self.SetEnableDesktopEffects()
++
++ self.Block -= 1
++
++ def SetEnableDesktopEffects(self):
++ running = self.CheckForCompiz()
++ self.EnableEffectsButton.set_active(running)
++ self.Notebook.set_sensitive(running)
++ self.ProfileChooser.set_sensitive(running)
++
++ def EnableDesktopEffectsChanged(self, widget):
++ if self.Block > 0:
++ return
++
++ enabled = self.EnableEffectsButton.get_active()
++ if enabled:
++ # First try to check if compiz can be run
++ cmd = CompizDryRunCommand.split(" ")
++ proc = subprocess.Popen(cmd, shell=True)
++ proc.wait()
++ if proc.returncode != 0:
++ # Dry run detected problems, warn the user
++ dialog = gtk.Dialog ()
++ dialog.set_title("Error")
++ dialog.set_border_width(6)
++ label = gtk.Label(_("Desktop effects are not supported on your current hardware / configuration. Would you like to cancel enabling of desktop effects or run them anyway?"))
++ label.set_line_wrap(True)
++ dialog.vbox.pack_start(label,
++ gtk.TRUE,
++ gtk.FALSE,
++ 3)
++ dialog.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
++ dialog.add_button("Run anyway", gtk.RESPONSE_OK)
++ dialog.show_all()
++ response = dialog.run()
++ dialog.destroy()
++ if response != gtk.RESPONSE_OK:
++ self.EnableEffectsButton.set_active(False)
++ return
++
++ # Make compiz manager skip further checks
++ path = os.path.expanduser("~/.config/compiz/compiz-manager")
++ hasSkip = False
++ try:
++ config = open(path, "r")
++ for l in config.readlines():
++ if "SKIP_CHECKS" in l:
++ hasSkip = True
++ break
++ config.close()
++ except IOError, e:
++ print "No compiz manager config found!"
++ dir = os.path.expanduser("~/.config/compiz/")
++ if not os.path.exists(dir):
++ os.makedirs(dir)
++ if not hasSkip:
++ config = open(path, "a")
++ config.write("SKIP_CHECKS=yes\n")
++ config.close()
++ # Start compiz
++ cmd = CompizStartCommand.split(" ")
++ subprocess.Popen(cmd)
++ # Enable compiz in kde
++ try:
++ subprocess.call('kwriteconfig --file ksmserverrc --group General --key windowManager compiz'.split())
++ except (IOError, OSError):
++ pass
++ # Create a file that indicates wether compiz is enabled or not
++ path = os.path.expanduser("~/.config/compiz/enable-compiz")
++ open(path, "w+").close() # touch replacement
++ else:
++ cmd = "metacity --replace".split(" ")
++ subprocess.Popen(cmd)
++ # Remove old config
++ files = ("~/.config/compiz/enable-compiz", "~/.config/compiz/compiz-manager")
++ for file in files:
++ path = os.path.expanduser(file)
++ os.remove(path)
++
++ self.Notebook.set_sensitive(enabled)
++ self.ProfileChooser.set_sensitive(enabled)
+
+ def OpenAdvanced(self, widget):
+ notebook = self.GladeXML.get_widget("notebook")
+--
+1.5.4.3