1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-21 21:21:06 +00:00

pantheon.switchboard-plug-mouse-touchpad: 2.1.4 -> 2.2.0

Uses org.gnome.settings-daemon.plugins.xsettings
for middle click paste. I've hardcoded this with a patch.

https://github.com/elementary/switchboard-plug-mouse-touchpad/releases/tag/2.2.0
This commit is contained in:
worldofpeace 2019-04-11 21:08:57 -04:00
parent cb3579d8c4
commit 97eb1c1af8
2 changed files with 75 additions and 4 deletions

View file

@ -1,17 +1,25 @@
{ stdenv, fetchFromGitHub, pantheon, fetchpatch, meson, ninja
, pkgconfig, vala, libgee, granite, gtk3, switchboard, gobject-introspection }:
{ stdenv, fetchFromGitHub, pantheon, fetchpatch, meson, ninja, pkgconfig, vala
, libgee, granite, gtk3, switchboard, elementary-settings-daemon, gobject-introspection }:
stdenv.mkDerivation rec {
pname = "switchboard-plug-mouse-touchpad";
version = "2.1.4";
version = "2.2.0";
src = fetchFromGitHub {
owner = "elementary";
repo = pname;
rev = version;
sha256 = "1zh5472ab01bckrc1py5bqqsal9i9pbgx6i8ap2d4yzhc8sirjrf";
sha256 = "0mr25p7j5hl8zmvz5i3g30s4xbdhk6d22lw2akch3si40il9q5fv";
};
patches = [
./hardcode-settings-daemon-gsettings.patch
];
postPatch = ''
substituteInPlace src/Views/General.vala --subst-var-by GSD_GSETTINGS ${elementary-settings-daemon}/share/gsettings-schemas/${elementary-settings-daemon.name}/glib-2.0/schemas
'';
passthru = {
updateScript = pantheon.updateScript {
repoName = pname;

View file

@ -0,0 +1,63 @@
diff --git a/src/Views/General.vala b/src/Views/General.vala
index 4b19b73..dfa3d4d 100644
--- a/src/Views/General.vala
+++ b/src/Views/General.vala
@@ -138,32 +138,34 @@ public class MouseTouchpad.GeneralView : Gtk.Grid {
attach (pointer_speed_scale, 3, 8);
attach (pointer_speed_help, 1, 9, 3);
- var xsettings_schema = SettingsSchemaSource.get_default ().lookup ("org.gnome.settings-daemon.plugins.xsettings", false);
- if (xsettings_schema != null) {
- var primary_paste_switch = new Gtk.Switch ();
- primary_paste_switch.halign = Gtk.Align.START;
-
- var primary_paste_help = new Gtk.Label (_("Middle or three-finger clicking on an input will paste any selected text"));
- primary_paste_help.margin_bottom = 18;
- primary_paste_help.wrap = true;
- primary_paste_help.xalign = 0;
- primary_paste_help.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL);
-
- attach (new SettingLabel (_("Middle click paste:")), 0, 4);
- attach (primary_paste_switch, 1, 4);
- attach (primary_paste_help, 1, 5, 3);
-
- var xsettings = new GLib.Settings ("org.gnome.settings-daemon.plugins.xsettings");
- primary_paste_switch.notify["active"].connect (() => on_primary_paste_switch_changed (primary_paste_switch, xsettings));
-
- var current_value = xsettings.get_value ("overrides").lookup_value ("Gtk/EnablePrimaryPaste", VariantType.INT32);
- if (current_value != null) {
- primary_paste_switch.active = current_value.get_int32 () == 1;
- }
+ var primary_paste_switch = new Gtk.Switch ();
+ primary_paste_switch.halign = Gtk.Align.START;
+
+ var primary_paste_help = new Gtk.Label (_("Middle or three-finger clicking on an input will paste any selected text"));
+ primary_paste_help.margin_bottom = 18;
+ primary_paste_help.wrap = true;
+ primary_paste_help.xalign = 0;
+ primary_paste_help.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL);
+
+ attach (new SettingLabel (_("Middle click paste:")), 0, 4);
+ attach (primary_paste_switch, 1, 4);
+ attach (primary_paste_help, 1, 5, 3);
+
+ SettingsSchemaSource daemon_schema_source = new SettingsSchemaSource.from_directory ("@GSD_GSETTINGS@", null, true);
+ SettingsSchema xsettings_schema = daemon_schema_source.lookup ("org.gnome.settings-daemon.plugins.xsettings", false);
+
+ var xsettings = new GLib.Settings.full (xsettings_schema, null, null);
+ primary_paste_switch.notify["active"].connect (() => on_primary_paste_switch_changed (primary_paste_switch, xsettings));
+
+ var current_value = xsettings.get_value ("overrides").lookup_value ("Gtk/EnablePrimaryPaste", VariantType.INT32);
+ if (current_value != null) {
+ primary_paste_switch.active = current_value.get_int32 () == 1;
}
- var daemon_settings = new GLib.Settings ("org.gnome.settings-daemon.peripherals.mouse");
- daemon_settings.bind ("locate-pointer", reveal_pointer_switch, "active", GLib.SettingsBindFlags.DEFAULT);
+ SettingsSchema daemon_mouse_schema = daemon_schema_source.lookup ("org.gnome.settings-daemon.peripherals.mouse", false);
+
+ var daemon_mouse_settings = new GLib.Settings.full (daemon_mouse_schema, null, null);
+ daemon_mouse_settings.bind ("locate-pointer", reveal_pointer_switch, "active", GLib.SettingsBindFlags.DEFAULT);
var a11y_mouse_settings = new GLib.Settings ("org.gnome.desktop.a11y.mouse");
a11y_mouse_settings.bind ("secondary-click-enabled", hold_switch, "active", GLib.SettingsBindFlags.DEFAULT);