Why didn't I do this properly earlier?

This commit is contained in:
Nox Sluijtman 2023-09-15 12:48:29 +02:00
parent f2f3935bf1
commit 41e6e146ca
3 changed files with 19 additions and 4 deletions

View file

@ -38,12 +38,18 @@ clip_focus(){
notify-send 'Maim utils' "Shot focussed window and sent it to the clipboard."
}
fancy(){
fancy_clip(){
# nicked straight from the maim README (https://github.com/naelstrof/maim#examples)
maim -st 9999999 | convert - \( +clone -background black -shadow 80x3+5+5 \) +swap -background none -layers merge +repage PNG:- | xclip -sel clip -t image/png
notify-send 'Maim utils' "Shot selection and sent it to the clipboard.\nBe aware that the selection process can be cancelled using any keypress and that this won't show up due to xclip eating the exit status."
}
fancy(){
# nicked straight from the maim README (https://github.com/naelstrof/maim#examples)
maim -st 9999999 | convert - \( +clone -background black -shadow 80x3+5+5 \) +swap -background none -layers merge +repage "$filename"
notify-send 'Maim utils' "Shot selection and sent it to the clipboard.\nBe aware that the selection process can be cancelled using any keypress and that this won't show up due to xclip eating the exit status."
}
usage(){
cat >&2 <<EOF
Usage: maim-utils <screenshot-type>
@ -80,5 +86,6 @@ case $1 in
clip-focus|focus-clip) clip_focus;;
open|show|screenshots) xdg-open $savedir;;
fancy) fancy;;
fancy-clip) fancy_clip;;
*) usage;;
esac

View file

@ -6,9 +6,9 @@ maim-utils - A few common screenshot options rolled into one script based on mai
# SYNOPSIS
*maim-utils* _<fullscreen|focus|selection>_
*maim-utils* _<fullscreen|focus|selection|fancy>_
*maim-utils* _<clip-fullscreen|clip-focus|clip-selection>_
*maim-utils* _<clip-fullscreen|clip-focus|clip-selection|fancy-clip>_
# DESCRIPTION
@ -36,6 +36,10 @@ This can be changed by setting the *$SCROTDIR* environment variable.
Take a screenshot of the currently focussed window and save it to the
screenshot directory.
*fancy*
Take a screenshot of a window and add a fancy looking dropshadow effect
using imagemagick.
*clip-fullscreen*, *clip-full* and *full-clip*
Take a screenshot of the entire screen and write it to the clipboard.
@ -43,6 +47,10 @@ This can be changed by setting the *$SCROTDIR* environment variable.
Take a screenshot of the currently focus window and write it to the
clipboard.
*fancy-clip*
Take a screenshot of a window, add a fancy looking dropshadow effect
using imagemagick and write it to the clipboard.
*clip-selection*, *clip-sel* and *sel-clip*
Take a screenshot based on a rectangular selection and write it to the
clipboard.

View file

@ -1,6 +1,6 @@
#compdef maim-utils _maim-utils
_arguments -C \
"1: :(focus fullscreen selection clip-selection clip-fullscreen clip-focus show fancy)" \
"1: :(focus fullscreen selection clip-selection clip-fullscreen clip-focus show fancy fancy-clip)" \
"*::args:->args"
_arguments : $arguments