diff --git a/.config/sway/scripts/boxshadow.sh b/.config/sway/scripts/boxshadow.sh index d5ba794..719548e 100755 --- a/.config/sway/scripts/boxshadow.sh +++ b/.config/sway/scripts/boxshadow.sh @@ -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 \) \ diff --git a/.config/sway/scripts/grimshot-ui.sh b/.config/sway/scripts/grimshot-ui.sh index 20cae2d..7160d0e 100755 --- a/.config/sway/scripts/grimshot-ui.sh +++ b/.config/sway/scripts/grimshot-ui.sh @@ -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 diff --git a/.config/sway/scripts/grimshot.sh b/.config/sway/scripts/grimshot.sh index 140e54f..7b65c9c 100755 --- a/.config/sway/scripts/grimshot.sh +++ b/.config/sway/scripts/grimshot.sh @@ -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 }