css_provider, 1 + Gtk.STYLE_PROVIDER_PRIORITY_USER) TWEAK_GROUPS = [ ListBoxTweakGroup( "Test Many Settings", *[_TestTweak("name: " + str(d), "desc: " + str(d)) for d in range(10)], uid="group-tweak-test"), ListBoxTweakGroup( "Test Settings", _TestTweak("foo bar", "does foo bar", uid="tweak-test-foo"), _TestTweak("foo baz", "does foo baz"), _TestInfoTweak("long string "*10, "long description "*10, _test_button_name="short"), _TestInfoTweak("foo info", "info widget", _tweak_info="Information"), _TestInfoTweak("foo warning", "info widget", _tweak_warning="Warning"), Title("Test Notifications", "", uid="title-tweak-test"), _TestButtonTweak("Shows Information", "foo bar", _need_action=True), _TestButtonTweak("Needs Logout", "foo bar log", _need_logout=True)), ListBoxTweakGroup( "Unicode Test", Title("Words", "", uid="title-tweak-test"), *[_TestTweak( str(d), str(d)) for d in ["Muñoz", "Español", "größer", "jünger", "grün", "счастье", "سعادة"]]), ]
self._original_factor = self._xsettings.get_window_scaling_factor() else: self._xsettings.set_window_scaling_factor(self._original_factor) adj.set_value(self._original_factor) self._close() self._dialog.destroy() TWEAK_GROUPS = [ ListBoxTweakGroup(TWEAK_GROUP_WINDOWS, GSettingsSwitchTweak(_("Attached Modal Dialogs"),"org.gnome.mutter", "attach-modal-dialogs"), GSettingsSwitchTweak(_("Automatically Raise Windows"),"org.gnome.desktop.wm.preferences", "auto-raise"), GSettingsSwitchTweak(_("Resize with Secondary-click"),"org.gnome.desktop.wm.preferences", "resize-with-right-button"), GSettingsComboTweak(_("Window Action Key"), "org.gnome.desktop.wm.preferences", "mouse-button-modifier", [("disabled", _("Disabled")), ("<Alt>", "Alt"), ("<Super>", "Super")]), GSettingsComboEnumTweak(_("Focus Mode"), "org.gnome.desktop.wm.preferences", "focus-mode"), 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"), Title(_("HiDPI"), "", uid="title-hidpi"), WindowScalingFactorTweak(), ) ]
_shell = GnomeShellFactory().get_shell() _shell_loaded = _shell is not None TWEAK_GROUPS = [ ListBoxTweakGroup( _("Top Bar"), GSettingsSwitchTweak(_("Activities Overview Hot Corner"), "org.gnome.desktop.interface", "enable-hot-corners", loaded=_shell_loaded), GSettingsSwitchTweak(_("Battery Percentage"), "org.gnome.desktop.interface", "show-battery-percentage", loaded=_shell_loaded), Title(_("Clock"), "", loaded=_shell_loaded), GSettingsSwitchTweak(_("Weekday"), "org.gnome.desktop.interface", "clock-show-weekday", loaded=_shell_loaded), GSettingsSwitchTweak(_("Date"), "org.gnome.desktop.interface", "clock-show-date", loaded=_shell_loaded), GSettingsSwitchTweak(_("Seconds"), "org.gnome.desktop.interface", "clock-show-seconds", loaded=_shell_loaded), Title(_("Calendar"), "", loaded=_shell_loaded), GSettingsSwitchTweak(_("Week Numbers"), "org.gnome.desktop.calendar",
def _get_valid_key_themes(self): dirs = (os.path.join(gtweak.DATA_DIR, "themes"), os.path.join(GLib.get_user_data_dir(), "themes"), os.path.join(os.path.expanduser("~"), ".themes")) valid = walk_directories(dirs, lambda d: os.path.isfile(os.path.join(d, "gtk-3.0", "gtk-keys.css")) and \ os.path.isfile(os.path.join(d, "gtk-2.0-key", "gtkrc"))) return valid TWEAK_GROUPS = [ ListBoxTweakGroup( _("Keyboard and Mouse"), KeyThemeSwitcher(), GSettingsSwitchTweak( _("Show All Input Sources"), "org.gnome.desktop.input-sources", "show-all-sources", logout_required=True, ), Title(_("Mouse"), ""), GSettingsSwitchTweak( _("Show location of pointer"), "org.gnome.settings-daemon.peripherals.mouse", "locate-pointer", schema_filename="org.gnome.settings-daemon.peripherals.gschema.xml" ), PrimaryPasteTweak(), ), ]
def _on_combo_changed(self, combo): _iter = combo.get_active_iter() if _iter: value = combo.get_model().get_value(_iter, 0) val = self.STATUS[value] self.settings[self.key_name] = val sg = build_horizontal_sizegroup() sw = StaticWorkspaceTweak(size_group=sg, loaded=_shell_loaded) depends_how = lambda x,kn: not(x.get_boolean(kn)) TWEAK_GROUPS = [ ListBoxTweakGroup(TWEAK_GROUP_TOPBAR, ApplicationMenuTweak(), Title(_("Clock"),""), GSettingsCheckTweak(_("Show date"),"org.gnome.desktop.interface", "clock-show-date", schema_filename="org.gnome.desktop.interface.gschema.xml"), GSettingsCheckTweak(_("Show seconds"), "org.gnome.desktop.interface", "clock-show-seconds", schema_filename="org.gnome.desktop.interface.gschema.xml"), Title(_("Calendar"),""), GSettingsCheckTweak(_("Show week numbers"),"org.gnome.shell.calendar", "show-weekdate", schema_filename="org.gnome.shell.gschema.xml", loaded=_shell_loaded), ), ListBoxTweakGroup(TWEAK_GROUP_POWER, GSettingsComboEnumTweak(_("Power Button Action"), "org.gnome.settings-daemon.plugins.power", "button-power", size_group=sg), Title(_("When Laptop Lid is Closed"), "", uid="title-theme"), GSettingsComboEnumTweak(_("On Battery Power"),"org.gnome.settings-daemon.plugins.power", "lid-close-battery-action", size_group=sg), GSettingsComboEnumTweak(_("When plugged in"),"org.gnome.settings-daemon.plugins.power", "lid-close-ac-action", size_group=sg), GSettingsSwitchTweak(_("Suspend even if an external monitor is plugged in"),"org.gnome.settings-daemon.plugins.power", "lid-close-suspend-with-external-monitor", size_group=sg), ), ListBoxTweakGroup(TWEAK_GROUP_WORKSPACES, sw, GSettingsSpinButtonTweak(_("Number of Workspaces"), "org.gnome.desktop.wm.preferences", "num-workspaces", depends_on = sw, depends_how=depends_how, size_group=sg),
#set button back to default state chooser.unselect_all() def _on_combo_changed(self, combo): val = combo.get_model().get_value(combo.get_active_iter(), 0) self._settings.set_string(ShellThemeTweak.THEME_GSETTINGS_NAME, val) TWEAK_GROUPS = [ ListBoxTweakGroup( _("Appearance"), #GSettingsSwitchTweak("Buttons Icons","org.gnome.desktop.interface", "buttons-have-icons"), #GSettingsSwitchTweak("Menu Icons","org.gnome.desktop.interface", "menus-have-icons"), GSettingsSwitchTweak(_("Animations"), "org.gnome.desktop.interface", "enable-animations"), Title(_("Themes"), "", uid="title-theme"), GtkThemeSwitcher(), CursorThemeSwitcher(), IconThemeSwitcher(), ShellThemeTweak(loaded=_shell_loaded), Title(_("Background"), "", uid="title-theme"), GSettingsFileChooserButtonTweak( _("Image"), "org.gnome.desktop.background", "picture-uri", local_only=True, mimetypes=["application/xml", "image/png", "image/jpeg"]), GSettingsComboEnumTweak(_("Adjustment"), "org.gnome.desktop.background", "picture-options"), Title(_("Lock Screen"), "", uid="title-theme"),
TWEAK_GROUPS = [ ListBoxTweakGroup( _("Keyboard and Mouse"), GSettingsSwitchTweak( _("Show All Input Sources"), "org.gnome.desktop.input-sources", "show-all-sources", logout_required=True, ), KeyThemeSwitcher(), GSettingsComboTweak(_("Switch between overview and desktop"), "org.gnome.mutter", "overlay-key", [("Super_L", _("Left super")), ("Super_R", _("Right super"))]), Title(_("Mouse"), ""), GSettingsSwitchTweak( _("Show location of pointer"), "org.gnome.settings-daemon.peripherals.mouse", "locate-pointer", schema_filename="org.gnome.settings-daemon.peripherals.gschema.xml" ), PrimaryPasteTweak(), Title(_("Touchpad"), ""), GSettingsComboEnumTweak( _("Click method"), "org.gnome.desktop.peripherals.touchpad", "click-method", schema_filename="org.gnome.desktop.peripherals.gschema.xml"), ), ]
self.check_disabled.hide() elif row.get_index() == 1: self.settings[self.key_name] = "areas" self.check_fingers.hide() self.check_area.show() self.check_disabled.hide() else: self.settings[self.key_name] = "none" self.check_fingers.hide() self.check_area.hide() self.check_disabled.show() TWEAK_GROUPS = [ ListBoxTweakGroup(_("Keyboard & Mouse"), Title(_("Keyboard"), "", top=True), GSettingsSwitchTweak(_("Show Extended Input Sources"), "org.gnome.desktop.input-sources", "show-all-sources", desc=_("Increases the choice of input sources in the Settings application."), logout_required=True,), KeyThemeSwitcher(), ComposeDialogLauncher(), OverviewShortcutTweak(), AdditionalLayoutButton(), Title(_("Mouse"), ""), GSettingsComboEnumTweak(_("Acceleration Profile"), "org.gnome.desktop.peripherals.mouse", "accel-profile", schema_filename="org.gnome.desktop.peripherals.gschema.xml"), GSettingsSwitchTweak(_("Pointer Location"),
screen = Gdk.Screen.get_default() context = Gtk.StyleContext() context.add_provider_for_screen(screen, css_provider, 1 + Gtk.STYLE_PROVIDER_PRIORITY_USER) TWEAK_GROUPS = [ ListBoxTweakGroup( "Test Many Settings", *[_TestTweak("name: " + str(d), "desc: " + str(d)) for d in range(10)], uid="group-tweak-test"), ListBoxTweakGroup( "Test Settings", _TestTweak("foo bar", "does foo bar", uid="tweak-test-foo"), _TestTweak("foo baz", "does foo baz"), _TestInfoTweak("long string " * 10, "long description " * 10, _test_button_name="short"), _TestInfoTweak("foo info", "info widget", _tweak_info="Information"), _TestInfoTweak("foo warning", "info widget", _tweak_warning="Warning"), Title("Test Notifications", "", uid="title-tweak-test"), _TestButtonTweak("Shows Information", "foo bar", _need_action=True), _TestButtonTweak("Needs Logout", "foo bar log", _need_logout=True)), ListBoxTweakGroup( "Unicode Test", Title("Words", "", uid="title-tweak-test"), *[ _TestTweak(str(d), str(d)) for d in [ "Muñoz", "Español", "größer", "jünger", "grün", "счастье", "سعادة" ] ]), ]
self._source = GLib.timeout_add_seconds(interval=1, function=self._timeout_func) response = self._dialog.run() if response == Gtk.ResponseType.YES: self._original_factor = self._xsettings.get_window_scaling_factor() else: self._xsettings.set_window_scaling_factor(self._original_factor) adj.set_value(self._original_factor) self._close() self._dialog.destroy() Title(_("HiDPI"), "", uid="title-hidpi") depends_how = lambda x, kn: x.get_string(kn) in ("mouse", "sloppy") TWEAK_GROUPS = [ ListBoxTweakGroup( _("Windows"), GSettingsSwitchTweak( _("Attach Modal Dialogs"), "org.gnome.mutter", "attach-modal-dialogs", desc= _("When on, modal dialog windows are attached to their parent windows, and cannot be moved." )), GSettingsSwitchTweak(_("Resize with Secondary-Click"), "org.gnome.desktop.wm.preferences",
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( _("Window Titlebars"), 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(), ) ]
depends_on=dicons, schema_filename="org.gnome.nautilus.gschema.xml"), GSettingsCheckTweak(_("Network Servers"), "org.gnome.nautilus.desktop", "network-icon-visible", depends_on=dicons, schema_filename="org.gnome.nautilus.gschema.xml"), GSettingsCheckTweak(_("Trash"), "org.gnome.nautilus.desktop", "trash-icon-visible", depends_on=dicons, schema_filename="org.gnome.nautilus.gschema.xml"), GSettingsCheckTweak(_("Mounted Volumes"), "org.gnome.nautilus.desktop", "volumes-visible", depends_on=dicons, schema_filename="org.gnome.nautilus.gschema.xml"), Title(_("Background"), "", uid="title-theme"), GSettingsComboEnumTweak(_("Mode"), "org.gnome.desktop.background", "picture-options"), GSettingsFileChooserButtonTweak( _("Background Location"), "org.gnome.desktop.background", "picture-uri", local_only=True, mimetypes=["application/xml", "image/png", "image/jpeg"]), #Title(_("Files"), ""), #GSettingsSwitchTweak(_("Use location entry"), "org.gnome.nautilus.preferences", "always-use-location-entry",schema_filename="org.gnome.nautilus.gschema.xml"), ) ]
self.check1.show() self.check2.hide() else: self.settings[self.key_name] = False self.check1.hide() self.check2.show() sg = build_horizontal_sizegroup() sw = StaticWorkspaceTweak(size_group=sg, loaded=_shell_loaded) depends_how = lambda x, kn: not (x.get_boolean(kn)) TWEAK_GROUPS = [ ListBoxTweakGroup( _("Workspaces"), sw, GSettingsSpinButtonTweak(_("Number of Workspaces"), "org.gnome.desktop.wm.preferences", "num-workspaces", depends_on=sw, depends_how=depends_how, size_group=sg, loaded=_shell_loaded), Title(_("Display Handling"), "", uid="title-theme", loaded=_shell_loaded), PrimaryWorkspaceTweak(), ) ]
bus.call('org.gnome.tweak-tool.lid-inhibitor', '/org/gnome/tweak_tool/lid_inhibitor', 'org.gtk.Actions', 'Activate', GLib.Variant('(sava{sv})', ('quit', [], {})), None, 0, -1, None) return False sg = build_horizontal_sizegroup() sw = StaticWorkspaceTweak(size_group=sg, loaded=_shell_loaded) depends_how = lambda x,kn: not(x.get_boolean(kn)) TWEAK_GROUPS = [ ListBoxTweakGroup(TWEAK_GROUP_TOPBAR, ApplicationMenuTweak(), Title(_("Clock"),""), GSettingsCheckTweak(_("Show date"),"org.gnome.desktop.interface", "clock-show-date", schema_filename="org.gnome.desktop.interface.gschema.xml"), GSettingsCheckTweak(_("Show seconds"), "org.gnome.desktop.interface", "clock-show-seconds", schema_filename="org.gnome.desktop.interface.gschema.xml"), Title(_("Calendar"),""), GSettingsCheckTweak(_("Show week numbers"),"org.gnome.desktop.calendar", "show-weekdate", schema_filename="org.gnome.desktop.calendar.gschema.xml"), ), ListBoxTweakGroup(TWEAK_GROUP_POWER, Title(_("When Power Button is Pressed"), "", uid="title-theme"), GSettingsComboEnumTweak(_("Action"), "org.gnome.settings-daemon.plugins.power", "power-button-action", size_group=sg), Title(_("When Laptop Lid is Closed"), "", uid="title-theme"), GSettingsComboEnumTweak(_("On Battery Power"),"org.gnome.settings-daemon.plugins.power", "lid-close-battery-action", size_group=sg), GSettingsComboEnumTweak(_("When plugged in"),"org.gnome.settings-daemon.plugins.power", "lid-close-ac-action", size_group=sg), GSettingsSwitchTweak(_("Suspend even if an external monitor is plugged in"),"org.gnome.settings-daemon.plugins.power", "lid-close-suspend-with-external-monitor", size_group=sg), IgnoreLidSwitchTweak(), ), ListBoxTweakGroup(TWEAK_GROUP_WORKSPACES,
# Copyright (c) 2011 John Stowers # SPDX-License-Identifier: GPL-3.0+ # License-Filename: LICENSES/GPL-3.0 from gtweak.widgets import ListBoxTweakGroup, GSettingsSwitchTweak, Title dicons = GSettingsSwitchTweak(_("Show Icons"),"org.gnome.desktop.background","show-desktop-icons") # show-desktop-icons is in gsettings-desktop-schemas, but it won't actually # *work* unless we have a version of Nautilus that still has the ability to # draw the desktop; use one of the settings that was present in that version # to probe for it. home = GSettingsSwitchTweak(_("Home"),"org.gnome.nautilus.desktop", "home-icon-visible", depends_on=dicons, schema_filename="org.gnome.nautilus.gschema.xml") TWEAK_GROUPS = [] if home.loaded: TWEAK_GROUPS.append(ListBoxTweakGroup(_("Desktop"), Title(_("Icons on Desktop"), "", uid="title-theme", top=True), dicons, home, GSettingsSwitchTweak(_("Network Servers"),"org.gnome.nautilus.desktop", "network-icon-visible", depends_on=dicons, schema_filename="org.gnome.nautilus.gschema.xml"), GSettingsSwitchTweak(_("Trash"),"org.gnome.nautilus.desktop", "trash-icon-visible", depends_on=dicons, schema_filename="org.gnome.nautilus.gschema.xml"), GSettingsSwitchTweak(_("Mounted Volumes"),"org.gnome.nautilus.desktop", "volumes-visible", depends_on=dicons, schema_filename="org.gnome.nautilus.gschema.xml"), ))
except: #does not look like a valid theme self.notify_information(_("Invalid theme")) logging.warning("Error parsing theme zip", exc_info=True) #set button back to default state chooser.unselect_all() def _on_combo_changed(self, combo): val = combo.get_model().get_value(combo.get_active_iter(), 0) self._settings.set_string(ShellThemeTweak.THEME_GSETTINGS_NAME, val) TWEAK_GROUPS = [ ListBoxTweakGroup( TWEAK_GROUP_APPEARANCE, DarkThemeSwitcher(), #GSettingsSwitchTweak("Buttons Icons","org.gnome.desktop.interface", "buttons-have-icons"), #GSettingsSwitchTweak("Menu Icons","org.gnome.desktop.interface", "menus-have-icons"), Title(_("Theme"), "", uid="title-theme"), GtkThemeSwitcher(), IconThemeSwitcher(), CursorThemeSwitcher(), ShellThemeTweak(loaded=_shell_loaded), GSettingsSwitchTweak(_("Enable animations"), "org.gnome.desktop.interface", "enable-animations"), ), ]
self._source = GLib.timeout_add_seconds(interval=1, function=self._timeout_func) response = self._dialog.run() if response == Gtk.ResponseType.YES: self._original_factor = self._xsettings.get_window_scaling_factor() else: self._xsettings.set_window_scaling_factor(self._original_factor) adj.set_value(self._original_factor) self._close() self._dialog.destroy() Title(_("HiDPI"), "", uid="title-hidpi") depends_how = lambda x, kn: x.get_string(kn) in ("mouse", "sloppy") TWEAK_GROUPS = [ ListBoxTweakGroup( _("Windows"), GSettingsSwitchTweak( _("Attach Modal Dialogs"), "org.gnome.mutter", "attach-modal-dialogs", desc= _("When on, modal dialog windows are attached to their parent windows, and cannot be moved." )), # https://help.gnome.org/users/gnome-help/stable/shell-windows-tiled.html GSettingsSwitchTweak(