diff options
author | Cyril Levis <cyril@levis.name> | 2020-01-28 00:09:18 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-02-04 23:52:08 +0100 |
commit | 3f0225eea3d800475f2cd64d023297c684ab2310 (patch) | |
tree | 0c7f6b3f1e1c63b12a8ebd8fab164c6baae704ba /contrib/grimshot | |
parent | 0f975805525e6e08ff761b756141294c39d21131 (diff) |
Change wording
Diffstat (limited to 'contrib/grimshot')
-rwxr-xr-x | contrib/grimshot | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/contrib/grimshot b/contrib/grimshot index 7757d6ce..bbb35e33 100755 --- a/contrib/grimshot +++ b/contrib/grimshot @@ -15,6 +15,7 @@ ## `grimshot copy win` - to copy current window ## `grimshot save area` - to select area and save it to default file (Pictures/Grimshot-$datetime.png) ## `grimshot save screen ~/screenshot.png` - to save screenshot under ~/screenshot.png +## `grimshot save output ~/screenshot.png` - to save screenshot under ~/screenshot.png ## `grimshot` - usage ## `grimshot check` - verify if tools are installed @@ -23,7 +24,7 @@ SUBJECT=${2:-screen} FILE=${3:-$(xdg-user-dir PICTURES)/$(date +'Grimshot %Y-%m-%d %H-%M-%S.png')} if [ "$ACTION" = "usage" ] ; then echo "Usage:" - echo " grimshot copy|save win|screen|focused_screen|area [FILE]" + echo " grimshot copy|save win|screen|output|area [FILE]" echo "Troubleshoot:" echo " grimshot check" exit @@ -62,9 +63,9 @@ check() { takeScreenshot() { FILE=$1 GEOM=$2 - SCREEN=$3 - if [ ! -z "$SCREEN" ]; then - grim -o "$SCREEN" "$FILE" || die "Unable to invoke grim" + OUTPUT=$3 + if [ ! -z "$OUTPUT" ]; then + grim -o "$OUTPUT" "$FILE" || die "Unable to invoke grim" elif [ -z "$GEOM" ]; then grim "$FILE" || die "Unable to invoke grim" else @@ -93,22 +94,22 @@ elif [ "$SUBJECT" = "win" ] ; then elif [ "$SUBJECT" = "screen" ] ; then GEOM="" WHAT="Screen" -elif [ "$SUBJECT" = "focused_screen" ] ; then +elif [ "$SUBJECT" = "output" ] ; then GEOM="" - SCREEN=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused)' | jq -r '.name') - WHAT="Focused screen $SCREEN" + OUTPUT=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused)' | jq -r '.name') + WHAT="$OUTPUT" else die "Unknown subject to take a screen shot from" "$SUBJECT" fi if [ "$ACTION" = "copy" ] ; then TMP=$(mktemp) || die "Unable to create temp file: is mktemp installed?" - takeScreenshot "$TMP" "$GEOM" "$SCREEN" + takeScreenshot "$TMP" "$GEOM" "$OUTPUT" wl-copy --type image/png < "$TMP" || die "Clipboard error" rm "$TMP" notifyOk "$WHAT copied to buffer" else - if takeScreenshot "$FILE" "$GEOM" "$SCREEN"; then + if takeScreenshot "$FILE" "$GEOM" "$OUTPUT"; then TITLE="Screenshot of $SUBJECT" MESSAGE=$(basename "$FILE") notifyOk "$MESSAGE" "$TITLE" |