Project

General

Profile

unexist.dev

Assorted tidbits and projects

Sublets » History » Version 63

Version 62 (Tobias Bruenner, 01/14/2011 04:20 PM) → Version 63/66 (Anonymous, 02/04/2011 11:56 PM)

h1. Sublets\015\012\015\012{{>toc}}\015\012\015\012[[Sublets]] are small "Ruby":http://www.ruby-lang.org scripts written in a small "DSL":http://en.wikipedia.org/wiki/Domain_Specific_Language that can provide things like system information for the [[panel]]. They are well included in the main loop of [[subtle]] and can be used in various ways. Further information about writing a sublet can be found [[Writing_sublets|here]].\015\012\015\012h2. Installation\015\012\015\012h3. Easy\015\012\015\012The easiest way to install a [[sublets|sublet]] is to let [[sur]] do all the dirty work, it's designed to be really easy and works in a "rubygems":http://www.rubygems.org like fashion and since r2138 bundled with [[subtle]].\015\012\015\012Generally [[sur]] is the *subtle user repository* for user contributed [[sublets]], everyone can submit [[sublets]] via [[sur]].\015\012\015\012<pre>\015\012sur install clock\015\012sur uninstall clock\015\012sur notes clock\015\012sur config clock\015\012</pre>\015\012\015\012h3. Hard\015\012\015\012Ok, you asked for it: Point your browser to http://sur.subforge.org/ and download a [[sublets|sublet]]. Then you need to unpack the [[sublets|sublet]] - they are just tarballs. Once unpacked you will probably find three types of files:\015\012\015\012# A [[sublets|sublet]] file (*.rb*) [@$XDG_DATA_HOME/subtle/sublets@]\015\012# A [[specification]] file (*.spec*) [@$XDG_DATA_HOME/subtle/specifications@]\015\012# Zero or more icons (*.xbm*) [@$XDG_DATA_HOME/subtle/icons@]\015\012\015\012The files need to be installed in the appropriate folders in @$XDG_DATA_HOME/subtle@ and after a reload of either the config or the [[sublets]] you are done.\015\012\015\012h2. Configuration\015\012\015\012Since r2222 there are three [[sublets|sublet]] properties than can be changed from the *config* config of [[subtle]] without ever touching it:\015\012\015\012# *interval* Update interval of the [[sublets|sublet]]\015\012# *foreground* Default foreground color\015\012# *background* Default background color\015\012\015\012_The color settings will override the default colors specified in the config._\015\012\015\012Generally [[sublets]] can provide further properties, but it's up to the author to use this and to add either *notes* or *config* information about it.\015\012\015\012Example:\015\012\015\012<pre>{{hide}}<code class="ruby">sublet :clock do\015\012 interval 50\015\012 foreground "#eeeeee"\015\012 background "#000000"\015\012 format_string "%H:%M"\015\012end</code></pre>\015\012\015\012h2. Grabs\015\012\015\012[[Sublets]] can also provide [[grabs]] (since r2608), that are just added to the supported types and can be used like all other from the [[config]]. Like *notes* and *config* it's up to the author to supply information, [[sur]] shows of list of [[grabs]] with following command: @sur grabs subletname@\015\012\015\012Example:\015\012\015\012<pre>{{hide}}<code class="ruby">grab "A-b", :SubletTest</code></pre>\015\012 "%H:%M"\015\012end</code></pre>\015\012