···11#!/bin/bash
2233# Wrapper for omarchy-cmd-screenshot with post-processing
44-# Calls the original omarchy script, then organizes screenshots into monthly folders
44+# Calls the original omarchy script, then always opens Satty for editing
55+# and organizes screenshots into monthly folders
5666-# Call the original omarchy-cmd-screenshot with all arguments passed through
77-~/.local/share/omarchy/bin/omarchy-cmd-screenshot "$@"
77+[[ -f ~/.config/user-dirs.dirs ]] && source ~/.config/user-dirs.dirs
88+OUTPUT_DIR="${OMARCHY_SCREENSHOT_DIR:-${XDG_PICTURES_DIR:-$HOME/Pictures}}"
8999-# Post-processing: Auto-organize screenshots into year-month folders
1010-# Run in background to avoid blocking the screenshot workflow
1111-{
1212- sleep 0.5 # Wait for file to be fully written
1313- ~/.config/hypr/sspaeti/image-browser/auto-organize-screenshot.sh >/dev/null 2>&1
1010+# Record newest screenshot before taking a new one
1111+BEFORE=$(ls -t "$OUTPUT_DIR"/screenshot-*.png 2>/dev/null | head -1)
14121515- # # Fast OCR indexing - only recent screenshots
1616- # if [[ -f "/home/sspaeti/.config/hypr/sspaeti/image-browser/screenshot-indexer-parallel.sh" ]]; then
1717- # "/home/sspaeti/.config/hypr/sspaeti/image-browser/screenshot-indexer-parallel.sh" --recent >/dev/null 2>&1
1818- # fi
1919-} &
1313+# Call the original omarchy-cmd-screenshot, suppressing its notification
1414+OMARCHY_SCREENSHOT_EDITOR=true ~/.local/share/omarchy/bin/omarchy-cmd-screenshot "$@"
1515+1616+# Find the newly created screenshot
1717+AFTER=$(ls -t "$OUTPUT_DIR"/screenshot-*.png 2>/dev/null | head -1)
1818+1919+# If a new screenshot was taken, open Satty
2020+if [[ -n "$AFTER" && "$AFTER" != "$BEFORE" ]]; then
2121+ satty --filename "$AFTER" \
2222+ --output-filename "$AFTER" \
2323+ --actions-on-enter save-to-clipboard \
2424+ --save-after-copy \
2525+ --copy-command 'wl-copy'
2626+2727+ # Post-processing: Auto-organize screenshots into year-month folders
2828+ ~/.config/hypr/sspaeti/image-browser/auto-organize-screenshot.sh >/dev/null 2>&1 &
2929+fi