clipmenu

Simple clipboard management using dmenu
git clone https://git.sinitax.com/cdown/clipmenu
Log | Files | Refs | README | LICENSE | sfeed.txt

commit 2cbfb4ef88abc0d13e774b28279123cfd6818dd2
parent c40456caa030f1bbaa93a3621782892af9e2af46
Author: Chris Down <chris@chrisdown.name>
Date:   Sun,  8 Feb 2015 17:36:06 +0000

Add xclip support

Fixes #1. As first suggested in a fork by @milouse.

Diffstat:
Mclipmenu | 6+++++-
Mclipmenud | 7++++++-
2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/clipmenu b/clipmenu @@ -22,5 +22,9 @@ chosen_line=$(printf '%s\n' "${!selections[@]}" | dmenu -l "$dmenu_lines" "$@") [[ $chosen_line ]] || exit 1 for selection in clipboard primary; do - xsel --"$selection" < "${selections[$chosen_line]}" + if type -p xsel >/dev/null 2>&1; then + xsel --"$selection" < "${selections[$chosen_line]}" + else + xclip -sel "$selection" < "${selections[$chosen_line]}" + fi done diff --git a/clipmenud b/clipmenud @@ -7,7 +7,12 @@ declare -A last_data while sleep 1; do for selection in clipboard primary; do - data=$(xsel --"$selection"; printf x) + if type -p xsel >/dev/null 2>&1; then + data=$(xsel --"$selection"; printf x) + else + data=$(xclip -o -sel "$selection"; printf x) + fi + data=${data%x} [[ $data ]] || continue