mirror of
https://github.com/frebib/dotfiles.git
synced 2024-06-14 12:57:23 +00:00
scripts/screenshot: add --active and --clip args
--active uses the active window as selection boundary, instead of the root window, or prompting for a window selection --clip adds the image to the clipboard and exits without uploading Signed-off-by: Joe Groocock <me@frebib.net>
This commit is contained in:
parent
308eff050e
commit
b52496bbb3
@ -43,6 +43,9 @@ args=(-g "$geom")
|
|||||||
if xwininfo -id "$winid" | grep -qw root; then
|
if xwininfo -id "$winid" | grep -qw root; then
|
||||||
isroot=1
|
isroot=1
|
||||||
args+=(-i "$winid")
|
args+=(-i "$winid")
|
||||||
|
elif [ "$1" == "--active" -o "$1" == "-a" ]; then
|
||||||
|
args+=(-i "$(xdotool getactivewindow)")
|
||||||
|
shift
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Take the screenshot and save it
|
# Take the screenshot and save it
|
||||||
@ -57,10 +60,15 @@ if [ "$isroot" != "1" ]; then
|
|||||||
convert "$out_path" \( +clone -background black -alpha set -channel Alpha -evaluate set 60% -shadow 100x16+0+0 \) +swap -background none -layers merge +repage "$out_path" || :
|
convert "$out_path" \( +clone -background black -alpha set -channel Alpha -evaluate set 60% -shadow 100x16+0+0 \) +swap -background none -layers merge +repage "$out_path" || :
|
||||||
fi
|
fi
|
||||||
|
|
||||||
notif_id=$(send_notification "Screenshot uploading" "$FILENAME<br><br>The image is available in the clipboard immediately" || true)
|
if [ "$1" == "--clip" -o "$1" == "-c" ]; then
|
||||||
|
# Add image to clipboard
|
||||||
|
xclip -i "$out_path" -selection clipboard -t image/png
|
||||||
|
send_notification "Screenshot captured" "$FILENAME<br><br>The image is available in the clipboard"
|
||||||
|
|
||||||
# Add image to clipboard
|
exit 0
|
||||||
xclip -i "$out_path" -selection clipboard -t image/png
|
fi
|
||||||
|
|
||||||
|
notif_id=$(send_notification "Screenshot uploading" "$FILENAME" || true)
|
||||||
|
|
||||||
# 'Upload' the screenshot
|
# 'Upload' the screenshot
|
||||||
if ! error=$(scp -C $out_path $SCP_HOST:$SCP_PATH 2>&1); then
|
if ! error=$(scp -C $out_path $SCP_HOST:$SCP_PATH 2>&1); then
|
||||||
|
Loading…
Reference in New Issue
Block a user