Hyprland-dotfiles/hypr/scripts/screenshot.sh

46 lines
1.6 KiB
Bash
Raw Normal View History

2023-08-20 11:34:53 -04:00
#!/bin/bash
# ____ _ _
# / ___| ___ _ __ ___ ___ _ __ ___| |__ ___ | |_
# \___ \ / __| '__/ _ \/ _ \ '_ \/ __| '_ \ / _ \| __|
# ___) | (__| | | __/ __/ | | \__ \ | | | (_) | |_
# |____/ \___|_| \___|\___|_| |_|___/_| |_|\___/ \__|
#
#
# by Stephan Raabe (2023)
# -----------------------------------------------------
DIR="$HOME/Pictures/screenshots/"
NAME="screenshot_$(date +%d%m%Y_%H%M%S).png"
option2="Selected area"
option3="Fullscreen (delay 3 sec)"
option4="Current display (delay 3 sec)"
2023-08-20 11:34:53 -04:00
options="$option2\n$option3\n$option4"
2023-08-20 11:34:53 -04:00
choice=$(echo -e "$options" | rofi -dmenu -replace -config ~/dotfiles/rofi/config-screenshot.rasi -i -no-show-icons -l 3 -width 30 -p "Take Screenshot")
2023-08-20 11:34:53 -04:00
case $choice in
$option2)
2024-03-14 12:27:15 -04:00
grim -g "$(slurp)" "$DIR$NAME"
xclip -selection clipboard -t image/png -i "$DIR$NAME"
notify-send "Screenshot created and copied to clipboard" "Mode: Selected area"
swappy -f "$DIR$NAME"
2023-08-20 11:34:53 -04:00
;;
$option3)
sleep 3
2024-03-14 12:27:15 -04:00
grim "$DIR$NAME"
xclip -selection clipboard -t image/png -i "$DIR$NAME"
notify-send "Screenshot created and copied to clipboard" "Mode: Fullscreen"
swappy -f "$DIR$NAME"
2023-08-20 11:34:53 -04:00
;;
$option4)
sleep 3
monitor="$(hyprctl monitors | awk '/Monitor/{monitor=$2} /focused: yes/{print monitor; exit}')"
grim -o "$monitor" "$DIR$NAME"
xclip -selection clipboard -t image/png -i "$DIR$NAME"
notify-send "Screenshot created and copied to clipboard" "Mode: Fullscreen"
swappy -f "$DIR$NAME"
;;
2023-08-20 11:34:53 -04:00
esac