GithubHelp home page GithubHelp logo

beccasaurus / simpletray Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 1.0 187 KB

Ruby library/DSL for declaratively defining system-tray applications (based on wxruby)

License: MIT License

Ruby 100.00%

simpletray's Introduction

simpletray

simpletray is a gem for making it really easy to make wxruby-based system tray applications

SimpleTray Screenshot

BUG ALERT

Windows and OS X don't raise the required events for dynamically creating submenus.

I'm in the process of testing this and finding a workaround.

Hopefully, I can get this working on OS X. For Windows, I'll be trying vruby / jruby / ironruby solutions.

Hopefully, this will work with native Ruby on Linux / OS X.

I'll be abstracting the GUI toolkit, so you can actually choose between Wx / Swing / WinForms / etc

installation

wx

simpletray uses wxWidgets, so you need to install it

A binary should be available for Windows users. Mac/Linux should be able to use your packaging systems. See http://www.wxwidgets.org/downloads/#latest_stable for latest wxWidgets releases.

For Windows, try the Windows installer

For Mac OS X, try using MacPorts:

$ sudo port install wxwidgets

For Ubuntu Linux, try:

# i *think* these are all the packages you need ... `aptitude search wx` to see all wx packages
$ sudo aptitude install libwxbase2.8-0 libwxgtk2.8-0

gems

now, install the required rubygems ...

$ sudo gem install wxruby activesupport

and ... simpletray!

$ sudo gem install remi-simpletray -s http://gems.github.com

usage

require 'rubygems'
require 'simpletray'

# icon my_cool_app.png will be used for the tray icon
SimpleTray.app "My Cool App" do

  # this makes a single item "About" (about.png will be used if found)
  # which pops up a message box when clicked
  about { msgbox "Hello!  This is my app!" }

  # this makes a submenu "Dogs" with rover/spot/rex subitems.
  # dogs.png, rover.png, spot.png, rex.png will all be looked for
  _dogs_  {
    rover { puts "..." }
    spot  { puts "..." }
    rex   { msgbox "w00f, my name is rex!" } 

    _more_dogs_ do
      another_dog     { puts "..." }
      yet_another_dog { puts "..." }
    end
  }

  # adds an item (the same as saying my_custom_item) with a custom icon
  item "My Custom Item", "custom-icon.png" do
    # ...
  end

  # adds an menu (the same as saying _my_custom_menu_) with a custom icon
  menu "My Custom Menu", "custom-menu-icon.png" do
    item1 { }
    item2 { }
  end

  # this adds a seperator and then a special "exit" item to quit the application
  ____
  exit

end

Also, see examples/first.rb (the first file I used for testing), which shows how to add your own helper methods

Note, currently I'm only supporting PNGs. I'll fix this to support ICO/PNG/BMP/JPG/etc. My TODO list is long :P

simpletray's People

Contributors

beccasaurus avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

doytsujin

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.