Created
January 20, 2021 00:12
-
-
Save radgeRayden/fd74d42126d5f9115c373110d87d16c0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/fish | |
# vim ft=fish | |
set -l MONTH (date +"%m") | |
set -l YEAR (date +"%Y") | |
set -l SSDIR "$HOME/Pictures/Screenshots/$YEAR-$MONTH" | |
mkdir -p $SSDIR | |
if test "$argv[1]" = "display" | |
if maim /tmp/screenshot.png | |
xclip -selection clipboard -t image/png -i /tmp/screenshot.png | |
set -l SSPATH $SSDIR/(date +%s)-(identify -format '%wx%h' /tmp/screenshot.png).png | |
mv /tmp/screenshot.png $SSPATH | |
end | |
end | |
# https://stefanscherer.github.io/how-to-take-screenshots-with-drop-shadow/ | |
function add_shadow -a image | |
convert $image \( +clone -background grey35 -shadow 80x8+5+5 \) \ | |
+swap -background transparent -layers merge +repage $image | |
end | |
if test "$argv[1]" = "window" | |
if maim -i (xdotool getactivewindow) /tmp/screenshot.png | |
xclip -selection clipboard -t image/png -i /tmp/screenshot.png | |
set -l SSPATH $SSDIR/(date +%s)-(identify -format '%wx%h' /tmp/screenshot.png).png | |
mv /tmp/screenshot.png $SSPATH | |
add_shadow $SSPATH | |
end | |
end | |
if test "$argv[1]" = "area" | |
maim /tmp/screenshotbg.png | |
sxiv -fbZ /tmp/screenshotbg.png & | |
sleep 0.5 #ensure sxiv won't override slop | |
if maim -s -b 1920 -r blur1,blur2 /tmp/screenshot.png | |
xclip -selection clipboard -t image/png -i /tmp/screenshot.png | |
set -l SSPATH $SSDIR/(date +%s)-(identify -format '%wx%h' /tmp/screenshot.png).png | |
mv /tmp/screenshot.png $SSPATH | |
add_shadow $SSPATH | |
end | |
#time to kill | |
xdotool key q | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment