Created
September 8, 2020 03:41
-
-
Save radgeRayden/644066802f0dea4e99eb2da0cc482da3 to your computer and use it in GitHub Desktop.
This file contains 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 | |
set -l MONTH (date +"%B") | |
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 | |
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 | |
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 | |
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