move from swappy to satty
This commit is contained in:
@@ -21,19 +21,12 @@ if command -v notify-send >/dev/null 2>&1; then
|
||||
notify-send -a Screenshot -i camera-photo "Screenshot saved" "$file"
|
||||
fi
|
||||
|
||||
# Open the editor if swappy is available (blocks until it is closed).
|
||||
# swappy never overwrites the opened file on Ctrl+s (it saves a new
|
||||
# timestamped copy to save_dir), so pass it a temporary config pointing
|
||||
# save_dir/save_filename_format at our exact file: Ctrl+s then saves and
|
||||
# exits (early_exit). -o writes the final surface when quitting with Esc/q.
|
||||
# Note: closing with Ctrl+w or the X button quits without saving (swappy).
|
||||
if command -v swappy >/dev/null 2>&1; then
|
||||
cfg=$(mktemp -d)
|
||||
mkdir -p "$cfg/swappy"
|
||||
printf '[Default]\nsave_dir=%s\nsave_filename_format=%s\nearly_exit=true\n' \
|
||||
"$dir" "$file" > "$cfg/swappy/config"
|
||||
XDG_CONFIG_HOME="$cfg" swappy -f "$dir/$file" -o "$dir/$file"
|
||||
rm -rf "$cfg"
|
||||
# Open the editor if satty is available (blocks until it is closed).
|
||||
# satty writes the annotated image to --output-filename on Ctrl+s (and on
|
||||
# Esc/Enter here) and exits immediately.
|
||||
if command -v satty >/dev/null 2>&1; then
|
||||
satty --filename "$dir/$file" --output-filename "$dir/$file" \
|
||||
--copy-command wl-copy --actions-on-escape save-to-file --early-exit
|
||||
wl-copy -t image/png < "$dir/$file"
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user