diff --git a/pkgs/scripts/screenshot-area.nix b/pkgs/scripts/screenshot-area.nix index 484f70b..4600c8e 100644 --- a/pkgs/scripts/screenshot-area.nix +++ b/pkgs/scripts/screenshot-area.nix @@ -22,7 +22,10 @@ writeShellApplication { export QT_SCREEN_SCALE_FACTORS="" # Use sponge to create the file on success only - ${lib.getExe flameshot} gui --raw | ${moreutils}/bin/sponge "$out" + if ${lib.getExe flameshot} gui --raw 2>&1 1> >(${moreutils}/bin/sponge "$out") | grep -q "flameshot: info:.*aborted."; then + exit 1 + fi + ${xclip}/bin/xclip -selection clipboard -t image/png < "$out" action=$(${libnotify}/bin/notify-send \ "📷 Screenshot captured" "📋 copied to clipboard" \ diff --git a/pkgs/scripts/screenshot-screen.nix b/pkgs/scripts/screenshot-screen.nix index 82eaf47..bf1cec2 100644 --- a/pkgs/scripts/screenshot-screen.nix +++ b/pkgs/scripts/screenshot-screen.nix @@ -15,7 +15,9 @@ writeShellApplication { out="''${XDG_PICTURES_DIR-$HOME/Pictures}/screenshots/$date-fullscreen.png" mkdir -p "$(dirname "$out")" - ${lib.getExe flameshot} full --raw | ${moreutils}/bin/sponge "$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 \ "📷 Screenshot captured" "💾 Saved to $out" \ --hint="string:wired-tag:screenshot-$date" \