diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-11-26 17:44:03 +0100 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-11-26 17:49:47 +0100 |
commit | 022418881b5928a0f345bc90812c094019477981 (patch) | |
tree | 052e2a5d0f0bdba19f65c22270e0ec8117f5ae71 | |
parent | feat(modules/legacy/default): Move the download dir to `/tmp` (diff) | |
download | nixos-config-022418881b5928a0f345bc90812c094019477981.tar.gz nixos-config-022418881b5928a0f345bc90812c094019477981.zip |
feat(modules/lf): Add `set_clipboard_path` command and keybinding prime
-rw-r--r-- | modules/by-name/lf/lf/commands/default.nix | 4 | ||||
-rwxr-xr-x | modules/by-name/lf/lf/commands/scripts/set_clipboard_path.sh | 23 | ||||
-rw-r--r-- | modules/by-name/lf/lf/keybindings/default.nix | 1 |
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"; |