aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorLibravatar Cyril Levis <cyril@levis.name>2020-01-28 00:09:18 +0100
committerLibravatar Simon Ser <contact@emersion.fr>2020-02-04 23:52:08 +0100
commit3f0225eea3d800475f2cd64d023297c684ab2310 (patch)
tree0c7f6b3f1e1c63b12a8ebd8fab164c6baae704ba /contrib
parentAdd the possibility to capture only one screen if several screens are use. (diff)
downloadsway-3f0225eea3d800475f2cd64d023297c684ab2310.tar.gz
sway-3f0225eea3d800475f2cd64d023297c684ab2310.tar.zst
sway-3f0225eea3d800475f2cd64d023297c684ab2310.zip
Change wording
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/grimshot19
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}
23FILE=${3:-$(xdg-user-dir PICTURES)/$(date +'Grimshot %Y-%m-%d %H-%M-%S.png')} 24FILE=${3:-$(xdg-user-dir PICTURES)/$(date +'Grimshot %Y-%m-%d %H-%M-%S.png')}
24if [ "$ACTION" = "usage" ] ; then 25if [ "$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() {
62takeScreenshot() { 63takeScreenshot() {
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
93elif [ "$SUBJECT" = "screen" ] ; then 94elif [ "$SUBJECT" = "screen" ] ; then
94 GEOM="" 95 GEOM=""
95 WHAT="Screen" 96 WHAT="Screen"
96elif [ "$SUBJECT" = "focused_screen" ] ; then 97elif [ "$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"
100else 101else
101 die "Unknown subject to take a screen shot from" "$SUBJECT" 102 die "Unknown subject to take a screen shot from" "$SUBJECT"
102fi 103fi
103 104
104if [ "$ACTION" = "copy" ] ; then 105if [ "$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"
110else 111else
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"