diff --git a/.zshc/func.zsh b/.zshc/func.zsh index 045e463..00f697d 100644 --- a/.zshc/func.zsh +++ b/.zshc/func.zsh @@ -40,7 +40,7 @@ function zipline { readonly url=${ZIPLINE_URL:?Environment variable ZIPLINE_URL is not set. Please set it to the URL of your Zipline instance. I recommend placing it in a file at ~/.config/environment.d/zipline.conf} temp_file=$(mktemp /tmp/zipline-upload.XXXXXXXX.json) - trap 'rm -f "$temp_file"' EXIT + trap 'rm -f "$temp_file"' ERR if (( ! $+commands[jq] )); then echo "jq is not installed." @@ -117,7 +117,7 @@ function spectacle-screenshot { else readonly file=$2 fi - trap 'rm -f "$file"' EXIT + trap 'rm -f "$file"' ERR if $save_recording; then command spectacle --nonotify --background --record=region --copy-image --output "$file" @@ -127,6 +127,7 @@ function spectacle-screenshot { [ ! -s "$file" ] && return 1 zipline "$file" Spectacle org.kde.spectacle.desktop + rm -f "$file" } function flameshot-screenshot { @@ -147,13 +148,14 @@ function flameshot-screenshot { else readonly file=$1 fi - trap 'rm -f "$file"' EXIT + trap 'rm -f "$file"' ERR command flameshot gui --clipboard --raw > $file echo "Screenshot saved to $file" [ ! -s "$file" ] && return 1 zipline "$file" Flameshot org.flameshot.Flameshot.desktop + rm -f "$file" } function does-desktop-entry-exist {