traps in zsh are weird man

This commit is contained in:
Seaswimmer 2024-10-12 00:05:48 -04:00
parent 4c093e2886
commit 7211c25809
Signed by: cswimr
GPG key ID: A9C162E867C851FA

View file

@ -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 {