dotfiles/bin/copy

14 lines
318 B
Plaintext
Raw Permalink Normal View History

2019-05-03 09:45:06 +02:00
#!/usr/bin/env bash
2019-02-11 17:40:33 +01:00
if [ $# -eq 0 ]; then
xclip -selection c
else
file_type=$(file -b --mime-type "$1")
2024-02-07 15:42:32 +01:00
if [ "$file_type" = "image/jpg" ] || [ "$file_type" = "image/jpeg" ]; then
convert $1 png:- | xclip -selection c -t image/png
else
xclip -selection c -t $file_type < $1
fi
2019-02-11 17:40:33 +01:00
fi