dotfiles/system/.local/bin/screenshot
Severin Kaderli 61510dd009
Update screenshot script
Signed-off-by: Severin Kaderli <severin@kaderli.dev>
2023-01-15 01:00:27 +01:00

30 lines
763 B
Bash
Executable file

#!/usr/bin/env bash
# The rofi prompt
PROMPT="Screenshot"
# Actions for the menu
ACTIONS=(
"1: Fullscreen"
"2: Selection"
"3: Window"
"4: Delayed"
)
FILENAME="$(xdg-user-dir PICTURES)/screenshots/$(date +"%Y-%m-%dT%H%M%S").png"
SELECTION=$(printf '%s\n' "${ACTIONS[@]}" | fuzzel -dmenu -I| cut -d ":" -f1)
case "${SELECTION}" in
"1")
grim - | tee "${FILENAME}" | wl-copy
;;
"2")
grim -g "$(slurp)" - | tee "${FILENAME}" | wl-copy
;;
"3")
grim -g "$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"' | slurp)" - | tee "${FILENAME}" | wl-copy
;;
"4")
sleep 3 && grim - | tee "${FILENAME}" | wl-copy
;;
esac