spectacle uploader fix
This commit is contained in:
@@ -19,7 +19,7 @@ VISIBILITY="${VISIBILITY}" # 0 = public, 1 = unlisted, 2 = private
|
|||||||
|
|
||||||
# Notification app header title & preview dimensions
|
# Notification app header title & preview dimensions
|
||||||
APP_NAME="${APP_NAME:-f0ckm}"
|
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) ───────────────────────────
|
# ── 1. Clipboard Helper Function (Wayland / X11) ───────────────────────────
|
||||||
copy_to_clipboard() {
|
copy_to_clipboard() {
|
||||||
@@ -64,16 +64,16 @@ if [ -f "$SAVE_PATH" ]; then
|
|||||||
# Copy URL to clipboard
|
# Copy URL to clipboard
|
||||||
copy_to_clipboard "$ITEM_URL"
|
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"
|
PREVIEW_THUMB="/tmp/f0ckm_preview.png"
|
||||||
if command -v magick &>/dev/null; then
|
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
|
else
|
||||||
PREVIEW_THUMB="$SAVE_PATH"
|
PREVIEW_THUMB="$SAVE_PATH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# HTML body with preview max height 80px (no cut), and link on a new line
|
# 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}\" style=\"max-height:${PREVIEW_MAX_HEIGHT}px; max-width:100%;\" /></a></div><br/><br/><a href=\"${ITEM_URL}\">${ITEM_URL}</a>"
|
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
|
# Send Notification
|
||||||
notify-send \
|
notify-send \
|
||||||
|
|||||||
Reference in New Issue
Block a user