Coder Social home page Coder Social logo

growl's Introduction

Growl

Ruby growlnotify ‘bindings’.

Examples

notification = Growl.new
notification.message = 'Hello World'
notification.sticky!
notification.icon = :jpeg
notification.run if Growl.installed?

# OR

Growl.notify {
  self.message = 'Hello World'
  self.icon = :jpeg
  sticky!
}

# OR

Growl.notify do |n|
  n.message = 'Hello World'
  n.icon = :jpeg
  n.stick!
end

# OR

Growl.notify 'Foo', :icon => :jpeg, :title => 'Growl'

# OR

include Growl
notify 'Email received', :sticky => true

# Convenience methods

notify_ok 'Deployment successful'
notify_info 'Email received'
notify_warning 'Merge required'
notify_error 'Failed to send email', :sticky => true

Turn a Growl notification into an active url

notification = Growl.new
notification.message = 'I am an active url.'
notification.url = 'http://www.example.com'
notification.sticky!
notification.run if Growl.installed?

Now when you launch your notification the Growl message will be an active url to take you to www.example.com as if you had run from the command line:

growlnotify -m 'I am an active url' --url 'http://www.example.com'

Custom path to growlnotify

If needed you can set a path to the binary with:

Growl.bin_path = '~/my/path/to/growlnotify'

right after you require the growl library.

Normalized Icons

The :icon option key is automatically normalized when you use any of the Growl#notify methods, this removes the need to explicitly use :appIcon, :image, etc.

notify 'App icon', :icon => :Safari
notify 'Jpeg icon', :icon => :jpeg
notify 'Image icon', :icon => 'path/to/image.png'
notify 'Icns icon', :icon => 'path/to/icon.icns'
notify 'Path extname icon', :icon => 'foo.rb'

Features

  • Check availability with Growl.installed?

  • Check dependencies with Growl.version

  • Use images, icon paths, application icons, or file format icons

  • Sticky a notification making it appear until explicitly closed

  • Set notification priority

  • Convenience methods such as notify_ok, notify_warning, notify_error, and notify_info

  • Etc (consult growlnotify –help)

Installing growlnotify

Visit growl.info/documentation.php for installation help. Visit growl.info/downloads for download.

Known Issues

It seems that growlnotify will essentially ignore or block excessive usage of the notifications at random. To prevent this you may need to do something like below if you are calling many in sequence:

notify 'Something'; sleep 0.2
notify_ok 'Updated'; sleep 0.2
notify_info 'You have new mail'; sleep 0.2
notify_warning 'Merged required'; sleep 0.2
notify_error 'Oh Noes!'; sleep 0.2

Contribute

Fork / send a pull request or submit a ticket at: github.com/visionmedia/growl/issues

License:

(The MIT License)

Copyright © 2009 TJ Holowaychuk <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, an d/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

growl's People

Contributors

geopet avatar lukaszkorecki avatar tj avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.