Created
November 18, 2020 12:39
-
-
Save TethysSvensson/d742e67d1ad04abf08a629f12a435fbb 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
{ pkgs, writeScriptBin, hacksaw, shotgun, xclip }: | |
writeScriptBin "screenshot" '' | |
#!${pkgs.bash}/bin/sh | |
set -e | |
file=$(date +/tmp/screenshot-%F-%H%M%S.png) | |
if [[ "$1" = "full" ]]; then | |
${shotgun}/bin/shotgun $file | |
else | |
selection=$(${hacksaw}/bin/hacksaw -f "-i %i -g %g") | |
${shotgun}/bin/shotgun $selection $file | |
fi | |
cat $file | ${xclip}/bin/xclip -t 'image/png' -selection clipboard | |
echo $file | |
'' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment