1
1
mirror of https://github.com/rywng/dotfiles.git synced 2024-11-24 11:51:50 +08:00

Update screenshot utilitys' code.

boxshadow.sh:   Add a tips for what this script does.
grimshot-ui.sh: Move the box shadow editing part to this script.
grimshot.sh:    Same as above, to make the grimshot-ui a pure wrapper
to this and grim, making the codebase cleaner.
This commit is contained in:
juan 2022-04-22 00:13:06 +08:00
parent 226d6aad07
commit 84ad436aeb
3 changed files with 14 additions and 6 deletions

View File

@ -1,6 +1,8 @@
#!/bin/sh
# Take $1 as input, add a box shadow, output to $2
background_color=#2a2f33
# you can change background color here
background_color=none
convert $1 \
\( -clone 0 -background black -shadow 40x5+12+16 \) \

View File

@ -1,5 +1,8 @@
#!/bin/sh
SCRIPT_LOC=~/.config/sway/scripts/
FILE="/tmp/share/screenshots/`date +'%y%m%d%H%M.png'`"
action=`echo "copy\nsave" | wofi -d -Oalphabetical --prompt="Select your action"`
target=`echo "active\nscreen\noutput\narea\nwindow" | wofi -d -Oalphabetical --prompt="Select the target"`
@ -10,4 +13,10 @@ test -d /tmp/share/screenshot || mkdir -p /tmp/share/screenshots
# TODO, add box shadows
XDG_SCREENSHOTS_DIR=/tmp/share/screenshots ~/.config/sway/scripts/grimshot.sh --notify $action $target
XDG_SCREENSHOTS_DIR=/tmp/share/screenshots ~/.config/sway/scripts/grimshot.sh --notify $action $target $FILE
if [ $target = "active" ] || [ $target = "window" ] || [ $target = "area" ]
then
$SCRIPT_LOC/boxshadow.sh "$FILE" "$FILE" || die "Unable to save screenshot"
echo "saved file"
fi

View File

@ -1,7 +1,6 @@
#!/bin/sh
## TAKEN FROM https://github.com/swaywm/sway/blob/master/contrib/grimshot
## With some modifications
##
## Grimshot: a helper for screenshots within sway
## Requirements:
@ -32,7 +31,6 @@ fi
ACTION=${1:-usage}
SUBJECT=${2:-screen}
FILE=${3:-$(getTargetDirectory)/$(date +'%y%m%d%H%M.png')}
SCRIPT_LOC=~/.config/sway/scripts/
if [ "$ACTION" != "save" ] && [ "$ACTION" != "copy" ] && [ "$ACTION" != "check" ]; then
echo "Usage:"
@ -100,8 +98,7 @@ takeScreenshot() {
elif [ -z "$GEOM" ]; then
grim "$FILE" || die "Unable to invoke grim"
else
grim -g "$GEOM" "$FILE" || die "Unable to invoke grim" && \
$SCRIPT_LOC/boxshadow.sh "$FILE" "$FILE" || die "Unable to save screenshot"
grim -g "$GEOM" "$FILE" || die "Unable to invoke grim"
fi
}