Skip to content

Instantly share code, notes, and snippets.

@haraldmartin
Created March 5, 2010 22:43
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haraldmartin/323256 to your computer and use it in GitHub Desktop.
Save haraldmartin/323256 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
screenshot="screnshot.png"
screencapture='/usr/sbin/screencapture -xC'
if [ `whoami` == 'root' ]; then
loginpid=`ps -ax | grep [l]oginwindow.app | awk '{print $1}'`
launchctl bsexec $loginpid $screencapture $screenshot
else
$screencapture $screenshot
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment