push all the updates

This commit is contained in:
2026-04-15 20:27:52 +02:00
parent 0936134f92
commit feca201858
9 changed files with 636 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
#!/usr/bin/bash
set -euo pipefail
base_dir="/mnt/data/media/share/pictures"
tmp_file="$(mktemp --suffix=.png)"
selection_file="$(mktemp)"
cleanup() {
rm -f "$tmp_file" "$selection_file"
}
trap cleanup EXIT
choose_subfolder() {
if [[ ! -d "$base_dir" ]] || ! mountpoint -q /mnt/data; then
return 1
fi
{
printf '/\n'
find "$base_dir" -mindepth 1 -type d -printf '%P\n' | sort
} > "$selection_file"
if selected=$(wofi --dmenu --prompt 'Save screenshot folder' < "$selection_file"); then
if [[ -z "$selected" || "$selected" == "/" ]]; then
printf '%s\n' "$base_dir"
else
printf '%s/%s\n' "$base_dir" "$selected"
fi
return 0
fi
printf '%s\n' "$base_dir"
}
if ! region="$(slurp)"; then
exit 0
fi
if ! grim -g "$region" - | swappy -f - -o "$tmp_file"; then
exit 1
fi
wl-copy --type image/png < "$tmp_file"
if destination_dir="$(choose_subfolder)"; then
mkdir -p "$destination_dir"
file_name="screenshot-$(date +%Y%m%d-%H%M%S).png"
cp "$tmp_file" "$destination_dir/$file_name"
notify-send 'Screenshot saved' "$destination_dir/$file_name\nCopied to clipboard"
else
notify-send 'Screenshot copied' 'NAS picture share is not available; image copied to clipboard only'
fi