Project

post-it

0.0
No commit activity in last 3 years
No release in over 3 years
A simple utlity that uses `Sticky Notificiations.app` to post messages to Notification Center on Mac OS X.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
~> 0.9.2
>= 0

Runtime

~> 1.2.1
 Project Readme

Post-It

Sticky Notifications is a Mac Application developed by the brilliant Matt Gemmell. It allows you to create post-it note style reminders into Notification Center (Mountain Lion or later) or Growl.

Post-It is a simple utility that uses Sticky Notifications to post messages to Notification Center on Mac OS X. You can now easily send yourself notifications from command-line or your own scripts and applications.

Important: This utility will only function if you have Sticky Notifications.app v1.0.4+ installed.

Installation

Add this line to your application's Gemfile:

gem 'post-it'

And then execute:

$ bundle

Or install it yourself as:

$ gem install post-it

Usage

Shell or Terminal

Usage: post-it [options] message

Options:
        --version                    Show help/version info
        --prepare                    Prepare the post-it and open it 
        							 inside Sticky Notifications.app
    -t, --title TITLE                The title of the notification
                                     (default: Post It)
    -s, --subtitle SUBTITLE          The subtitle of the notification

Arguments:

    message
        The notification message that will be displayed in Notification Center.

Post a simple message:

$ post-it "My Message"

Post with custom titles:

$ post-it -t "My Title" -s "My Subtitle" "My Message"

Prepare a message in SN:

$ post-it --prepare -t "My Title" -s "My Subtitle" "My Message"

Ruby Class

The post-it terminal command simply uses the PostIt::Notification class in order to send messages to Sticky Notifications. You can do the same thing form your ruby scripts.

Quick and dirty notifications:

post_it = PostIt::Notification.new()
post_it.send("My Message")

You can define default values for both the title and the subtitle when you create the post-it object. These options are passed as a hash.

post_it = PostIt::Notification.new({:title => "My Title", :subtitle => "My Subtitle"})

You can override the default titles when you are sending the notification:

post_it.send(message,{:title => "My Title",:subtitle => "Post-It"})

You can prepare a notification to be posted by having it open inside a SN window:

post_it.prepare(message,{:title => "Optional"})

Its probably a good idea to check for errors when you are using Post-It. Exceptions will be raised in two scenarios:

  1. If the Sticky Notifications.app is not found in the /Applications folder.
  2. If an error occurs while sending the notifications via the SN URL scheme.

Example:

begin
  post_it = PostIt::Notification.new()
  post_it.send(message)
rescue Exception => e 
  # There was an error
  puts e.message
end

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request