spectrwm_screenshot.sh 392 B

123456789101112131415161718192021222324
  1. #!/bin/sh
  2. CAPTURE_TOOL=/usr/bin/import
  3. if [ ! -x "${CAPTURE_TOOL}" ];then
  4. echo "$0: couldn't run ${CAPTURE_TOOL}" >&2
  5. exit 1
  6. fi
  7. CAPTURE_PATH="${HOME}/spectrwm_capture_$(date +%FT%T).png"
  8. case "$1" in
  9. 'full')
  10. "${CAPTURE_TOOL}" -window root png:"${CAPTURE_PATH}"
  11. ;;
  12. 'window')
  13. sleep 0.5
  14. "${CAPTURE_TOOL}" png:"${CAPTURE_PATH}"
  15. ;;
  16. *)
  17. echo "$0: $0 <full | window>" >&2
  18. ;;
  19. esac