[gnome-tweak-tool] add support for csd windows with header bars



commit f79ab44363a8afa98e3bcf10f4ca91597030f6c8
Author: Alex Muñoz <amunoz src gnome org>
Date:   Tue Jan 14 00:32:09 2014 -0300

    add support for csd windows with header bars
    
    https://bugzilla.gnome.org/show_bug.cgi?id=720913

 gtweak/tweaks/tweak_group_windows.py |   10 +++++-----
 gtweak/utils.py                      |    3 +++
 2 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/gtweak/tweaks/tweak_group_windows.py b/gtweak/tweaks/tweak_group_windows.py
index dd4d0e1..2cab254 100644
--- a/gtweak/tweaks/tweak_group_windows.py
+++ b/gtweak/tweaks/tweak_group_windows.py
@@ -19,6 +19,7 @@ import gtweak
 from gtweak.gshellwrapper import GnomeShellFactory
 from gtweak.tweakmodel import TWEAK_GROUP_WINDOWS
 from gtweak.widgets import ListBoxTweakGroup, GSettingsComboEnumTweak, GSettingsComboTweak, 
GSettingsSwitchTweak, Title, GSettingsSwitchTweakValue
+from gtweak.utils import XSettingsOverrides
 
 _shell = GnomeShellFactory().get_shell()
 _shell_loaded = _shell is not None
@@ -27,29 +28,28 @@ class ShowWindowButtons(GSettingsSwitchTweakValue):
 
     def __init__(self, name, value, **options):
         self.value = value
+        self._xsettings = XSettingsOverrides()
         GSettingsSwitchTweakValue.__init__(self,
                                            name,
                                            "org.gnome.desktop.wm.preferences",
                                            "button-layout",
                                            loaded=_shell_loaded,
                                            **options)
-        self.values=[':close',':minimize,close', ':maximize,close', ':minimize,maximize,close']
-        
     def get_active(self):
         return self.value in self.settings.get_string(self.key_name)
             
     def set_active(self, v):
         val = self.settings.get_string(self.key_name)
         if v:
-            id = self.values.index(val)
-            if id == 0:
+            if val == ":close":
                 val = val.replace(":", ":"+self.value+",")
             else:
-                val= self.values[len(self.values)-1]
+                val = ":minimize,maximize,close"
         else:
             val = val.replace(self.value+",", "")
 
         self.settings.set_string(self.key_name, val)
+        self._xsettings.set_window_buttons(val.replace(":", "menu:"))
 
 TWEAK_GROUPS = [ 
     ListBoxTweakGroup(TWEAK_GROUP_WINDOWS,
diff --git a/gtweak/utils.py b/gtweak/utils.py
index 5a0b9b4..e18b650 100644
--- a/gtweak/utils.py
+++ b/gtweak/utils.py
@@ -235,6 +235,7 @@ class XSettingsOverrides:
     VARIANT_TYPES = {
         'Gtk/ShellShowsAppMenu': GLib.Variant.new_int32,
         'Gtk/EnablePrimaryPaste': GLib.Variant.new_int32,
+        'Gtk/DecorationLayout': GLib.Variant.new_string,
     }
 
     def __init__(self):
@@ -279,6 +280,8 @@ class XSettingsOverrides:
         self._set_override('Gtk/EnablePrimaryPaste', int(v))
     def get_enable_primary_paste(self):
         return self._get_override('Gtk/EnablePrimaryPaste', True)
+    def set_window_buttons(self, v):
+        self._set_override('Gtk/DecorationLayout', v)
 
 class Notification:
     def __init__(self, summary, body):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]