def __init__(self, config, machine_id, schema_name, key_name, **options): name = config.get(DEVICE_SECTION, 'Name') match_id = config.get(DEVICE_SECTION, DEVICE_MATCH_LINE).strip(';') self._schema_path = SCHEMA_PATH % (machine_id, match_id) GSettingsSwitchTweak.__init__(self, schema_name, key_name, schema_path = self._schema_path, **options)
def __init__(self, config, machine_id, schema_name, key_name, **options): name = config.get(DEVICE_SECTION, 'Name') match_id = config.get(DEVICE_SECTION, DEVICE_MATCH_LINE).strip(';') self._schema_path = SCHEMA_PATH % (machine_id, match_id) GSettingsSwitchTweak.__init__(self, schema_name, key_name, schema_path=self._schema_path, **options)
def __init__(self, **options): GSettingsSwitchTweak.__init__(self, "org.gnome.desktop.background", "show-desktop-icons", **options) #when the user enables nautilus to draw the desktop icons, set nautilus #to autostart self.nautilus = AutostartManager("nautilus.desktop", autostart_desktop_filename="nautilus-autostart.desktop", exec_cmd="nautilus -n") #we only need to install the desktop file on old versions of nautilus/gnome-session. #new ones use the new AutostartCondition and watch the gsettings key automatically if not self.nautilus.uses_autostart_condition("GSettings"): self.settings.connect('changed::'+self.key_name, self._on_setting_changed)
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"), ), ]
# -*- coding: utf-8 -*- # Copyright (c) 2017 Canonical # SPDX-License-Identifier: GPL-3.0+ # License-Filename: LICENSES/GPL-3.0 from gi.repository import Gio, GLib, Gtk import gtweak from gtweak.tweakmodel import Tweak from gtweak.widgets import ListBoxTweakGroup, GSettingsSwitchTweak TWEAK_GROUPS = [ ListBoxTweakGroup( _("Sound"), GSettingsSwitchTweak( _("Over-Amplification"), "org.gnome.desktop.sound", "allow-volume-above-100-percent", desc= _("Allows raising the volume above 100%. This can result in a loss of audio quality; it is better to increase application volume settings, if possible." )), ) ]
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, sw, GSettingsSpinButtonTweak(_("Number of Workspaces"), "org.gnome.desktop.wm.preferences", "num-workspaces", depends_on = sw, depends_how=depends_how, size_group=sg), GSettingsSwitchTweak(_("Workspaces only on primary display"),"org.gnome.mutter", "workspaces-only-on-primary", schema_filename="org.gnome.shell.gschema.xml", loaded=_shell_loaded), ) ]
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() 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"),
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(), ), ]
# Copyright (c) 2011 John Stowers # SPDX-License-Identifier: GPL-3.0+ # License-Filename: LICENSES/GPL-3.0 import gtweak from gtweak.gshellwrapper import GnomeShellFactory from gtweak.widgets import ListBoxTweakGroup, GSettingsSwitchTweak, Title _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"),
# 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"), ))
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", "resize-with-right-button"), GSettingsComboTweak(_("Window Action Key"), "org.gnome.desktop.wm.preferences", "mouse-button-modifier", [("disabled", _("Disabled")), ("<Alt>", "Alt"), ("<Super>", "Super")]), Title(_("Window Focus"), _("Click to Focus"), uid="title-theme"), Focus(), GSettingsSwitchTweak(_("Raise Windows When Focused"), "org.gnome.desktop.wm.preferences",
return not self._sync_inhibitor() def set_active(self, v): self._dfile.update_start_at_login(not v) self._sync_inhibitor() def _sync_inhibitor(self): if (self._dfile.is_start_at_login_enabled()): GLib.spawn_command_line_async(self._inhibitor_path) return True else: bus = Gio.bus_get_sync(Gio.BusType.SESSION, None) 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 TWEAK_GROUPS = [ ListBoxTweakGroup(_("General"), GSettingsSwitchTweak(_("Animations"), "org.gnome.desktop.interface", "enable-animations"), IgnoreLidSwitchTweak(), # Don't show this setting in the Ubuntu session since this setting is in gnome-control-center there GSettingsSwitchTweak(_("Over-Amplification"), "org.gnome.desktop.sound", "allow-volume-above-100-percent", desc=_("Allows raising the volume above 100%. This can result in a loss of audio quality; it is better to increase application volume settings, if possible."), loaded=_shell_not_ubuntu), ), ]
] rsplit.append("appmenu") rsplit.sort( key=lambda x: ["close", "minimize", "maximize", "appmenu" ].index(x)) self.settings.set_string(self.key_name, ",".join(rsplit) + colon + right) self.notify_logout() TWEAK_GROUPS = [ ListBoxTweakGroup( _("Top Bar"), ApplicationMenuTweak(), GSettingsSwitchTweak(_("Battery Percentage"), "org.gnome.desktop.interface", "show-battery-percentage", loaded=_shell_loaded), # Requires patch from https://bugzilla.gnome.org/688320 # GSettingsSwitchTweak(_("Activities Overview Hot Corner"),"org.gnome.shell", "enable-hot-corners", loaded=_shell_loaded), Title(_("Clock"), "", 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",
# (at your option) any later version. # # gnome-tweak-tool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with gnome-tweak-tool. If not, see <http://www.gnu.org/licenses/>. from gi.repository import Gtk from gtweak.widgets import ListBoxTweakGroup, GSettingsSwitchTweak, GSettingsComboEnumTweak, GSettingsFileChooserButtonTweak, GSettingsCheckTweak, Title dicons = GSettingsSwitchTweak(_("Icons on Desktop"), "org.gnome.desktop.background", "show-desktop-icons") TWEAK_GROUPS = [ ListBoxTweakGroup( _("Desktop"), dicons, GSettingsCheckTweak(_("Computer"), "org.gnome.nautilus.desktop", "computer-icon-visible", depends_on=dicons, schema_filename="org.gnome.nautilus.gschema.xml"), GSettingsCheckTweak(_("Home"), "org.gnome.nautilus.desktop", "home-icon-visible", depends_on=dicons,
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"), "org.gnome.settings-daemon.peripherals.mouse", "locate-pointer", schema_filename="org.gnome.settings-daemon.peripherals.gschema.xml",