mirror of
https://github.com/swaywm/sway.git
synced 2026-04-26 06:46:26 -04:00
grimshot - added option to 'save-copy' to save to file and copy to clipboard
This commit is contained in:
parent
e8e7bbc85f
commit
b6aba79abe
3 changed files with 32 additions and 18 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
# vim: set ts=2 sw=2 et :
|
||||||
|
|
||||||
## Grimshot: a helper for screenshots within sway
|
## Grimshot: a helper for screenshots within sway
|
||||||
## Requirements:
|
## Requirements:
|
||||||
|
|
@ -30,9 +31,9 @@ ACTION=${1:-usage}
|
||||||
SUBJECT=${2:-screen}
|
SUBJECT=${2:-screen}
|
||||||
FILE=${3:-$(getTargetDirectory)/$(date -Ins).png}
|
FILE=${3:-$(getTargetDirectory)/$(date -Ins).png}
|
||||||
|
|
||||||
if [ "$ACTION" != "save" ] && [ "$ACTION" != "copy" ] && [ "$ACTION" != "check" ]; then
|
if [ "$ACTION" != "save" ] && [ "$ACTION" != "copy" ] && [ "$ACTION" != "save-copy" ] && [ "$ACTION" != "check" ]; then
|
||||||
echo "Usage:"
|
echo "Usage:"
|
||||||
echo " grimshot [--notify] (copy|save) [active|screen|output|area|window] [FILE]"
|
echo " grimshot [--notify] (copy|save|save-copy) [active|screen|output|area|window] [FILE]"
|
||||||
echo " grimshot check"
|
echo " grimshot check"
|
||||||
echo " grimshot usage"
|
echo " grimshot usage"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
@ -148,6 +149,9 @@ else
|
||||||
MESSAGE=$(basename "$FILE")
|
MESSAGE=$(basename "$FILE")
|
||||||
notifyOk "$MESSAGE" "$TITLE"
|
notifyOk "$MESSAGE" "$TITLE"
|
||||||
echo $FILE
|
echo $FILE
|
||||||
|
if [ "$ACTION" = "save-copy" ] ; then
|
||||||
|
wl-copy --type image/png < "$FILE"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
notifyError "Error taking screenshot with grim"
|
notifyError "Error taking screenshot with grim"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
.\" Generated by scdoc 1.11.1
|
.\" Generated by scdoc 1.11.0
|
||||||
.\" Complete documentation for this program is not available as a GNU info page
|
.\" Complete documentation for this program is not available as a GNU info page
|
||||||
.ie \n(.g .ds Aq \(aq
|
.ie \n(.g .ds Aq \(aq
|
||||||
.el .ds Aq '
|
.el .ds Aq '
|
||||||
.nh
|
.nh
|
||||||
.ad l
|
.ad l
|
||||||
.\" Begin generated content:
|
.\" Begin generated content:
|
||||||
.TH "grimshot" "1" "2020-12-20"
|
.TH "grimshot" "1" "2020-12-28"
|
||||||
.P
|
.P
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.P
|
.P
|
||||||
|
|
@ -13,7 +13,7 @@ grimshot - a helper for screenshots within sway
|
||||||
.P
|
.P
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.P
|
.P
|
||||||
\fBgrimshot\fR [--notify] (copy|save) [TARGET] [FILE]
|
\fBgrimshot\fR [--notify] (copy|save|save-copy) [TARGET] [FILE]
|
||||||
.br
|
.br
|
||||||
\fBgrimshot\fR check
|
\fBgrimshot\fR check
|
||||||
.br
|
.br
|
||||||
|
|
@ -23,26 +23,32 @@ grimshot - a helper for screenshots within sway
|
||||||
.P
|
.P
|
||||||
\fB--notify\fR
|
\fB--notify\fR
|
||||||
.RS 4
|
.RS 4
|
||||||
Show notifications to the user that a screenshot has been taken.\&
|
Show notifications to the user that a screenshot has been taken.
|
||||||
.P
|
.P
|
||||||
.RE
|
.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
|
||||||
files to \fBXDG_SCREENSHOTS_DIR\fR if this is set (or defined
|
files to \fBXDG_SCREENSHOTS_DIR\fR if this is set (or defined
|
||||||
in \fBuser-dirs.\&dir\fR), or otherwise fall back to \fBXDG_PICTURES_DIR\fR.\&
|
in \fBuser-dirs.dir\fR), or otherwise fall back to \fBXDG_PICTURES_DIR\fR.
|
||||||
.P
|
.P
|
||||||
.RE
|
.RE
|
||||||
\fBcopy\fR
|
\fBcopy\fR
|
||||||
.RS 4
|
.RS 4
|
||||||
Copy the screenshot data (as image/png) into the clipboard.\&
|
Copy the screenshot data (as image/png) into the clipboard.
|
||||||
|
.P
|
||||||
|
.RE
|
||||||
|
\fBsave-copy\fR
|
||||||
|
.RS 4
|
||||||
|
Save the screeshot into a regular file (see above for save) and
|
||||||
|
copy the screenshot data into the clipboard (see above for copy).
|
||||||
.P
|
.P
|
||||||
.RE
|
.RE
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.P
|
.P
|
||||||
Grimshot is an easy-to-use screenshot utility for sway.\& It provides a
|
Grimshot is an easy-to-use screenshot utility for sway. It provides a
|
||||||
convenient interface over grim, slurp and jq, and supports storing the
|
convenient interface over grim, slurp and jq, and supports storing the
|
||||||
screenshot either directly to the clipboard using wl-copy or to a file.\&
|
screenshot either directly to the clipboard using wl-copy or to a file.
|
||||||
.P
|
.P
|
||||||
.SH EXAMPLES
|
.SH EXAMPLES
|
||||||
.P
|
.P
|
||||||
|
|
@ -69,34 +75,34 @@ grimshot can capture the following named targets:
|
||||||
.P
|
.P
|
||||||
\fIactive\fR
|
\fIactive\fR
|
||||||
.RS 4
|
.RS 4
|
||||||
Captures the currently active window.\&
|
Captures the currently active window.
|
||||||
.P
|
.P
|
||||||
.RE
|
.RE
|
||||||
\fIscreen\fR
|
\fIscreen\fR
|
||||||
.RS 4
|
.RS 4
|
||||||
Captures the entire screen.\& This includes all visible outputs.\&
|
Captures the entire screen. This includes all visible outputs.
|
||||||
.P
|
.P
|
||||||
.RE
|
.RE
|
||||||
\fIarea\fR
|
\fIarea\fR
|
||||||
.RS 4
|
.RS 4
|
||||||
Allows manually selecting a rectangular region, and captures that.\&
|
Allows manually selecting a rectangular region, and captures that.
|
||||||
.P
|
.P
|
||||||
.RE
|
.RE
|
||||||
\fIwindow\fR
|
\fIwindow\fR
|
||||||
.RS 4
|
.RS 4
|
||||||
Allows manually selecting a single window (by clicking on it), and
|
Allows manually selecting a single window (by clicking on it), and
|
||||||
captures it.\&
|
captures it.
|
||||||
.P
|
.P
|
||||||
.RE
|
.RE
|
||||||
\fIoutput\fR
|
\fIoutput\fR
|
||||||
.RS 4
|
.RS 4
|
||||||
Captures the currently active output.\&
|
Captures the currently active output.
|
||||||
.P
|
.P
|
||||||
.RE
|
.RE
|
||||||
.SH OUTPUT
|
.SH OUTPUT
|
||||||
.P
|
.P
|
||||||
Grimshot will print the filename of the captured screenshot to stdout if called
|
Grimshot will print the filename of the captured screenshot to stdout if called
|
||||||
with the \fIsave\fR subcommand.\&
|
with the \fIsave\fR subcommand.
|
||||||
.P
|
.P
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.P
|
.P
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ grimshot - a helper for screenshots within sway
|
||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
*grimshot* [--notify] (copy|save) [TARGET] [FILE]++
|
*grimshot* [--notify] (copy|save|save-copy) [TARGET] [FILE]++
|
||||||
*grimshot* check++
|
*grimshot* check++
|
||||||
*grimshot* usage
|
*grimshot* usage
|
||||||
|
|
||||||
|
|
@ -23,6 +23,10 @@ grimshot - a helper for screenshots within sway
|
||||||
*copy*
|
*copy*
|
||||||
Copy the screenshot data (as image/png) into the clipboard.
|
Copy the screenshot data (as image/png) into the clipboard.
|
||||||
|
|
||||||
|
*save-copy*
|
||||||
|
Save the screeshot into a regular file (see above for save) and
|
||||||
|
copy the screenshot data into the clipboard (see above for copy).
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
Grimshot is an easy-to-use screenshot utility for sway. It provides a
|
Grimshot is an easy-to-use screenshot utility for sway. It provides a
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue