[screenshot] improved

This commit is contained in:
Simon Cornet 2024-03-25 13:51:31 +01:00
parent 5d318dd3fa
commit 7fdd733b13

View File

@ -1,35 +1,61 @@
#!/usr/bin/env zsh #!/usr/bin/env bash
# screenshot function for an area # commands
screenshot_area () { wofi_command="wofi -l 5"
grimblast \ grimblast="grimblast --notify"
--notify save area - | \ satty="satty --filename - --fullscreen --output-filename ~/Pictures/Screenshots/satty-$(date '+%Y%m%d-%H:%M:%S').png"
satty \
--filename - \
--fullscreen \ # buttons
--output-filename ~/Pictures/Screenshots/satty-$(date '+%Y%m%d-%H:%M:%S').png area="🖥️ Capture area"
infive="🖥️ Capture area in 5 seconds"
inten="🖥️ Capture area in 10 seconds"
screen="🖥️ Capture whole screen"
window="🖥️ Capture active window"
# take shots
screenshot_area() {
$grimblast save area - | $satty
} }
# screenshot function for full screen screenshot_window() {
screenshot_screen () { $grimblast save active - | $satty
grimblast \
--notify save screen - | \
satty \
--filename - \
--fullscreen \
--output-filename ~/Pictures/Screenshots/satty-$(date '+%Y%m%d-%H:%M:%S').png
} }
# main function screenshot_full_now() {
case $1 in $grimblast save screen - | $satty
area) }
screenshot_full_5() {
sleep 5
$grimblast save screen - | $satty
}
screenshot_full_10() {
sleep 10
$grimblast save screen - | $satty
}
# start wofi
options="$area\n$infive\n$inten\n$screen\n$window"
chosen="$(echo -e "$options" | $wofi_command -p 'Say cheese ...' -dmenu --no-action --width=400 --height=302 -selected-row 0 --style=/home/simon/.dotfiles/apps/wofi/style.css)"
sleep 1
case $chosen in
$area)
screenshot_area screenshot_area
;; ;;
screen) $infive)
screenshot_screen screenshot_full_5
;; ;;
*) $inten)
echo "Usage: $0 {area|screen}" screenshot_full_10
exit 1 ;;
$screen)
screenshot_full_now
;;
$window)
screenshot_window
;; ;;
esac esac