commit 630e7a016c8339e9ce0385b33eb3a2f519d08b5c
parent 5b596aaf465226b7228ca2e09571b8ddc00566f6
Author: William Casarin <jb55@jb55.com>
Date: Thu, 30 May 2019 13:17:04 -0700
clipmenu: print selection to stdout
This allows you to use clipmenu in desktop scripts. For example you
could pipe the output of your narrowed selection to another command.
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/clipmenu b/clipmenu
@@ -23,6 +23,7 @@ Environment variables:
- $CM_DIR: specify the base directory to store the cache dir in (default: $XDG_RUNTIME_DIR, $TMPDIR, or /tmp)
- $CM_HISTLENGTH: specify the number of lines to show in dmenu/rofi (default: 8)
- $CM_LAUNCHER: specify a dmenu-compatible launcher (default: dmenu)
+- $CM_OUTPUT_CLIP: if set, output clip selection to stdout
EOF
exit 0
fi
@@ -52,3 +53,7 @@ file=$cache_dir/$(cksum <<< "$chosen_line")
for selection in clipboard primary; do
xsel --logfile /dev/null -i --"$selection" < "$file"
done
+
+if (( CM_OUTPUT_CLIP )); then
+ cat "$file"
+fi