commit d8dbb1d5af93eb6e89b0cb38f401a4bce38e4425
parent 6facea933bb46052c0ea69da4b19f1bf939eb1b9
Author: Chris Down <chris@chrisdown.name>
Date: Fri, 17 Mar 2017 01:14:06 +0000
Use wrapper for xsel to avoid having to pass --logfile again and again
Diffstat:
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/clipmenud b/clipmenud
@@ -6,6 +6,10 @@ cache_file=$cache_dir/line_cache
lock_file=$cache_dir/lock
lock_timeout=2
+_xsel() {
+ xsel --logfile /dev/null "$@"
+}
+
get_first_line() {
# Args:
# - $1, the file or data
@@ -65,7 +69,7 @@ while sleep "${CLIPMENUD_SLEEP:-0.5}"; do
fi
for selection in clipboard primary; do
- data=$(xsel --logfile /dev/null -o --"$selection"; printf x)
+ data=$(_xsel -o --"$selection"; printf x)
debug "Data before stripping: $data"
@@ -118,7 +122,7 @@ while sleep "${CLIPMENUD_SLEEP:-0.5}"; do
# We can't colocate this with the above copying code because
# https://github.com/cdown/clipmenu/issues/34 requires knowing if
# we would skip first.
- xsel --logfile /dev/null -o --"$selection" | xsel --logfile /dev/null -i --"$selection"
+ _xsel -o --"$selection" | _xsel -i --"$selection"
fi
done