about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorVasyl Solovei <svsdep@gmail.com>2018-02-22 17:25:20 +0200
committerVasyl Solovei <svsdep@gmail.com>2018-02-22 17:30:42 +0200
commit18691c6b6578c02607357626e27a1088a086d60c (patch)
tree0eba8f1e90606b97527b9e65d1430e11d3bdad5a /pkgs
parent844a494d809a9414a7850072c7d0f8f8f45710b2 (diff)
downloadnixlib-18691c6b6578c02607357626e27a1088a086d60c.tar
nixlib-18691c6b6578c02607357626e27a1088a086d60c.tar.gz
nixlib-18691c6b6578c02607357626e27a1088a086d60c.tar.bz2
nixlib-18691c6b6578c02607357626e27a1088a086d60c.tar.lz
nixlib-18691c6b6578c02607357626e27a1088a086d60c.tar.xz
nixlib-18691c6b6578c02607357626e27a1088a086d60c.tar.zst
nixlib-18691c6b6578c02607357626e27a1088a086d60c.zip
keepass: fix auto-type and clipboard features
This fixes paths to `xdotool`, `xprop` and `xsel`. These are required
tools for auto-type to work correctly.
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/applications/misc/keepass/default.nix12
-rw-r--r--pkgs/applications/misc/keepass/fix-paths.patch87
2 files changed, 98 insertions, 1 deletions
diff --git a/pkgs/applications/misc/keepass/default.nix b/pkgs/applications/misc/keepass/default.nix
index bee86cb0ed39..911be6721acb 100644
--- a/pkgs/applications/misc/keepass/default.nix
+++ b/pkgs/applications/misc/keepass/default.nix
@@ -1,4 +1,5 @@
-{ stdenv, lib, fetchurl, buildDotnetPackage, makeWrapper, unzip, makeDesktopItem, icoutils, gtk2, plugins ? [] }:
+{ stdenv, lib, fetchurl, buildDotnetPackage, substituteAll, makeWrapper, makeDesktopItem,
+  unzip, icoutils, gtk2, xorg, xdotool, xsel, plugins ? [] }:
 
 # KeePass looks for plugins in under directory in which KeePass.exe is
 # located. It follows symlinks where looking for that directory, so
@@ -19,6 +20,15 @@ with builtins; buildDotnetPackage rec {
 
   buildInputs = [ unzip makeWrapper icoutils ];
 
+  patches = [
+    (substituteAll {
+      src = ./fix-paths.patch;
+      xsel = "${xsel}/bin/xsel";
+      xprop = "${xorg.xprop}/bin/xprop";
+      xdotool = "${xdotool}/bin/xdotool";
+    })
+  ];
+
   preConfigure = ''
     rm -rvf Build/*
     find . -name "*.sln" -print -exec sed -i 's/Format Version 10.00/Format Version 11.00/g' {} \;
diff --git a/pkgs/applications/misc/keepass/fix-paths.patch b/pkgs/applications/misc/keepass/fix-paths.patch
new file mode 100644
index 000000000000..318f8a358985
--- /dev/null
+++ b/pkgs/applications/misc/keepass/fix-paths.patch
@@ -0,0 +1,87 @@
+diff --git a/KeePass/Native/NativeMethods.Unix.cs b/KeePass/Native/NativeMethods.Unix.cs
+index 7495a1c..4ef4727 100644
+--- a/KeePass/Native/NativeMethods.Unix.cs
++++ b/KeePass/Native/NativeMethods.Unix.cs
+@@ -128,7 +128,7 @@ namespace KeePass.Native
+ 			try

+ 			{

+ 				Application.DoEvents(); // E.g. for clipboard updates

+-				string strOutput = NativeLib.RunConsoleApp("xdotool", strParams);

++				string strOutput = NativeLib.RunConsoleApp("@xdotool@", strParams);

+ 				Application.DoEvents(); // E.g. for clipboard updates

+ 				return (strOutput ?? string.Empty);

+ 			}

+diff --git a/KeePass/Util/ClipboardUtil.Unix.cs b/KeePass/Util/ClipboardUtil.Unix.cs
+index e93a22a..3fd9a2b 100644
+--- a/KeePass/Util/ClipboardUtil.Unix.cs
++++ b/KeePass/Util/ClipboardUtil.Unix.cs
+@@ -62,7 +62,7 @@ namespace KeePass.Util
+ 			//	"-out -selection clipboard");

+ 			// if(str != null) return str;

+ 

+-			string str = NativeLib.RunConsoleApp("xsel",

++			string str = NativeLib.RunConsoleApp("@xsel@",

+ 				"--output --clipboard", null, XSelFlags);

+ 			if(str != null) return str;

+ 

+@@ -83,10 +83,10 @@ namespace KeePass.Util
+ 			if(string.IsNullOrEmpty(str))

+ 			{

+ 				// xsel with an empty input can hang, thus use --clear

+-				if(NativeLib.RunConsoleApp("xsel", "--clear --primary",

++				if(NativeLib.RunConsoleApp("@xsel@", "--clear --primary",

+ 					null, XSelFlags) != null)

+ 				{

+-					NativeLib.RunConsoleApp("xsel", "--clear --clipboard",

++					NativeLib.RunConsoleApp("@xsel@", "--clear --clipboard",

+ 						null, XSelFlags);

+ 					return;

+ 				}

+@@ -97,10 +97,10 @@ namespace KeePass.Util
+ 			}

+ 

+ 			// xsel does not support --primary and --clipboard together

+-			if(NativeLib.RunConsoleApp("xsel", "--input --primary",

++			if(NativeLib.RunConsoleApp("@xsel@", "--input --primary",

+ 				str, XSelFlags) != null)

+ 			{

+-				NativeLib.RunConsoleApp("xsel", "--input --clipboard",

++				NativeLib.RunConsoleApp("@xsel@", "--input --clipboard",

+ 					str, XSelFlags);

+ 				return;

+ 			}

+diff --git a/KeePassLib/Native/ClipboardU.cs b/KeePassLib/Native/ClipboardU.cs
+index ddd8f57..150eb82 100644
+--- a/KeePassLib/Native/ClipboardU.cs
++++ b/KeePassLib/Native/ClipboardU.cs
+@@ -27,7 +27,7 @@ namespace KeePassLib.Native
+ {

+ 	internal static class ClipboardU

+ 	{

+-		private const string XSel = "xsel";

++		private const string XSel = "@xsel@";

+ 		private const string XSelV = "--version";

+ 		private const string XSelR = "--output --clipboard";

+ 		private const string XSelC = "--clear --clipboard";

+diff --git a/KeePassLib/Utility/MonoWorkarounds.cs b/KeePassLib/Utility/MonoWorkarounds.cs
+index 0da7019..f6a1022 100644
+--- a/KeePassLib/Utility/MonoWorkarounds.cs
++++ b/KeePassLib/Utility/MonoWorkarounds.cs
+@@ -41,7 +41,7 @@ namespace KeePassLib.Utility
+ {

+ 	public static class MonoWorkarounds

+ 	{

+-		private const string AppXDoTool = "xdotool";

++		private const string AppXDoTool = "@xdotool@";

+ 

+ 		private static Dictionary<uint, bool> g_dForceReq = new Dictionary<uint, bool>();

+ 		private static Thread g_thFixClip = null;

+@@ -303,7 +303,7 @@ namespace KeePassLib.Utility
+ 				// }

+ 				// else { Debug.Assert(false); }

+ 

+-				string strWmClass = (NativeLib.RunConsoleApp("xprop",

++				string strWmClass = (NativeLib.RunConsoleApp("@xprop@",

+ 					"-id " + strHandle + " WM_CLASS") ?? string.Empty);

+ 

+ 				if(strWmClass.IndexOf("\"" + PwDefs.ResClass + "\"",