dotfiles/home/default/.local/bin/convert-paste-png.sh

12 lines
359 B
Bash
Raw Normal View History

#!/bin/sh
wl-paste -t image > /tmp/convert-paste-png.data
#convert /tmp/convert-paste-png.data -format png "$1"
case "$(file --dereference --brief --mime-type -- "/tmp/convert-paste-png.data")" in
image/jpg|image/jpeg) convert /tmp/convert-paste-png.data -format png "$1" ;;
image/png) wl-paste -t image/png > "$1" ;;
esac
rm /tmp/convert-paste-png.data