[gnome-tweaks/117-reword-touchpad-click-method-section: 3/3] keymouse: Redesign Mouse Click Emulation section
- From: Jeremy Bicha <jbicha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tweaks/117-reword-touchpad-click-method-section: 3/3] keymouse: Redesign Mouse Click Emulation section
- Date: Tue, 30 Jan 2018 18:42:45 +0000 (UTC)
commit ba06c5316cc3d5ce5ba581b1a5f46c0a38603262
Author: Jeremy Bicha <jbicha ubuntu com>
Date: Mon Jan 29 08:50:05 2018 -0500
keymouse: Redesign Mouse Click Emulation section
Closes: https://gitlab.gnome.org/GNOME/gnome-tweaks/issues/117
gtweak/tweaks/tweak_group_keymouse.py | 119 ++++++++++++++++++++++++++++++++--
1 file changed, 114 insertions(+), 5 deletions(-)
---
diff --git a/gtweak/tweaks/tweak_group_keymouse.py b/gtweak/tweaks/tweak_group_keymouse.py
index d8cc4ae..07effe7 100644
--- a/gtweak/tweaks/tweak_group_keymouse.py
+++ b/gtweak/tweaks/tweak_group_keymouse.py
@@ -4,7 +4,7 @@
import os.path
-from gi.repository import GLib, Gtk, Gdk
+from gi.repository import Gio, GLib, Gtk, Gdk
import gtweak
from gtweak.gsettings import GSettingsSetting
@@ -247,6 +247,117 @@ class AdditionalLayoutButton(Gtk.Box, Tweak):
dialog.add(scrolled_window)
dialog.show_all()
+class ClickMethod(Gtk.ListBox, Tweak):
+
+ def __init__(self, **options):
+ Gtk.ListBox.__init__(self)
+ Tweak.__init__(self, _("Mouse Click Emulation"), _("Mouse Click Emulation"))
+
+ self.settings = Gio.Settings("org.gnome.desktop.peripherals.touchpad")
+ self.key_name = "click-method"
+
+ self.set_selection_mode(Gtk.SelectionMode.NONE)
+
+ # Needs other page elements to get margins too
+ # self.props.margin_left = 50
+ # self.props.margin_right = 50
+
+ row = Gtk.ListBoxRow()
+ hbox = Gtk.Box()
+ hbox.props.margin = 10
+ row.add(hbox)
+
+ vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
+
+ lbl = Gtk.Label(_("Fingers"), xalign=0)
+ lbl.props.xalign = 0.0
+ desc = _("Click the touchpad with two fingers for right-click and three fingers for middle-click.")
+ lbl_desc = Gtk.Label()
+ lbl_desc.set_line_wrap(True)
+ lbl_desc.get_style_context().add_class("dim-label")
+ lbl_desc.set_markup("<span size='small'>"+GLib.markup_escape_text(desc)+"</span>")
+
+ self.check_fingers = Gtk.Image.new_from_icon_name("object-select-symbolic",
Gtk.IconSize.SMALL_TOOLBAR);
+ self.check_fingers.set_no_show_all(True)
+ self.check_fingers.set_visible(self.settings[self.key_name] == "fingers")
+
+ vbox.pack_start(lbl, False, False, 0)
+ vbox.pack_start(lbl_desc, False, False, 0)
+ hbox.pack_start(vbox, False, False, 0)
+ hbox.pack_end(self.check_fingers, False, False, 0)
+
+ self.add(row)
+
+ row = Gtk.ListBoxRow()
+ hbox = Gtk.Box()
+ hbox.props.margin = 10
+ row.add(hbox)
+
+ vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
+
+ lbl = Gtk.Label(_("Area"), xalign=0)
+ lbl.props.xalign = 0.0
+ desc = _("Click the bottom right of the touchpad for right-click and the bottom middle for
middle-click.")
+ lbl_desc = Gtk.Label()
+ lbl_desc.set_line_wrap(True)
+ lbl_desc.get_style_context().add_class("dim-label")
+ lbl_desc.set_markup("<span size='small'>"+GLib.markup_escape_text(desc)+"</span>")
+
+ self.check_area = Gtk.Image.new_from_icon_name("object-select-symbolic", Gtk.IconSize.SMALL_TOOLBAR);
+ self.check_area.set_no_show_all(True)
+ self.check_area.set_visible(self.settings[self.key_name] == "areas")
+
+ vbox.pack_start(lbl, False, False, 0)
+ vbox.pack_start(lbl_desc, False, False, 0)
+ hbox.pack_start(vbox, False, False, 0)
+ hbox.pack_end(self.check_area, False, False, 0)
+
+ self.add(row)
+
+ row = Gtk.ListBoxRow()
+ hbox = Gtk.Box()
+ hbox.props.margin = 10
+ row.add(hbox)
+
+ vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
+
+ lbl = Gtk.Label(_("Disabled"), xalign=0)
+ lbl.props.xalign = 0.0
+ desc = _("Don't use mouse click emulation.")
+ lbl_desc = Gtk.Label()
+ lbl_desc.set_line_wrap(True)
+ lbl_desc.get_style_context().add_class("dim-label")
+ lbl_desc.set_markup("<span size='small'>"+GLib.markup_escape_text(desc)+"</span>")
+
+ self.check_disabled = Gtk.Image.new_from_icon_name("object-select-symbolic",
Gtk.IconSize.SMALL_TOOLBAR);
+ self.check_disabled.set_no_show_all(True)
+ self.check_disabled.set_visible(self.settings[self.key_name] == "none")
+
+ vbox.pack_start(lbl, False, False, 0)
+ vbox.pack_start(lbl_desc, False, False, 0)
+ hbox.pack_start(vbox, False, False, 0)
+ hbox.pack_end(self.check_disabled, False, False, 0)
+
+ self.add(row)
+ self.connect('row-activated', self.on_row_clicked)
+
+ def on_row_clicked(self, box, row):
+ if row.get_index() == 0:
+ self.settings[self.key_name] = "fingers"
+ self.check_fingers.show()
+ self.check_area.hide()
+ 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"),
@@ -275,13 +386,11 @@ TWEAK_GROUPS = [
"gtk-enable-primary-paste"),
Title(_("Touchpad"), ""),
- GSettingsComboEnumTweak(_("Click Method"),
- "org.gnome.desktop.peripherals.touchpad",
- "click-method",
- schema_filename="org.gnome.desktop.peripherals.gschema.xml"),
GSettingsSwitchTweak(_("Disable While Typing"),
"org.gnome.desktop.peripherals.touchpad",
"disable-while-typing",
schema_filename="org.gnome.desktop.peripherals.gschema.xml"),
+ Title(_("Mouse Click Emulation"), _("Mouse Click Emulation"), top=True),
+ ClickMethod(),
),
]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]