Copy from both clipboard and primary selections

This commit is contained in:
Chris Down 2014-02-05 17:45:23 +08:00
parent 65f0b277ec
commit dd9a041846

View file

@ -1,15 +1,15 @@
#!/bin/bash #!/bin/bash
selection=${1-clipboard}
cache_dir=/tmp/clipmenu/ cache_dir=/tmp/clipmenu/
mkdir -p "$cache_dir" mkdir -p "$cache_dir"
while sleep 1; do while sleep 1; do
for selection in clipboard primary; do
data=$(xsel --"$selection"; printf x) data=$(xsel --"$selection"; printf x)
data=${data%x} data=${data%x}
md5=$(md5sum <<< "$data") md5=$(md5sum <<< "$data")
md5=${md5%% *} md5=${md5%% *}
cat > "$cache_dir/$md5" <<< "$data" cat > "$cache_dir/$md5" <<< "$data"
done
done done