cswimr/home
Archived
Template
1
0
Fork 0

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} 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) temp_file=$(mktemp /tmp/zipline-upload.XXXXXXXX.json)
trap 'rm -f "$temp_file"' EXIT trap 'rm -f "$temp_file"' ERR
if (( ! $+commands[jq] )); then if (( ! $+commands[jq] )); then
echo "jq is not installed." echo "jq is not installed."
@ -117,7 +117,7 @@ function spectacle-screenshot {
else else
readonly file=$2 readonly file=$2
fi fi
trap 'rm -f "$file"' EXIT trap 'rm -f "$file"' ERR
if $save_recording; then if $save_recording; then
command spectacle --nonotify --background --record=region --copy-image --output "$file" command spectacle --nonotify --background --record=region --copy-image --output "$file"
@ -127,6 +127,7 @@ function spectacle-screenshot {
[ ! -s "$file" ] && return 1 [ ! -s "$file" ] && return 1
zipline "$file" Spectacle org.kde.spectacle.desktop zipline "$file" Spectacle org.kde.spectacle.desktop
rm -f "$file"
} }
function flameshot-screenshot { function flameshot-screenshot {
@ -147,13 +148,14 @@ function flameshot-screenshot {
else else
readonly file=$1 readonly file=$1
fi fi
trap 'rm -f "$file"' EXIT trap 'rm -f "$file"' ERR
command flameshot gui --clipboard --raw > $file command flameshot gui --clipboard --raw > $file
echo "Screenshot saved to $file" echo "Screenshot saved to $file"
[ ! -s "$file" ] && return 1 [ ! -s "$file" ] && return 1
zipline "$file" Flameshot org.flameshot.Flameshot.desktop zipline "$file" Flameshot org.flameshot.Flameshot.desktop
rm -f "$file"
} }
function does-desktop-entry-exist { function does-desktop-entry-exist {