mirror of
https://github.com/rywng/dotfiles.git
synced 2024-11-24 20:01:49 +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:
parent
226d6aad07
commit
84ad436aeb
@ -1,6 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/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 \
|
convert $1 \
|
||||||
\( -clone 0 -background black -shadow 40x5+12+16 \) \
|
\( -clone 0 -background black -shadow 40x5+12+16 \) \
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/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"`
|
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"`
|
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
|
# 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
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
## TAKEN FROM https://github.com/swaywm/sway/blob/master/contrib/grimshot
|
## TAKEN FROM https://github.com/swaywm/sway/blob/master/contrib/grimshot
|
||||||
## With some modifications
|
|
||||||
##
|
##
|
||||||
## Grimshot: a helper for screenshots within sway
|
## Grimshot: a helper for screenshots within sway
|
||||||
## Requirements:
|
## Requirements:
|
||||||
@ -32,7 +31,6 @@ fi
|
|||||||
ACTION=${1:-usage}
|
ACTION=${1:-usage}
|
||||||
SUBJECT=${2:-screen}
|
SUBJECT=${2:-screen}
|
||||||
FILE=${3:-$(getTargetDirectory)/$(date +'%y%m%d%H%M.png')}
|
FILE=${3:-$(getTargetDirectory)/$(date +'%y%m%d%H%M.png')}
|
||||||
SCRIPT_LOC=~/.config/sway/scripts/
|
|
||||||
|
|
||||||
if [ "$ACTION" != "save" ] && [ "$ACTION" != "copy" ] && [ "$ACTION" != "check" ]; then
|
if [ "$ACTION" != "save" ] && [ "$ACTION" != "copy" ] && [ "$ACTION" != "check" ]; then
|
||||||
echo "Usage:"
|
echo "Usage:"
|
||||||
@ -100,8 +98,7 @@ takeScreenshot() {
|
|||||||
elif [ -z "$GEOM" ]; then
|
elif [ -z "$GEOM" ]; then
|
||||||
grim "$FILE" || die "Unable to invoke grim"
|
grim "$FILE" || die "Unable to invoke grim"
|
||||||
else
|
else
|
||||||
grim -g "$GEOM" "$FILE" || die "Unable to invoke grim" && \
|
grim -g "$GEOM" "$FILE" || die "Unable to invoke grim"
|
||||||
$SCRIPT_LOC/boxshadow.sh "$FILE" "$FILE" || die "Unable to save screenshot"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user