Finally pushed my gentoo dotfiles :3
This commit is contained in:
commit
0b55692739
70 changed files with 9750 additions and 0 deletions
30
sway/scripts/screenshot-region.sh
Executable file
30
sway/scripts/screenshot-region.sh
Executable file
|
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/env bash
|
||||
# Region screenshot for swayfx.
|
||||
# Drag a region with slurp, save a timestamped PNG to ~/Media (matching the
|
||||
# naming of the existing screenshots there) and copy the same image to the
|
||||
# Wayland clipboard (paste with Ctrl+V).
|
||||
set -uo pipefail
|
||||
|
||||
dir="${HOME}/Media"
|
||||
mkdir -p -- "$dir" || exit 1
|
||||
|
||||
# slurp exits non-zero when the selection is cancelled (Esc).
|
||||
geometry="$(slurp)" || exit 0
|
||||
[[ -n "$geometry" ]] || exit 0
|
||||
|
||||
# Same style as existing files (2026-02-08_18-05.png); add _n only if two
|
||||
# captures land in the same minute, so nothing is ever overwritten.
|
||||
base="$dir/$(date +%Y-%m-%d_%H-%M)"
|
||||
file="${base}.png"
|
||||
n=1
|
||||
while [[ -e "$file" ]]; do
|
||||
file="${base}_${n}.png"
|
||||
((n++))
|
||||
done
|
||||
|
||||
if grim -g "$geometry" - | tee -- "$file" | wl-copy --type image/png; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
rm -f -- "$file"
|
||||
exit 1
|
||||
Loading…
Add table
Add a link
Reference in a new issue