[gnome-tweak-tool/wip/move-titlebar-tweaks] Move Titlebar tweaks from Windows to Top Bar
- From: Jeremy Bicha <jbicha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tweak-tool/wip/move-titlebar-tweaks] Move Titlebar tweaks from Windows to Top Bar
- Date: Wed, 9 Aug 2017 18:14:20 +0000 (UTC)
commit 880b50e46f7a74a41f7f0dce9db52d28b260e72a
Author: Jeremy Bicha <jbicha ubuntu com>
Date: Wed Aug 9 14:11:41 2017 -0400
Move Titlebar tweaks from Windows to Top Bar
To work around vertical scrolling issue seen in too-long
Windows panel
gtweak/tweaks/tweak_group_top_bar.py | 109 +++++++++++++++++++++++++++++++++-
gtweak/tweaks/tweak_group_windows.py | 105 +--------------------------------
2 files changed, 109 insertions(+), 105 deletions(-)
---
diff --git a/gtweak/tweaks/tweak_group_top_bar.py b/gtweak/tweaks/tweak_group_top_bar.py
index 8a5e2f8..2263395 100644
--- a/gtweak/tweaks/tweak_group_top_bar.py
+++ b/gtweak/tweaks/tweak_group_top_bar.py
@@ -18,12 +18,14 @@
import gtweak
from gtweak.gshellwrapper import GnomeShellFactory
-from gtweak.widgets import ListBoxTweakGroup, GSettingsSwitchTweak, GetterSetterSwitchTweak, Title,
_GSettingsTweak
+from gtweak.widgets import ListBoxTweakGroup, GSettingsSwitchTweak, GetterSetterSwitchTweak, Title,
_GSettingsTweak, GSettingsComboEnumTweak, GSettingsSwitchTweakValue, build_label_beside_widget
from gtweak.utils import XSettingsOverrides
_shell = GnomeShellFactory().get_shell()
_shell_loaded = _shell is not None
+from gi.repository import Gtk
+
class ApplicationMenuTweak(GetterSetterSwitchTweak):
def __init__(self, **options):
self._xsettings = XSettingsOverrides()
@@ -63,6 +65,103 @@ class ApplicationMenuTweak(GetterSetterSwitchTweak):
self.settings.set_string(self.key_name, ",".join(rsplit) + colon + right)
+
+class ShowWindowButtons(GSettingsSwitchTweakValue):
+
+ def __init__(self, name, value, **options):
+ self.value = value
+ GSettingsSwitchTweakValue.__init__(self,
+ name,
+ "org.gnome.desktop.wm.preferences",
+ "button-layout",
+ **options)
+ 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)
+ (left, colon, right) = val.partition(":")
+
+ if "close" in right:
+ rsplit = right.split(",")
+ rsplit = [x for x in rsplit if x in ['appmenu', 'minimize', 'maximize', 'close']]
+
+ if v:
+ rsplit.append(self.value)
+ else:
+ rsplit.remove(self.value)
+
+ rsplit.sort(key=lambda x: ["appmenu", "minimize", "maximize", "close"].index(x))
+
+ self.settings.set_string(self.key_name, left + colon + ",".join(rsplit))
+
+ else:
+ rsplit = left.split(",")
+ rsplit = [x for x in rsplit if x in ['appmenu', 'minimize', 'maximize', 'close']]
+
+ if v:
+ rsplit.append(self.value)
+ else:
+ rsplit.remove(self.value)
+
+ rsplit.sort(key=lambda x: ["close", "minimize", "maximize", "appmenu"].index(x))
+
+ self.settings.set_string(self.key_name, ",".join(rsplit) + colon + right)
+
+
+class PlaceWindowButtons(Gtk.Box, _GSettingsTweak):
+
+ def __init__(self, **options):
+ name = _("Placement")
+ Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL, spacing=0)
+
+ _GSettingsTweak.__init__(self,
+ name,
+ "org.gnome.desktop.wm.preferences",
+ "button-layout",
+ **options)
+
+ box_btn = Gtk.ButtonBox()
+ box_btn.set_layout(Gtk.ButtonBoxStyle.EXPAND)
+
+ # Translators: For RTL languages, this is the "Right" direction since the
+ # interface is flipped
+ btn1 = Gtk.RadioButton.new_with_label_from_widget(None, _("Left"))
+ btn1.set_property("draw-indicator", False)
+
+ btn2 = Gtk.RadioButton.new_from_widget(btn1)
+ # Translators: For RTL languages, this is the "Left" direction since the
+ # interface is flipped
+ btn2.set_label(_("Right"))
+ btn2.set_property("draw-indicator", False)
+
+ val = self.settings.get_string(self.key_name)
+ (left, colon, right) = val.partition(":")
+ if "close" in right:
+ btn2.set_active(True)
+ btn2.connect("toggled", self.on_button_toggled)
+
+ box_btn.pack_start(btn1, True, True, 0)
+ box_btn.pack_start(btn2, True, True, 0)
+
+ build_label_beside_widget(name, box_btn, hbox=self)
+
+ def on_button_toggled(self, v):
+ val = self.settings.get_string(self.key_name)
+ (left, colon, right) = val.partition(":")
+
+ if "close" in left:
+ rsplit = left.split(",")
+ rsplit = [x for x in rsplit if x in ['appmenu', 'minimize', 'maximize', 'close']]
+ rsplit.sort(key=lambda x: ["appmenu", "minimize", "maximize", "close"].index(x))
+ self.settings.set_string(self.key_name, right + colon + ",".join(rsplit))
+ else:
+ rsplit = right.split(",")
+ rsplit = [x for x in rsplit if x in ['appmenu', 'minimize', 'maximize', 'close']]
+ rsplit.sort(key=lambda x: ["close", "minimize", "maximize", "appmenu"].index(x))
+ self.settings.set_string(self.key_name, ",".join(rsplit) + colon + left)
+
+
TWEAK_GROUPS = [
ListBoxTweakGroup(_("Top Bar"),
ApplicationMenuTweak(),
@@ -72,5 +171,13 @@ TWEAK_GROUPS = [
GSettingsSwitchTweak(_("Seconds"), "org.gnome.desktop.interface", "clock-show-seconds",
loaded=_shell_loaded),
Title(_("Calendar"),"", loaded=_shell_loaded),
GSettingsSwitchTweak(_("Week Numbers"),"org.gnome.desktop.calendar", "show-weekdate",
loaded=_shell_loaded),
+ Title(_("Titlebar Actions"), "", uid="title-titlebar-actions"),
+ GSettingsComboEnumTweak(_("Double-Click"),"org.gnome.desktop.wm.preferences",
"action-double-click-titlebar"),
+ GSettingsComboEnumTweak(_("Middle-Click"),"org.gnome.desktop.wm.preferences",
"action-middle-click-titlebar"),
+ GSettingsComboEnumTweak(_("Secondary-Click"),"org.gnome.desktop.wm.preferences",
"action-right-click-titlebar"),
+ Title(_("Titlebar Buttons"), "", uid="title-theme"),
+ ShowWindowButtons(_("Maximize"), "maximize"),
+ ShowWindowButtons(_("Minimize"), "minimize"),
+ PlaceWindowButtons(),
)
]
diff --git a/gtweak/tweaks/tweak_group_windows.py b/gtweak/tweaks/tweak_group_windows.py
index e373500..9109afd 100644
--- a/gtweak/tweaks/tweak_group_windows.py
+++ b/gtweak/tweaks/tweak_group_windows.py
@@ -18,7 +18,7 @@
import gtweak
from gtweak.gshellwrapper import GnomeShellFactory
from gtweak.tweakmodel import Tweak
-from gtweak.widgets import ListBoxTweakGroup, GSettingsComboEnumTweak, GSettingsComboTweak,
GSettingsSwitchTweak, Title, GSettingsSwitchTweakValue, build_label_beside_widget, _GSettingsTweak
+from gtweak.widgets import ListBoxTweakGroup, GSettingsComboTweak, GSettingsSwitchTweak, Title,
build_label_beside_widget, _GSettingsTweak
from gtweak.utils import XSettingsOverrides
import gettext
@@ -136,101 +136,6 @@ class Focus(Gtk.ListBox, Tweak):
self.check_sloppy.hide()
self.check_mouse.show()
-
-class ShowWindowButtons(GSettingsSwitchTweakValue):
-
- def __init__(self, name, value, **options):
- self.value = value
- GSettingsSwitchTweakValue.__init__(self,
- name,
- "org.gnome.desktop.wm.preferences",
- "button-layout",
- **options)
- 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)
- (left, colon, right) = val.partition(":")
-
- if "close" in right:
- rsplit = right.split(",")
- rsplit = [x for x in rsplit if x in ['appmenu', 'minimize', 'maximize', 'close']]
-
- if v:
- rsplit.append(self.value)
- else:
- rsplit.remove(self.value)
-
- rsplit.sort(key=lambda x: ["appmenu", "minimize", "maximize", "close"].index(x))
-
- self.settings.set_string(self.key_name, left + colon + ",".join(rsplit))
-
- else:
- rsplit = left.split(",")
- rsplit = [x for x in rsplit if x in ['appmenu', 'minimize', 'maximize', 'close']]
-
- if v:
- rsplit.append(self.value)
- else:
- rsplit.remove(self.value)
-
- rsplit.sort(key=lambda x: ["close", "minimize", "maximize", "appmenu"].index(x))
-
- self.settings.set_string(self.key_name, ",".join(rsplit) + colon + right)
-
-class PlaceWindowButtons(Gtk.Box, _GSettingsTweak):
-
- def __init__(self, **options):
- name = _("Placement")
- Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL, spacing=0)
-
- _GSettingsTweak.__init__(self,
- name,
- "org.gnome.desktop.wm.preferences",
- "button-layout",
- **options)
-
- box_btn = Gtk.ButtonBox()
- box_btn.set_layout(Gtk.ButtonBoxStyle.EXPAND)
-
- # Translators: For RTL languages, this is the "Right" direction since the
- # interface is flipped
- btn1 = Gtk.RadioButton.new_with_label_from_widget(None, _("Left"))
- btn1.set_property("draw-indicator", False)
-
- btn2 = Gtk.RadioButton.new_from_widget(btn1)
- # Translators: For RTL languages, this is the "Left" direction since the
- # interface is flipped
- btn2.set_label(_("Right"))
- btn2.set_property("draw-indicator", False)
-
- val = self.settings.get_string(self.key_name)
- (left, colon, right) = val.partition(":")
- if "close" in right:
- btn2.set_active(True)
- btn2.connect("toggled", self.on_button_toggled)
-
- box_btn.pack_start(btn1, True, True, 0)
- box_btn.pack_start(btn2, True, True, 0)
-
- build_label_beside_widget(name, box_btn, hbox=self)
-
- def on_button_toggled(self, v):
- val = self.settings.get_string(self.key_name)
- (left, colon, right) = val.partition(":")
-
- if "close" in left:
- rsplit = left.split(",")
- rsplit = [x for x in rsplit if x in ['appmenu', 'minimize', 'maximize', 'close']]
- rsplit.sort(key=lambda x: ["appmenu", "minimize", "maximize", "close"].index(x))
- self.settings.set_string(self.key_name, right + colon + ",".join(rsplit))
- else:
- rsplit = right.split(",")
- rsplit = [x for x in rsplit if x in ['appmenu', 'minimize', 'maximize', 'close']]
- rsplit.sort(key=lambda x: ["close", "minimize", "maximize", "appmenu"].index(x))
- self.settings.set_string(self.key_name, ",".join(rsplit) + colon + left)
-
class WindowScalingFactorTweak(Gtk.Box, Tweak):
def __init__(self, **options):
Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL)
@@ -316,14 +221,6 @@ TWEAK_GROUPS = [
Title(_("Window Focus"), _("Click to Focus"), uid="title-theme"),
Focus(),
GSettingsSwitchTweak(_("Raise Windows When Focused"),"org.gnome.desktop.wm.preferences",
"auto-raise", depends_on=Focus(), depends_how=depends_how),
- Title(_("Titlebar Actions"), "", uid="title-titlebar-actions"),
- GSettingsComboEnumTweak(_("Double-Click"),"org.gnome.desktop.wm.preferences",
"action-double-click-titlebar"),
- GSettingsComboEnumTweak(_("Middle-Click"),"org.gnome.desktop.wm.preferences",
"action-middle-click-titlebar"),
- GSettingsComboEnumTweak(_("Secondary-Click"),"org.gnome.desktop.wm.preferences",
"action-right-click-titlebar"),
- Title(_("Titlebar Buttons"), "", uid="title-theme"),
- ShowWindowButtons(_("Maximize"), "maximize"),
- ShowWindowButtons(_("Minimize"), "minimize"),
- PlaceWindowButtons(),
Title(_("HiDPI"), "", uid="title-hidpi"),
WindowScalingFactorTweak(),
)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]