about summary refs log tree commit diff stats
path: root/modules/by-name
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/by-name/lf/lf/commands/default.nix4
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/set_clipboard_path.sh23
-rw-r--r--modules/by-name/lf/lf/keybindings/default.nix1
3 files changed, 28 insertions, 0 deletions
diff --git a/modules/by-name/lf/lf/commands/default.nix b/modules/by-name/lf/lf/commands/default.nix
index 933769ac..b3c9acab 100644
--- a/modules/by-name/lf/lf/commands/default.nix
+++ b/modules/by-name/lf/lf/commands/default.nix
@@ -194,6 +194,10 @@ in {
         ;
     };
   };
+  set_clipboard_path = async {
+    name = "set_clipboard_path";
+    dependencies = [pkgs.wl-clipboard];
+  };
   set_wall_paper = pipe {
     name = "set_wall_paper";
     dependencies = [];
diff --git a/modules/by-name/lf/lf/commands/scripts/set_clipboard_path.sh b/modules/by-name/lf/lf/commands/scripts/set_clipboard_path.sh
new file mode 100755
index 00000000..460eeedb
--- /dev/null
+++ b/modules/by-name/lf/lf/commands/scripts/set_clipboard_path.sh
@@ -0,0 +1,23 @@
+#! /usr/bin/env dash
+
+# shellcheck source=/dev/null
+SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+
+# shellcheck disable=SC2269
+f="$f"
+# shellcheck disable=SC2269
+fx="$fx"
+# shellcheck disable=SC2269
+fs="$fs"
+# shellcheck disable=SC2269
+id="$id"
+
+if [ -n "$fx" ]; then
+    echo "$fx" | wl-copy --trim-newline
+elif [ -n "$f" ]; then
+    echo "$f" | wl-copy --trim-newline
+else
+    lf -remote "send $id echo 'No file selected.'"
+fi
+
+# vim: ft=sh
diff --git a/modules/by-name/lf/lf/keybindings/default.nix b/modules/by-name/lf/lf/keybindings/default.nix
index b6feffe3..7ae720e0 100644
--- a/modules/by-name/lf/lf/keybindings/default.nix
+++ b/modules/by-name/lf/lf/keybindings/default.nix
@@ -30,6 +30,7 @@
   cc = "\$sudo -e \"$f\"";
   fe = "execute";
   fl = "follow_link";
+  cp = "set_clipboard_path";
 
   # Archive Mappings
   au = "unarchive";