mirror of
https://github.com/swaywm/sway.git
synced 2026-04-22 06:46:27 -04:00
parent
5411ed4ef0
commit
6e314e1e9e
3 changed files with 29 additions and 3 deletions
|
|
@ -21,6 +21,7 @@ getTargetDirectory() {
|
||||||
|
|
||||||
NOTIFY=no
|
NOTIFY=no
|
||||||
CURSOR=
|
CURSOR=
|
||||||
|
WAIT=no
|
||||||
|
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
key="$1"
|
key="$1"
|
||||||
|
|
@ -34,6 +35,15 @@ while [ $# -gt 0 ]; do
|
||||||
CURSOR=yes
|
CURSOR=yes
|
||||||
shift # past argument
|
shift # past argument
|
||||||
;;
|
;;
|
||||||
|
-w|--wait)
|
||||||
|
shift
|
||||||
|
WAIT="$1"
|
||||||
|
if echo "$WAIT" | grep "[^0-9]" -q; then
|
||||||
|
echo "invalid value for wait '$WAIT'" >&2
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
;;
|
||||||
*) # unknown option
|
*) # unknown option
|
||||||
break # done with parsing --flags
|
break # done with parsing --flags
|
||||||
;;
|
;;
|
||||||
|
|
@ -46,7 +56,7 @@ FILE=${3:-$(getTargetDirectory)/$(date -Ins).png}
|
||||||
|
|
||||||
if [ "$ACTION" != "save" ] && [ "$ACTION" != "copy" ] && [ "$ACTION" != "check" ]; then
|
if [ "$ACTION" != "save" ] && [ "$ACTION" != "copy" ] && [ "$ACTION" != "check" ]; then
|
||||||
echo "Usage:"
|
echo "Usage:"
|
||||||
echo " grimshot [--notify] [--cursor] (copy|save) [active|screen|output|area|window] [FILE|-]"
|
echo " grimshot [--notify] [--cursor] [--wait N] (copy|save) [active|screen|output|area|window] [FILE|-]"
|
||||||
echo " grimshot check"
|
echo " grimshot check"
|
||||||
echo " grimshot usage"
|
echo " grimshot usage"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
@ -153,6 +163,10 @@ else
|
||||||
die "Unknown subject to take a screen shot from" "$SUBJECT"
|
die "Unknown subject to take a screen shot from" "$SUBJECT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$WAIT" != "no" ]; then
|
||||||
|
sleep "$WAIT"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$ACTION" = "copy" ] ; then
|
if [ "$ACTION" = "copy" ] ; then
|
||||||
takeScreenshot - "$GEOM" "$OUTPUT" | wl-copy --type image/png || die "Clipboard error"
|
takeScreenshot - "$GEOM" "$OUTPUT" | wl-copy --type image/png || die "Clipboard error"
|
||||||
notifyOk "$WHAT copied to buffer"
|
notifyOk "$WHAT copied to buffer"
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ grimshot - a helper for screenshots within sway
|
||||||
.P
|
.P
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.P
|
.P
|
||||||
\fBgrimshot\fR [--notify] [--cursor] (copy|save) [TARGET] [FILE]
|
\fBgrimshot\fR [--notify] [--cursor] [--wait N] (copy|save) [TARGET] [FILE]
|
||||||
.br
|
.br
|
||||||
\fBgrimshot\fR check
|
\fBgrimshot\fR check
|
||||||
.br
|
.br
|
||||||
|
|
@ -31,6 +31,13 @@ Show notifications to the user that a screenshot has been taken.\&
|
||||||
Include cursors in the screenshot.\&
|
Include cursors in the screenshot.\&
|
||||||
.P
|
.P
|
||||||
.RE
|
.RE
|
||||||
|
\fB--wait N\fR
|
||||||
|
.RS 4
|
||||||
|
Wait for N seconds before taking a screenshot.\& Waits after any
|
||||||
|
manual selection is made.\& Recommended to combine with --notify in
|
||||||
|
order to know when the screenshot has been taken.\&
|
||||||
|
.P
|
||||||
|
.RE
|
||||||
\fBsave\fR
|
\fBsave\fR
|
||||||
.RS 4
|
.RS 4
|
||||||
Save the screenshot into a regular file.\& Grimshot will write images
|
Save the screenshot into a regular file.\& Grimshot will write images
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ grimshot - a helper for screenshots within sway
|
||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
*grimshot* [--notify] [--cursor] (copy|save) [TARGET] [FILE]++
|
*grimshot* [--notify] [--cursor] [--wait N] (copy|save) [TARGET] [FILE]++
|
||||||
*grimshot* check++
|
*grimshot* check++
|
||||||
*grimshot* usage
|
*grimshot* usage
|
||||||
|
|
||||||
|
|
@ -18,6 +18,11 @@ grimshot - a helper for screenshots within sway
|
||||||
*--cursor*
|
*--cursor*
|
||||||
Include cursors in the screenshot.
|
Include cursors in the screenshot.
|
||||||
|
|
||||||
|
*--wait N*
|
||||||
|
Wait for N seconds before taking a screenshot. Waits after any
|
||||||
|
manual selection is made. Recommended to combine with --notify in
|
||||||
|
order to know when the screenshot has been taken.
|
||||||
|
|
||||||
*save*
|
*save*
|
||||||
Save the screenshot into a regular file. Grimshot will write image
|
Save the screenshot into a regular file. Grimshot will write image
|
||||||
files to *XDG_SCREENSHOTS_DIR* if this is set (or defined
|
files to *XDG_SCREENSHOTS_DIR* if this is set (or defined
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue