Change wording

This commit is contained in:
Cyril Levis 2020-01-28 00:09:18 +01:00 committed by Simon Ser
parent 0f97580552
commit 3f0225eea3

View File

@ -15,6 +15,7 @@
## `grimshot copy win` - to copy current window ## `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 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 screen ~/screenshot.png` - to save screenshot under ~/screenshot.png
## `grimshot save output ~/screenshot.png` - to save screenshot under ~/screenshot.png
## `grimshot` - usage ## `grimshot` - usage
## `grimshot check` - verify if tools are installed ## `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')} FILE=${3:-$(xdg-user-dir PICTURES)/$(date +'Grimshot %Y-%m-%d %H-%M-%S.png')}
if [ "$ACTION" = "usage" ] ; then if [ "$ACTION" = "usage" ] ; then
echo "Usage:" echo "Usage:"
echo " grimshot copy|save win|screen|focused_screen|area [FILE]" echo " grimshot copy|save win|screen|output|area [FILE]"
echo "Troubleshoot:" echo "Troubleshoot:"
echo " grimshot check" echo " grimshot check"
exit exit
@ -62,9 +63,9 @@ check() {
takeScreenshot() { takeScreenshot() {
FILE=$1 FILE=$1
GEOM=$2 GEOM=$2
SCREEN=$3 OUTPUT=$3
if [ ! -z "$SCREEN" ]; then if [ ! -z "$OUTPUT" ]; then
grim -o "$SCREEN" "$FILE" || die "Unable to invoke grim" grim -o "$OUTPUT" "$FILE" || die "Unable to invoke grim"
elif [ -z "$GEOM" ]; then elif [ -z "$GEOM" ]; then
grim "$FILE" || die "Unable to invoke grim" grim "$FILE" || die "Unable to invoke grim"
else else
@ -93,22 +94,22 @@ elif [ "$SUBJECT" = "win" ] ; then
elif [ "$SUBJECT" = "screen" ] ; then elif [ "$SUBJECT" = "screen" ] ; then
GEOM="" GEOM=""
WHAT="Screen" WHAT="Screen"
elif [ "$SUBJECT" = "focused_screen" ] ; then elif [ "$SUBJECT" = "output" ] ; then
GEOM="" GEOM=""
SCREEN=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused)' | jq -r '.name') OUTPUT=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused)' | jq -r '.name')
WHAT="Focused screen $SCREEN" WHAT="$OUTPUT"
else else
die "Unknown subject to take a screen shot from" "$SUBJECT" die "Unknown subject to take a screen shot from" "$SUBJECT"
fi fi
if [ "$ACTION" = "copy" ] ; then if [ "$ACTION" = "copy" ] ; then
TMP=$(mktemp) || die "Unable to create temp file: is mktemp installed?" 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" wl-copy --type image/png < "$TMP" || die "Clipboard error"
rm "$TMP" rm "$TMP"
notifyOk "$WHAT copied to buffer" notifyOk "$WHAT copied to buffer"
else else
if takeScreenshot "$FILE" "$GEOM" "$SCREEN"; then if takeScreenshot "$FILE" "$GEOM" "$OUTPUT"; then
TITLE="Screenshot of $SUBJECT" TITLE="Screenshot of $SUBJECT"
MESSAGE=$(basename "$FILE") MESSAGE=$(basename "$FILE")
notifyOk "$MESSAGE" "$TITLE" notifyOk "$MESSAGE" "$TITLE"