Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tenfensw/dialogbind
DialogBind provides a Ruby API that wraps around Linux, macOS and Windows message box-generating tools.
https://github.com/tenfensw/dialogbind
gui linux macos ruby ruby-application rubygem windows
Last synced: 1 day ago
JSON representation
DialogBind provides a Ruby API that wraps around Linux, macOS and Windows message box-generating tools.
- Host: GitHub
- URL: https://github.com/tenfensw/dialogbind
- Owner: tenfensw
- License: mit
- Created: 2019-07-21T16:00:36.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-08-15T14:18:25.000Z (about 5 years ago)
- Last Synced: 2024-10-31T13:39:34.512Z (8 days ago)
- Topics: gui, linux, macos, ruby, ruby-application, rubygem, windows
- Language: Ruby
- Homepage:
- Size: 22.5 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.asciidoc
- License: LICENSE
Awesome Lists containing this project
README
= DialogBind
_Copyright (C) Tim K 2018-2019 [email protected]. Licensed under MIT License._
https://rubygems.org/gems/dialogbind*DialogBind* is a library wrapping around message box displaying tools (zenity and xmessage) on Linux, macOS and Windows written in Ruby.
== A simple example
[source,ruby]
----
require 'dialogbind'if guiyesno('Would you like me to show you a random number?', 'Message') == false then
guierror('You have selected no.')
else
guiputs(rand(20).to_s, 'Your random number')
end
----
This tiny program in Ruby will show a question dialog with yes and no buttons, with title "Message" and text "Would you like me to show you a random number?". That dialog will return either true if yes was clicked, otherwise, it returns false. If false is returned, an error with text "You have selected no." pops up. Otherwise, a random number from 0 to 19 is generated and is displayed in an information message box with title "Your random number".== Installing
Install RubyGem:
[source,bash]
----
sudo gem install dialogbind
----And then include it in your Ruby code the following way:
[source,ruby]
----
require 'dialogbind'
----That's it! You can use it from your code, but it will only work on Linux, macOS, Windows and FreeBSD. Other platforms are not supported right now.
== Docs
Docs are available on RubyDoc: http://www.rubydoc.info/gems/dialogbind/