15 lines
480 B
Bash
Executable File
15 lines
480 B
Bash
Executable File
time=`date +%Y-%m-%d-%I-%M-%S`
|
|
geometry=$(hyprctl monitors -j | jq -r '.[] | select(.focused) | "\(.width)x\(.height)"')
|
|
dir="`xdg-user-dir PICTURES`/Screenshots"
|
|
file="Screenshot_${time}_${geometry}.png"
|
|
|
|
if [[ ! -d "$dir" ]]; then
|
|
mkdir -p "$dir"
|
|
fi
|
|
|
|
focused_window=$(hyprctl activewindow -j | jq -r '"\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"')
|
|
|
|
# Take Screenshot
|
|
cd "$dir" && grim -g "$focused_window" "$file" && wl-copy < "$file"
|
|
# Open Screenshot
|
|
viewnior ${dir}/"$file" |