commit e8e24b80e8965ca4d4e1879416a4a486c87e2070 parent 38262946429c905cc8f153aeebd8d2f691a6f6e3 Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Wed, 9 Sep 2020 07:54:06 +0200 Offer to convert to jpg and put output filename into X selection Diffstat:
M | .local/bin/maimpick | | | 17 | +++++++++++++---- |
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/.local/bin/maimpick b/.local/bin/maimpick @@ -2,13 +2,22 @@ set -e c="$(printf 'area\nwindow\nscreen' | dmenu -i)" -out="$(printf '%s/tmp/pic-%s-%s.png' "$HOME" "$c" "$(date '+%y-%m-%d_%H:%M:%S')" | dmenu -l 1 -p "outfile:")" +out="$(printf 'tmp/pic-%s-%s.png' "$c" "$(date '+%y-%m-%d_%H:%M:%S')" | dmenu -l 1 -p "outfile:")" case "$c" in - "area") + area) maim --hidecursor -s "$out" ;; - "window") + window) maim --hidecursor -i "$(xdotool getactivewindow)" "$out" ;; - "screen") + screen) maim "$out" ;; esac + +c="$(printf 'no\nyes' | dmenu -i -p "convert to jpg?")" +case "$c" in + yes) + convert "$out" "${out%.png}.jpg" + out"${out%.png}.jpg";; +esac + +printf '%s/%s' "$HOME" "$out" | xclip -i