aboutsummaryrefslogtreecommitdiff
path: root/config/sway/scripts/screenshot
blob: 45086f1b85e0d238caaf16cf1b90cc57eddccdcd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh
case "${1:-}" in
desktop)
	exec grim
	;;
output)
	exec grim -o "$(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name')"
	;;
window)
	exec grim -g "$(swaymsg -t get_tree |
		jq -j '.. | select(.type?) | select(.focused).rect | "\(.x),\(.y) \(.width)x\(.height)"')"
	# TODO the second variant is newer but doesn't work with my version of sway
	exec grim -T "$(swaymsg -t get_tree |
		jq -j '.. | select(.type?) | select(.focused).foreign_toplevel_identifier')"
	;;
select)
	exec grim -g "$(slurp)"
	;;
esac