[gnome-tweak-tool] Add mouse tweaks (and middle click paste) to new group
- From: John Stowers <jstowers src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tweak-tool] Add mouse tweaks (and middle click paste) to new group
- Date: Wed, 21 Aug 2013 12:40:46 +0000 (UTC)
commit 2033f3057840c1847d4aa8aa7497cb33fc39ebd6
Author: John Stowers <john stowers gmail com>
Date: Wed Aug 21 14:14:40 2013 +0200
Add mouse tweaks (and middle click paste) to new group
gtweak/tweakmodel.py | 1 -
gtweak/tweaks/tweak_group_interface.py | 26 +----------
gtweak/tweaks/tweak_group_keymouse.py | 81 ++++++++++++++++++++++++++++++++
gtweak/tweaks/tweak_group_legacy.py | 5 --
4 files changed, 82 insertions(+), 31 deletions(-)
---
diff --git a/gtweak/tweakmodel.py b/gtweak/tweakmodel.py
index 713e7c1..af63be7 100644
--- a/gtweak/tweakmodel.py
+++ b/gtweak/tweakmodel.py
@@ -29,7 +29,6 @@ TWEAK_GROUP_APPEARANCE = _("Appearance")
TWEAK_GROUP_DESKTOP = _("Desktop")
TWEAK_GROUP_EXTENSION = _("Extensions")
TWEAK_GROUP_FONTS = _("Fonts")
-TWEAK_GROUP_KEYBOARD = _("Keyboard Layout")
TWEAK_GROUP_POWER = _("Power")
TWEAK_GROUP_APPLICATION = _("Startup Applications")
TWEAK_GROUP_TOPBAR = _("Top Bar")
diff --git a/gtweak/tweaks/tweak_group_interface.py b/gtweak/tweaks/tweak_group_interface.py
index 6ef0546..6bc1810 100644
--- a/gtweak/tweaks/tweak_group_interface.py
+++ b/gtweak/tweaks/tweak_group_interface.py
@@ -27,7 +27,7 @@ from gi.repository import GLib
import gtweak
from gtweak.utils import walk_directories, make_combo_list_with_default, extract_zip_file
-from gtweak.tweakmodel import Tweak, TWEAK_GROUP_APPEARANCE, TWEAK_GROUP_KEYBOARD,TWEAK_SORT_LAST
+from gtweak.tweakmodel import Tweak, TWEAK_GROUP_APPEARANCE, TWEAK_SORT_LAST
from gtweak.gshellwrapper import GnomeShellFactory
from gtweak.gsettings import GSettingsSetting
from gtweak.widgets import ListBoxTweakGroup, GSettingsSwitchTweak, GSettingsComboTweak, DarkThemeSwitcher,
Title, build_combo_box_text,build_label_beside_widget, FileChooserButton
@@ -90,27 +90,6 @@ class CursorThemeSwitcher(GSettingsComboTweak):
os.path.exists(os.path.join(d, "cursors")))
return valid
-class KeyThemeSwitcher(GSettingsComboTweak):
- def __init__(self, **options):
- GSettingsComboTweak.__init__(self,
- _("Key"),
- "org.gnome.desktop.interface",
- "gtk-key-theme",
- make_combo_list_with_default(
- self._get_valid_key_themes(),
- "Default",
- default_text=_("<i>Default</i>")),
- **options)
-
- 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
-
class WindowThemeSwitcher(GSettingsComboTweak):
def __init__(self, **options):
GSettingsComboTweak.__init__(self,
@@ -299,7 +278,4 @@ TWEAK_GROUPS = [
CursorThemeSwitcher(),
ShellThemeTweak(loaded=_shell_loaded),
),
- ListBoxTweakGroup(TWEAK_GROUP_KEYBOARD,
- KeyThemeSwitcher(),
- ),
]
diff --git a/gtweak/tweaks/tweak_group_keymouse.py b/gtweak/tweaks/tweak_group_keymouse.py
new file mode 100644
index 0000000..0aeba81
--- /dev/null
+++ b/gtweak/tweaks/tweak_group_keymouse.py
@@ -0,0 +1,81 @@
+# This file is part of gnome-tweak-tool.
+#
+# Copyright (c) 2011 John Stowers
+#
+# gnome-tweak-tool is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (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/>.
+
+import os.path
+
+from gi.repository import GLib, Gtk
+
+import gtweak
+from gtweak.tweakmodel import Tweak
+from gtweak.utils import XSettingsOverrides, walk_directories, make_combo_list_with_default
+from gtweak.widgets import ListBoxTweakGroup, GSettingsComboTweak, GSettingsSwitchTweak, Title,
build_label_beside_widget
+
+class PrimaryPasteTweak(Gtk.Box, Tweak):
+ def __init__(self, **options):
+ Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL)
+
+ name = _("Middle-click Paste")
+ description = ""
+ Tweak.__init__(self, name, description, **options)
+
+ self._xsettings = XSettingsOverrides()
+
+ sw = Gtk.Switch()
+ sw.set_active(self._xsettings.get_enable_primary_paste())
+ sw.connect("notify::active", self._on_toggled)
+
+ build_label_beside_widget(
+ name,
+ sw,
+ hbox=self)
+
+
+ def _on_toggled(self, sw, pspec):
+ self._xsettings.set_enable_primary_paste(sw.get_active())
+
+class KeyThemeSwitcher(GSettingsComboTweak):
+ def __init__(self, **options):
+ GSettingsComboTweak.__init__(self,
+ _("Key theme"),
+ "org.gnome.desktop.interface",
+ "gtk-key-theme",
+ make_combo_list_with_default(
+ self._get_valid_key_themes(),
+ "Default",
+ default_text=_("<i>Default</i>")),
+ **options)
+
+ 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(),
+ 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(),
+ ),
+]
diff --git a/gtweak/tweaks/tweak_group_legacy.py b/gtweak/tweaks/tweak_group_legacy.py
index 24c136e..34186ae 100644
--- a/gtweak/tweaks/tweak_group_legacy.py
+++ b/gtweak/tweaks/tweak_group_legacy.py
@@ -145,11 +145,6 @@ TWEAK_GROUPS = [
ListBoxTweakGroup(_("Legacy"),
Title(_("Files"), "", uid="title-theme"),
GSettingsSwitchTweak(_("Use location entry"), "org.gnome.nautilus.preferences",
"always-use-location-entry",schema_filename="org.gnome.nautilus.gschema.xml"),
- Title(_("Mouse"), "", uid="title-theme"),
- GSettingsSwitchTweak(_("Show location of pointer"),
- "org.gnome.settings-daemon.peripherals.mouse",
- "locate-pointer",
- schema_filename="org.gnome.settings-daemon.peripherals.gschema.xml"),
Title(_("Power"), "", uid="title-theme"),
GSettingsSwitchTweak(_("Laptop lid, when closed, will suspend even if there is an external monitor
plugged in"),"org.gnome.settings-daemon.plugins.power", "lid-close-suspend-with-external-monitor"),
GSettingsComboEnumTweak(_("Whether to turn off specific monitors after
boot"),"org.gnome.settings-daemon.plugins.xrandr", "default-monitors-setup"),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]