forked from mirrors_public/oddlama_nix-config
fix: abort screenshot tool if flameshot was cancelled
This commit is contained in:
parent
143f04fb03
commit
5bcf5c8100
2 changed files with 7 additions and 2 deletions
|
@ -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" \
|
||||
|
|
|
@ -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" \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue