This repository has been archived on 2024-07-10. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles-nix/apps/screenshot/screenshot.sh

62 lines
1.2 KiB
Bash
Raw Permalink Normal View History

2024-03-25 13:51:31 +01:00
#!/usr/bin/env bash
# commands
wofi_command="wofi -l 5"
grimblast="grimblast --notify"
satty="satty --filename - --fullscreen --output-filename ~/Pictures/Screenshots/satty-$(date '+%Y%m%d-%H:%M:%S').png"
# buttons
area="🖥️ Capture area"
area_5="🖥️ Capture area in 5 seconds"
2024-03-25 13:51:31 +01:00
screen="🖥️ Capture whole screen"
screen_5="🖥️ Capture whole screen in 10 seconds"
2024-03-25 13:51:31 +01:00
window="🖥️ Capture active window"
# take shots
screenshot_area() {
$grimblast save area - | $satty
}
screenshot_area_5() {
sleep 5
$grimblast save area - | $satty
}
screenshot_full() {
2024-03-25 13:51:31 +01:00
$grimblast save screen - | $satty
}
2024-03-25 13:51:31 +01:00
screenshot_full_5() {
sleep 5
$grimblast save screen - | $satty
}
screenshot_window() {
$grimblast save active - | $satty
2024-03-25 13:51:31 +01:00
}
# start wofi
options="$area\n$area_5\n$screen\n$screen_5\n$window"
2024-03-25 13:51:31 +01:00
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
;;
$area_5)
screenshot_area_5
2024-03-25 13:51:31 +01:00
;;
$screen)
screenshot_full
;;
$screen_5)
screenshot_full_5
;;
2024-03-25 13:51:31 +01:00
$window)
screenshot_window
;;
esac