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 | |
parent | Add the possibility to capture only one screen if several screens are use. (diff) | |
download | sway-3f0225eea3d800475f2cd64d023297c684ab2310.tar.gz sway-3f0225eea3d800475f2cd64d023297c684ab2310.tar.zst sway-3f0225eea3d800475f2cd64d023297c684ab2310.zip |
Change wording
Diffstat (limited to 'contrib')
-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 @@ | |||
15 | ## `grimshot copy win` - to copy current window | 15 | ## `grimshot copy win` - to copy current window |
16 | ## `grimshot save area` - to select area and save it to default file (Pictures/Grimshot-$datetime.png) | 16 | ## `grimshot save area` - to select area and save it to default file (Pictures/Grimshot-$datetime.png) |
17 | ## `grimshot save screen ~/screenshot.png` - to save screenshot under ~/screenshot.png | 17 | ## `grimshot save screen ~/screenshot.png` - to save screenshot under ~/screenshot.png |
18 | ## `grimshot save output ~/screenshot.png` - to save screenshot under ~/screenshot.png | ||
18 | ## `grimshot` - usage | 19 | ## `grimshot` - usage |
19 | ## `grimshot check` - verify if tools are installed | 20 | ## `grimshot check` - verify if tools are installed |
20 | 21 | ||
@@ -23,7 +24,7 @@ SUBJECT=${2:-screen} | |||
23 | FILE=${3:-$(xdg-user-dir PICTURES)/$(date +'Grimshot %Y-%m-%d %H-%M-%S.png')} | 24 | FILE=${3:-$(xdg-user-dir PICTURES)/$(date +'Grimshot %Y-%m-%d %H-%M-%S.png')} |
24 | if [ "$ACTION" = "usage" ] ; then | 25 | if [ "$ACTION" = "usage" ] ; then |
25 | echo "Usage:" | 26 | echo "Usage:" |
26 | echo " grimshot copy|save win|screen|focused_screen|area [FILE]" | 27 | echo " grimshot copy|save win|screen|output|area [FILE]" |
27 | echo "Troubleshoot:" | 28 | echo "Troubleshoot:" |
28 | echo " grimshot check" | 29 | echo " grimshot check" |
29 | exit | 30 | exit |
@@ -62,9 +63,9 @@ check() { | |||
62 | takeScreenshot() { | 63 | takeScreenshot() { |
63 | FILE=$1 | 64 | FILE=$1 |
64 | GEOM=$2 | 65 | GEOM=$2 |
65 | SCREEN=$3 | 66 | OUTPUT=$3 |
66 | if [ ! -z "$SCREEN" ]; then | 67 | if [ ! -z "$OUTPUT" ]; then |
67 | grim -o "$SCREEN" "$FILE" || die "Unable to invoke grim" | 68 | grim -o "$OUTPUT" "$FILE" || die "Unable to invoke grim" |
68 | elif [ -z "$GEOM" ]; then | 69 | elif [ -z "$GEOM" ]; then |
69 | grim "$FILE" || die "Unable to invoke grim" | 70 | grim "$FILE" || die "Unable to invoke grim" |
70 | else | 71 | else |
@@ -93,22 +94,22 @@ elif [ "$SUBJECT" = "win" ] ; then | |||
93 | elif [ "$SUBJECT" = "screen" ] ; then | 94 | elif [ "$SUBJECT" = "screen" ] ; then |
94 | GEOM="" | 95 | GEOM="" |
95 | WHAT="Screen" | 96 | WHAT="Screen" |
96 | elif [ "$SUBJECT" = "focused_screen" ] ; then | 97 | elif [ "$SUBJECT" = "output" ] ; then |
97 | GEOM="" | 98 | GEOM="" |
98 | SCREEN=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused)' | jq -r '.name') | 99 | OUTPUT=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused)' | jq -r '.name') |
99 | WHAT="Focused screen $SCREEN" | 100 | WHAT="$OUTPUT" |
100 | else | 101 | else |
101 | die "Unknown subject to take a screen shot from" "$SUBJECT" | 102 | die "Unknown subject to take a screen shot from" "$SUBJECT" |
102 | fi | 103 | fi |
103 | 104 | ||
104 | if [ "$ACTION" = "copy" ] ; then | 105 | if [ "$ACTION" = "copy" ] ; then |
105 | TMP=$(mktemp) || die "Unable to create temp file: is mktemp installed?" | 106 | TMP=$(mktemp) || die "Unable to create temp file: is mktemp installed?" |
106 | takeScreenshot "$TMP" "$GEOM" "$SCREEN" | 107 | takeScreenshot "$TMP" "$GEOM" "$OUTPUT" |
107 | wl-copy --type image/png < "$TMP" || die "Clipboard error" | 108 | wl-copy --type image/png < "$TMP" || die "Clipboard error" |
108 | rm "$TMP" | 109 | rm "$TMP" |
109 | notifyOk "$WHAT copied to buffer" | 110 | notifyOk "$WHAT copied to buffer" |
110 | else | 111 | else |
111 | if takeScreenshot "$FILE" "$GEOM" "$SCREEN"; then | 112 | if takeScreenshot "$FILE" "$GEOM" "$OUTPUT"; then |
112 | TITLE="Screenshot of $SUBJECT" | 113 | TITLE="Screenshot of $SUBJECT" |
113 | MESSAGE=$(basename "$FILE") | 114 | MESSAGE=$(basename "$FILE") |
114 | notifyOk "$MESSAGE" "$TITLE" | 115 | notifyOk "$MESSAGE" "$TITLE" |