push all the updates
This commit is contained in:
53
.config/waybar/scripts/capture-share-shot.sh
Executable file
53
.config/waybar/scripts/capture-share-shot.sh
Executable 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
|
||||
16
.config/waybar/scripts/check-mount.sh
Executable file
16
.config/waybar/scripts/check-mount.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/bash
|
||||
# Usage: check-mount.sh <mountpoint> <label>
|
||||
# Outputs Waybar custom module JSON
|
||||
|
||||
MOUNT="$1"
|
||||
LABEL="$2"
|
||||
ICON_MOUNT=""
|
||||
ICON_DOWN=""
|
||||
|
||||
if mountpoint -q "$MOUNT"; then
|
||||
read -r used avail pcent <<< "$(df -h --output=used,avail,pcent "$MOUNT" | tail -1)"
|
||||
printf '{"text": "%s %s %s/%s (%s)", "tooltip": "%s mounted — used: %s, free: %s (%s)", "class": "mounted"}\n' \
|
||||
"$ICON_MOUNT" "$LABEL" "$used" "$avail" "$pcent" "$MOUNT" "$used" "$avail" "$pcent"
|
||||
else
|
||||
printf '{"text": "%s %s N/A", "tooltip": "%s is NOT mounted", "class": "unmounted"}\n' "$ICON_DOWN" "$LABEL" "$MOUNT"
|
||||
fi
|
||||
Reference in New Issue
Block a user