feat: convert screenshot scripts to wayland

This commit is contained in:
oddlama 2024-06-12 01:32:27 +02:00
parent 3a0cec46f3
commit 3b602b322a
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A
5 changed files with 97 additions and 72 deletions

View file

@ -1,24 +1,23 @@
{
lib,
writeShellApplication,
flameshot,
grimblast,
libnotify,
moreutils,
}:
writeShellApplication {
name = "screenshot-screen";
runtimeInputs = [
grimblast
libnotify
];
text = ''
set -euo pipefail
umask 077
date=$(date +"%Y-%m-%dT%H:%M:%S%:z")
out="''${XDG_PICTURES_DIR-$HOME/Pictures}/screenshots/$date-fullscreen.png"
mkdir -p "$(dirname "$out")"
if ${lib.getExe flameshot} full --raw 2>&1 1> >(${moreutils}/bin/sponge "$out") | grep -q "flameshot: info:.*aborted."; then
exit 1
fi
${libnotify}/bin/notify-send \
grimblast --freeze save screen "$out" || exit 2
notify-send \
"📷 Screenshot captured" "💾 Saved to $out" \
--hint="string:wired-tag:screenshot-$date" \
|| true