diff options
author | Hugo Osvaldo Barrera <hugo@barrera.io> | 2020-05-01 18:03:07 +0200 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2020-05-05 20:18:19 +0200 |
commit | 9cda5a5bd62efe161217481147121d5de8a8dc20 (patch) | |
tree | f0f72b66712b386e85cb7ace94c42e0d15029d6a /contrib/grimshot | |
parent | grimshot: Add a man page (diff) | |
download | sway-9cda5a5bd62efe161217481147121d5de8a8dc20.tar.gz sway-9cda5a5bd62efe161217481147121d5de8a8dc20.tar.zst sway-9cda5a5bd62efe161217481147121d5de8a8dc20.zip |
grimshot: Skip creating a temp file when copying
Diffstat (limited to 'contrib/grimshot')
-rwxr-xr-x | contrib/grimshot | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/contrib/grimshot b/contrib/grimshot index 08a5fd1b..2e30c69e 100755 --- a/contrib/grimshot +++ b/contrib/grimshot | |||
@@ -8,7 +8,6 @@ | |||
8 | ## - `wl-copy`: clipboard utility | 8 | ## - `wl-copy`: clipboard utility |
9 | ## - `jq`: json utility to parse swaymsg output | 9 | ## - `jq`: json utility to parse swaymsg output |
10 | ## - `notify-send`: to show notifications | 10 | ## - `notify-send`: to show notifications |
11 | ## - `mktemp`: to create a temporary file | ||
12 | ## Those are needed to be installed, if unsure, run `grimshot check` | 11 | ## Those are needed to be installed, if unsure, run `grimshot check` |
13 | ## | 12 | ## |
14 | ## See `man 1 grimshot` or `grimshot usage` for further details. | 13 | ## See `man 1 grimshot` or `grimshot usage` for further details. |
@@ -109,7 +108,6 @@ if [ "$ACTION" = "check" ] ; then | |||
109 | check wl-copy | 108 | check wl-copy |
110 | check jq | 109 | check jq |
111 | check notify-send | 110 | check notify-send |
112 | check mktemp | ||
113 | exit | 111 | exit |
114 | elif [ "$SUBJECT" = "area" ] ; then | 112 | elif [ "$SUBJECT" = "area" ] ; then |
115 | GEOM=$(slurp -d) | 113 | GEOM=$(slurp -d) |
@@ -134,10 +132,7 @@ else | |||
134 | fi | 132 | fi |
135 | 133 | ||
136 | if [ "$ACTION" = "copy" ] ; then | 134 | if [ "$ACTION" = "copy" ] ; then |
137 | TMP=$(mktemp) || die "Unable to create temp file: is mktemp installed?" | 135 | takeScreenshot - "$GEOM" "$OUTPUT" | wl-copy --type image/png || die "Clipboard error" |
138 | takeScreenshot "$TMP" "$GEOM" "$OUTPUT" | ||
139 | wl-copy --type image/png < "$TMP" || die "Clipboard error" | ||
140 | rm "$TMP" | ||
141 | notifyOk "$WHAT copied to buffer" | 136 | notifyOk "$WHAT copied to buffer" |
142 | else | 137 | else |
143 | if takeScreenshot "$FILE" "$GEOM" "$OUTPUT"; then | 138 | if takeScreenshot "$FILE" "$GEOM" "$OUTPUT"; then |