1
0
Fork 0

Switch to SwayFX

This commit is contained in:
Avery 2024-09-05 21:01:29 +02:00
parent 6571feaff7
commit c310042564
Signed by: Avery
GPG key ID: B684FD451B692E04
41 changed files with 1450 additions and 294 deletions

View file

@ -0,0 +1,36 @@
{ pkgs }:
pkgs.writeShellApplication {
name = "screenshot";
runtimeInputs = with pkgs; [
dunst
grim
libjxl
slurp
wl-clipboard
xdg-user-dirs
];
text = ''
usage() {
echo "Usage: screenshot { full | section }"
exit 1
}
test -n 1 || usage
FILE_NAME=$(date +'Screenshot_%Y%m%d_%H%M%S')
TEMPORARY_PATH="/tmp/$FILE_NAME.png"
SCREENSHOT_PATH="$(xdg-user-dir PICTURES)/Capturas/$FILE_NAME.jxl"
if [ "$1" == "full" ]; then
grim "$TEMPORARY_PATH"
elif [ "$1" == "section" ]; then
grim -g "$(slurp -b '#000000aa' -w 0)" "$TEMPORARY_PATH"
else
usage
fi
wl-copy < "$TEMPORARY_PATH"
cjxl "$TEMPORARY_PATH" "$SCREENSHOT_PATH"
dunstify --raw_icon="$TEMPORARY_PATH" "Captura de pantalla realizada" "Guardada como $FILE_NAME.jxl"
rm "$TEMPORARY_PATH"
'';
}