Sublets » History » Version 2
« Previous -
Version 2/66
(diff) -
Next » -
Current version
Anonymous, 10/28/2008 09:54 PM
Sublets\015\012\015\012sublets are small Ruby scripts that provide the data for the statusbar. They are run in an embedded Ruby interpreter and are well included in the main loop of subtle. Every sublet must either provide an update interval (in seconds) and will be updated accordingly or a file to watch. The default update interval is 60s.\015\012\015\012h2. Types\015\012\015\012Currently there are two types of sublets:\015\012* sublets that are updated in a given interval\015\012* sublets that are updated when a file is modified (Via inotify. Data\015\012\015\012The sublet data can be either of type String or Fixnum. Strings are directly displayed Fixnums will be shown as a small meter.\015\012\015\012\015\012h2. Example\015\012\015\012Below is the code of a shipped sublet that displays the time. It should be really straight forward\015\012\015\012\015\012class Clock < Sublet\015\012 def initialize\015\012 self.interval = 60\015\012 end\015\012\015\012 def run\015\012 self.data = Time.now().strftime("%d%m%y%H%M")\015\012 end\015\012end\015\012
\015\012\015\012More soon..¶
class Clock < Sublet\015\012 def initialize\015\012 self.interval = 60\015\012 end\015\012\015\012 def run\015\012 self.data = Time.now().strftime("%d%m%y%H%M")\015\012 end\015\012end\015\012