Skip to content

Instantly share code, notes, and snippets.

@jbenet
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbenet/9271733 to your computer and use it in GitHub Desktop.
Save jbenet/9271733 to your computer and use it in GitHub Desktop.
open in WriteRoom from commandline
#!/bin/sh
# open in writeroom
if [ "$#" -eq 0 ]; then
echo "Open in WriteRoom"
echo "Usage: $0 <file>"
exit -1
fi
echo "opening $1 in WriteRoom..."
if [ ! -f "$1" ]; then
touch $1
fi
fp=$(echo $(cd $(dirname $1); pwd)/$(basename $1))
osascript - <<EOF
set p to "${fp}"
set a to POSIX file p
tell application "WriteRoom"
activate
open a
end tell
tell application "System Events"
tell process "WriteRoom"
click (menu item "Enter Full Screen Single" of menu 1 of menu bar item "Window" of menu bar 1)
end tell
end tell
return
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment