Home Forums Wiki Doc Install Extras Screenshots Source Code Projects Blog Users Groups Register
Glx-Dock / Cairo-Dock List of forums Applets | Applets Ruby applet, RubyBattery
The latest stable release is the *3.4.0* : How to install it here.
Note: We just switched from BZR to Git on Github! (only to host the code and your future pull requests)
Applets | Applets

Subjects Author Language Messages Last message
[Locked] Ruby applet, RubyBattery
Page : 1 2
Eduardo Mucelli English 29 fabounet [Read]
11 April 2010 à 20:45

Eduardo Mucelli, Thursday 25 March 2010 à 02:58


Subscription date : 05 August 2009
Messages : 285
I'm a Ruby enthusiast and could not resist to code some applet to Cairo-Dock. Since this was the first one coded in Ruby, I had no reference how to deal with some specificities such as DBus. So, this applet is not that useful, but personally I'm using it, but I have no hope that much more persons will use it. It is a PowerManager kind of applet. It keeps monitoring the battery charge using threads, show some alert when the charge is critically down. As I said, it is more a proof-of-concept and a union of lots of things that I've learned regarding Ruby, Dbus and Cairo-Dock Dbus interface in this last 3 days.

The applet is using the Battery gauge, but I've made a gauge specifically for RubyBattery. It is a cute ruby being filled as the battery charge increases and emptied as the battery charge decreases. I did commit the gauge files together with the applet.

There is a README file in the RubyBattery applet which shows some informations such as what need to be installed to run the applet, Ruby and some another things. Any doubt, suggestion or anything else, except asking for some money , I would be pleased to received a message from you all.

I will keep myself coding Ruby applets to Cairo-Dock, even if nobody gonna use it

Thanks.

Eduardo Mucelli, Thursday 25 March 2010 à 03:03


Subscription date : 05 August 2009
Messages : 285
Here is how it looks like
http://dl.dropbox.com/u/1433190/RubyBattery.png

fabounet, Thursday 25 March 2010 à 03:41


Subscription date : 30 November 2007
Messages : 17118
hoho, well done !
although I'm not fan of Ruby, it may interest people who knows this language better than Python or Mono.
I'm quite happy to see that the DBus API can be used to make such useful applet
feel free to share your code with other users.

Eduardo Mucelli, Thursday 25 March 2010 à 03:48


Subscription date : 05 August 2009
Messages : 285
Now I can add the word "Ruby" to the list of languages used for applets in the Wiki.

fabounet, Thursday 25 March 2010 à 14:20


Subscription date : 30 November 2007
Messages : 17118
yes !
want to put your applet on the site ?
also, would it be possible to make a Ruby version of the Demo applet ?
I already have 4 versions of this applet, they are placed in the sources as boilerplate.

matttbe, Thursday 25 March 2010 à 15:27


Subscription date : 24 January 2009
Messages : 12573
Can you share your sources ? (a bzr branch, a tarball, or what you want) )
If possible under GNU/GPL3 licence.

Eduardo Mucelli, Thursday 25 March 2010 à 15:56


Subscription date : 05 August 2009
Messages : 285
@fabounet: I will code the demo in ruby. Actually I began coding the demo, but latter I changed its functionalities to RubyBattery.
@matttbe: I did it, I submitted yesterday to bzr in launchpad under my login "eduardo-mucelli". It is already under GNU/GPL3 and the terms are described in the code.
I proposed merge branch right now.

Thanks

matttbe, Thursday 25 March 2010 à 16:02


Subscription date : 24 January 2009
Messages : 12573
Thanks, I see it
Let me try before merging

EDIT : answered -> https://code.launchpad.net/~eduardo-mucelli/cairo-dock-plug-ins-extras/RubyBattery/+merge/22137

matttbe, Thursday 25 March 2010 à 18:03


Subscription date : 24 January 2009
Messages : 12573
It's merged

Just : I can't change the gauge and the wrong icon is displayed :
http://uppix.net/8/b/7/1ae3a73c43391b935efc2eac7144f.png

$ acpi
Battery 0: Unknown, 97%
$ acpi -t
Thermal 0: ok, 62.0 degrees C
Thermal 1: ok, 52.0 degrees C

Eduardo Mucelli, Thursday 25 March 2010 à 18:58


Subscription date : 05 August 2009
Messages : 285
I know why. Your "acpi -t" does not bring the charge informations together with temperature, just the temperature. Mine brings your results of acpi + acpi -t together.
I'm thankful because you pointed this out. I will fix.

Edit: Could you provide me your "acpi -b" result ?

Eduardo Mucelli, Friday 26 March 2010 à 00:18


Subscription date : 05 August 2009
Messages : 285
@matttbe: I committed a new version. In order to select a new gauge, change value of "theme" parameter present in RubyBattery.conf file, e.g., "theme = Battery" to "theme = Ruby-Battery". Later, it is necessary to copy the "Ruby-Battery" directory and paste it in "/usr/share/cairo-dock/gauges". Reload the applet and it is done.
In the next version I will ask the user for the gauge and change it in the file.

ppmt, Friday 26 March 2010 à 02:20


Subscription date : 29 November 2007
Messages : 3520
J'ai ca en mettant a jour avec le script

Installation : Plug-ins Extras
\tCheck dependences
Package `ruby1.8-dev' is not installed and no info is available.
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents.
dependences_deb.sh: 17: cannot create : Directory nonexistent
Package `ri1.8' is not installed and no info is available.
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents.
dependences_deb.sh: 17: cannot create : Directory nonexistent
Package `rdoc1.8' is not installed and no info is available.
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents.
dependences_deb.sh: 17: cannot create : Directory nonexistent
Package `irb1.8' is not installed and no info is available.
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents.
dependences_deb.sh: 17: cannot create : Directory nonexistent
Package `libreadline-ruby1.8' is not installed and no info is available.
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents.
dependences_deb.sh: 17: cannot create : Directory nonexistent
Package `rubygems1.8' is not installed and no info is available.
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents.
dependences_deb.sh: 17: cannot create : Directory nonexistent
Package `acpi' is not installed and no info is available.
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents.
dependences_deb.sh: 17: cannot create : Directory nonexistent

Eduardo Mucelli, Friday 26 March 2010 à 02:33


Subscription date : 05 August 2009
Messages : 285
The Google Translator did not translated the French text properly but I guess you did a script to verify the compatibility of the Ruby installation with the necessary requirements of the plugin. Is this it ? If so, oh, man, that is awesome. Thanks.

Eduardo Mucelli, Friday 26 March 2010 à 02:51


Subscription date : 05 August 2009
Messages : 285
@all: I've coded the demo_ruby. In order to push it to LP which one of the commands I do:
1) bzr push lp:~eduardo-mucelli/cairo-dock-plug-ins-extras/demos/demo_ruby or
2) bzr push lp:~eduardo-mucelli/cairo-dock-plug-ins-extras/demo_ruby

Thanks.

matttbe, Friday 26 March 2010 à 15:26


Subscription date : 24 January 2009
Messages : 12573
Eduardo Mucelli :
Could you provide me your "acpi -b" result ?
$ acpi -b
Battery 0: Charging, 45%, 00:42:20 until charged


In order to select a new gauge, change value of "theme" parameter present in RubyBattery.conf file, e.g., "theme = Battery" to "theme = Ruby-Battery". Later, it is necessary to copy the "Ruby-Battery" directory and paste it in "/usr/share/cairo-dock/gauges". Reload the applet and it is done.
In the next version I will ask the user for the gauge and change it in the file.
The approach should be :
In order to use it, just do the following:
  • 1 - Copy the Ruby-Battery folder to ~/.config/cairo-dock/extras/gauges/
  • 2 - Open the config panel of the applet and change the gauge theme by "Ruby-Battery"
(this is what you can see it the 'cairo-dock-plug-ins-extras' branch)
I committed a new version
Where ?

In order to push it to LP which one of the commands I do:
1) bzr push lp:~eduardo-mucelli/cairo-dock-plug-ins-extras/demos/demo_ruby or
2) bzr push lp:~eduardo-mucelli/cairo-dock-plug-ins-extras/demo_ruby

  • ~eduardo-mucelli is your pseudo on launchpad
  • cairo-dock-plug-ins-extras is the linked branch
  • demo_ruby is the name of the branch (what you want -> only one word


@ ppmt: should be ok now (sorry, I was hurry)

ppmt, Friday 26 March 2010 à 15:27


Subscription date : 29 November 2007
Messages : 3520
matttbe: ok I will try later tonight

Eduardo Mucelli, Friday 26 March 2010 à 16:12


Subscription date : 05 August 2009
Messages : 285
@matttbe: I forgot to propose the branch merge. Did it now. Thanks.

matttbe, Friday 26 March 2010 à 17:02


Subscription date : 24 January 2009
Messages : 12573
Thank you but if I change gauge theme from config panel, I can see that there is a reload but it still uses the Battery theme.

Eduardo Mucelli, Friday 26 March 2010 à 18:51


Subscription date : 05 August 2009
Messages : 285
@matttbe: Got it. In this first moment I do not know how to solve this because I do not know how to write to the .conf file. I thought the config panel could edit the value of any parameter from the .conf file. You see the "reload" effect and then I reload the parameters from the .conf file. Anyway, since this parameters were not edited in the .conf file, they are reloaded the same way.

I would like to hear from Fabounet how to deal with the changing of a .conf parameter value through the interface, e.g., config panel. Is there any parameter coming from "on_reload_module" that is not the usual "has config changed" ?

Thanks.

matttbe, Friday 26 March 2010 à 21:11


Subscription date : 24 January 2009
Messages : 12573
It's easy, you have the 'on_reload_module' signal :
Signal received when the module is reloaded.
We receive : a boolean that is true if the config has changed and false if it was just a reload because of a resize.


So about the '.conf' file :
  • The script:
    • Read it
    • Received a signal when it has changed
    • Can change it (but not advised)
  • The config panel:
    • Modify it
    • Sent a signal when there is a modification

Applets | Applets

Subjects Author Language Messages Last message
[Locked] Ruby applet, RubyBattery
Page : 1 2
Eduardo Mucelli English 29 fabounet [Read]
11 April 2010 à 20:45


Glx-Dock / Cairo-Dock List of forums Applets | Applets Ruby applet, RubyBattery Top

Online users :

Powered by ElementSpeak © 2007 Adrien Pilleboue, 2009-2013 Matthieu Baerts.
Dock based on CSS Dock Menu (Ndesign) with jQuery. Icons by zgegball
Cairo-Dock is a free software under GNU-GPL3 licence. First stable version created by Fabounet.
Many thanks to TuxFamily for the web Hosting and Mav for the domain name.