spectacle uploader fix

This commit is contained in:
2026-08-11 21:06:44 +02:00
parent 8fe81cf149
commit 81efd52a5e

View File

@@ -19,7 +19,7 @@ VISIBILITY="${VISIBILITY}" # 0 = public, 1 = unlisted, 2 = private
# Notification app header title & preview dimensions
APP_NAME="${APP_NAME:-f0ckm}"
PREVIEW_MAX_HEIGHT="${PREVIEW_MAX_HEIGHT:-80}" # Max height in pixels without cropping
PREVIEW_HEIGHT="${PREVIEW_HEIGHT:-80}" # Center crop height in pixels (e.g. 80)
# ── 1. Clipboard Helper Function (Wayland / X11) ───────────────────────────
copy_to_clipboard() {
@@ -64,16 +64,16 @@ if [ -f "$SAVE_PATH" ]; then
# Copy URL to clipboard
copy_to_clipboard "$ITEM_URL"
# Create preview thumbnail scaled up to 80px height (no cropping/cutting)
# Create center-cropped preview banner (exact 80px height)
PREVIEW_THUMB="/tmp/f0ckm_preview.png"
if command -v magick &>/dev/null; then
magick "$SAVE_PATH" -resize "x${PREVIEW_MAX_HEIGHT}>" "$PREVIEW_THUMB"
magick "$SAVE_PATH" -gravity center -crop "x${PREVIEW_HEIGHT}+0+0" +repage "$PREVIEW_THUMB"
else
PREVIEW_THUMB="$SAVE_PATH"
fi
# HTML body with preview max height 80px (no cut), and link on a new line
BODY_TEXT="<div><a href=\"${ITEM_URL}\"><img src=\"file://${PREVIEW_THUMB}\" style=\"max-height:${PREVIEW_MAX_HEIGHT}px; max-width:100%;\" /></a></div><br/><br/><a href=\"${ITEM_URL}\">${ITEM_URL}</a>"
# HTML body with fixed height preview banner (no scrolling), and link on a new line
BODY_TEXT="<div><a href=\"${ITEM_URL}\"><img src=\"file://${PREVIEW_THUMB}\" height=\"${PREVIEW_HEIGHT}\" style=\"height:${PREVIEW_HEIGHT}px; max-width:100%; object-fit:cover;\" /></a></div><br/><br/><a href=\"${ITEM_URL}\">${ITEM_URL}</a>"
# Send Notification
notify-send \