23 lines
579 B
Bash
Executable File
23 lines
579 B
Bash
Executable File
#!/bin/bash
|
|
###
|
|
### ~/.config/hypr/scripts/screenshot/screenshot_monitor.sh
|
|
###
|
|
|
|
time=$(date +%Y-%m-%d-%H%M%S)
|
|
dir="$(xdg-user-dir PICTURES)/Screenshots"
|
|
|
|
monitor=$(hyprctl monitors -j | jq -r '.[] | select(.focused) | .name')
|
|
[ -n "$monitor" ] || exit 1
|
|
|
|
file="Screenshot_${time}_${monitor}.png"
|
|
|
|
mkdir -p "$dir"
|
|
|
|
# Capture the focused monitor, save it and copy to clipboard
|
|
grim -o "$monitor" "$dir/$file" || exit 1
|
|
wl-copy -t image/png < "$dir/$file"
|
|
|
|
if command -v notify-send >/dev/null 2>&1; then
|
|
notify-send -a Screenshot -i camera-photo "Screenshot saved" "$file"
|
|
fi
|