summaryrefslogtreecommitdiff
path: root/desktop/spectrwm/examples/spectrwm_screenshot.sh
blob: 58a9b09c312e909e2ca9306f3f32b3e60dd3b13f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh


CAPTURE_TOOL=/usr/bin/import
if [ ! -x "${CAPTURE_TOOL}" ];then
	echo "$0: couldn't run ${CAPTURE_TOOL}" >&2
	exit 1
fi

CAPTURE_PATH="${HOME}/spectrwm_capture_$(date +%FT%T).png"

case "$1" in
	'full')
		"${CAPTURE_TOOL}" -window root png:"${CAPTURE_PATH}"
	;;
	'window')
		sleep 0.5
		"${CAPTURE_TOOL}" png:"${CAPTURE_PATH}"
	;;
	*)
		echo "$0: $0 <full | window>" >&2
	;;
esac