drawrect is a simple command line OS X app that draws rectangles on the screen.
It was originally designed to aid debugging Shortcat by visualising
NSRects from within
It also serves as an example on how to build a command line app with RubyMotion.
drawrect was designed to be used from within
dr object.bounds- draws a rect at object.bounds using bottom-left origin
drf object.bounds- draws a rect at object.bounds using top-left origin
drc- clears all rects
You can use it from the command line as well.
Usage: drawrect rect <rect> [label] [colour] [opacity] - draws a rect with bottom left origin drawrect flipped_rect <rect> [label] [colour] [opacity] - draws a rect with top left origin drawrect clear - clears all rects drawrect quit - quits server
- Download the binary or build it yourself
curl -L https://github.com/chendo/drawrect/releases/download/v1.0/drawrect > /usr/local/bin/drawrect && chmod +x /usr/local/bin/drawrect
- Optional: Grab
mkdir -p ~/Library/lldb; curl -L https://github.com/chendo/drawrect/raw/master/drawrect.py > ~/Library/lldb/drawrect.py
echo "command script import ~/Library/lldb/drawrect.py" >> ~/.lldbinit
- Only tested on 10.8
- The backgrounded
drawrectserver will exit after an hour of inactivity.
- The rects will stay on the screen after
lldbquits. I couldn't seem to find hooks for process termination or resuming execution.
Building from source
drawrect is written in RubyMotion, so you'll need that to compile it.
$ rake build:development # binary will get built at `build/MacOSX*/drawrect.app/MacOS/drawrect`
See LICENSE for details.