updates to swappy in screenshots

This commit is contained in:
Your Name
2026-08-14 12:37:44 +00:00
parent da16f88ec3
commit 4e40d20092
3 changed files with 30 additions and 6 deletions
+10 -2
View File
@@ -22,9 +22,17 @@ fi
# Open the editor if swappy is available (blocks until it is closed). # 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 # swappy never overwrites the opened file on Ctrl+s (it saves a new
# timestamped copy to save_dir), so -o writes the final surface back here. # 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 if command -v swappy >/dev/null 2>&1; then
swappy -f "$dir/$file" -o "$dir/$file" 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"
wl-copy -t image/png < "$dir/$file" wl-copy -t image/png < "$dir/$file"
fi fi
+10 -2
View File
@@ -23,9 +23,17 @@ fi
# Open the editor if swappy is available (blocks until it is closed). # 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 # swappy never overwrites the opened file on Ctrl+s (it saves a new
# timestamped copy to save_dir), so -o writes the final surface back here. # 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 if command -v swappy >/dev/null 2>&1; then
swappy -f "$dir/$file" -o "$dir/$file" 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"
wl-copy -t image/png < "$dir/$file" wl-copy -t image/png < "$dir/$file"
fi fi
+10 -2
View File
@@ -42,9 +42,17 @@ fi
# Open the editor if swappy is available (blocks until it is closed). # 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 # swappy never overwrites the opened file on Ctrl+s (it saves a new
# timestamped copy to save_dir), so -o writes the final surface back here. # 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 if command -v swappy >/dev/null 2>&1; then
swappy -f "$dir/$file" -o "$dir/$file" 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"
wl-copy -t image/png < "$dir/$file" wl-copy -t image/png < "$dir/$file"
fi fi