summaryrefslogtreecommitdiff
path: root/config/hyprland/hypr/screenshot.sh
blob: e571b5b1fc075a3c05c4b17b039ee4d6c25f9fc2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh

dir="$(xdg-user-dir PICTURES)"
test -d "$dir" &&
	dir="$HOME/pics"

case $1 in
	"-m")
		actwin="$(hyprctl activewindow -j | jq -r '.monitor')"
		actmon="$(hyprctl monitors -j |
			jq -r ".[] | select(.id == $actwin)" |
			jq -r '.name')" 
		grim -o "$actmon" "$dir/screenshots/$(date +%y%m%d_%H_%M_%S.png)"
		;;
	"-f")
		grim "$dir/screenshots/$(date +%y%m%d_%H_%M_%S.png)"
		;;
	"-s")
		grim -g "$(slurp)" "$dir/screenshots/$(date +%y%m%d_%H_%M_%S.png)"
		;;
	"-sc")
		grim -g "$(slurp)" - | wl-copy
		;;
	*)
		exit
		;;
esac