Project

General

Profile

unexist.dev

Assorted tidbits and projects

Panel » History » Version 18

Anonymous, 01/02/2011 05:06 PM

1 18
h1. Panel\015\012\015\012{{>toc}}\015\012\015\012[[subtle]] comes with two panels per screen, one at the top and one at the bottom of the screen. The location of both panels is fix and cannot be changed, the height is determined by the height of the font and can't be changed directly. The default config uses the top panel on the first screen only, it's up to the user to enable the bottom panel or disable either one or both.\015\012\015\012Using [[subtle]]'s panels is no must, foreign panels can also be used as long as they support the *WM_STRUT* or *DOCK* window type properties. If this is not the case, [[subtle]] can be advised to spare some parts of the screen with the *&#58;strut* option in the config.\015\012\015\012h2. Item types\015\012\015\012The panels can contain different items and will be hidden when empty.\015\012\015\012Following items are available:\015\012\015\012| *&#58;views*     | List of views with buttons                        |\015\012| *&#58;title*     | Title of the current active window                |\015\012| *&#58;tray*      | Systray icons (Can be used once)                  |\015\012| *&#58;sublets*   | Catch-all for installed [[sublets]]               |\015\012| *&#58;sublet*    | Name of a [[sublets|sublet]] for direct placement |\015\012| *&#58;spacer*    | Variable spacer (free width / count of spacers)   |\015\012| *&#58;center*    | Enclose items with :center to center them         |\015\012| *&#58;separator* | Insert separator                                  |\015\012| icon             | Insert an icon (see [[Panel#Icons|here]])         |\015\012\015\012All items except the *&#58;tray* item can be used freely in any combination and multiple times on every panel.\015\012\015\012<pre>{{hide}}<code class="ruby">\015\012# Panels\015\012screen 1 do\015\012  top    [ :views, :spacer, :title ]\015\012  bottom [ :views, :spacer, :title ]\015\012end\015\012</code></pre>\015\012\015\012h2. Padding\015\012\015\012Spacings around each panel item can be set _globally_ with the *&#58;padding* option. (in pixel) It consists of four different values: left, right, top, bottom\015\012\015\012Example:\015\012\015\012<pre>{{hide}}<code class="ruby">\015\012set :padding, [ 5, 5, 3, 3 ]\015\012</code></pre>\015\012\015\012h2. Border\015\012\015\012Borders of the panel items can be set _globally_ via the *&#58;outline* option (in pixel) and t color can be set with the various *_border* color options. (_tray and icons have no borders_)\015\012\015\012Example:\015\012\015\012<pre>{{hide}}<code class="ruby">\015\012set :outline, 5\015\012</code></pre>\015\012\015\012h2. Sublets\015\012\015\012[[Sublets]] can either be placed directly by adding the name of the [[sublets|sublet]] as item name (like *&#58;clock*) into one of the panels or by using the catch-all item *&#58;sublets*. The latter will display all unplaced [[sublets]] delimited by a separator. If a [[sublets|sublet]] is placed multiple times on a panel, just the output will be cloned.\015\012\015\012Example:\015\012\015\012<pre>{{hide}}<code class="ruby">\015\012# Sublets: Direct placement\015\012screen 1 do\015\012  top [ :sublets, :clock ]\015\012end\015\012\015\012# Sublets: Catch-all\015\012screen 1 do\015\012  top [ :sublets ]\015\012end\015\012</code></pre>\015\012\015\012h2. Icons\015\012\015\012Since r2457 it's possible to add icons directly to the panel, this makes it possible e.g. to use an icon as spacer.\015\012\015\012Example:\015\012\015\012<pre>{{hide}}<code class="ruby">\015\012icon = Subtlext::Icon.new("/path/to/icon.xbm")\015\012\015\012screen 1 do\015\012  top [ icon, :sublets, icon, :clock ]\015\012end\015\012</code></pre>\015\012\015\012h2. Alignment\015\012\015\012The alignment inside of a panel can be changed with *&#58;spacer* and the *&#58;center*, per default all items are left-aligned.\015\012\015\012h3. Spacer\015\012\015\012Basically, a spacer is just empty space in the panel and it's width is defined by the total free space divided by the amount of total spacers. When using spacers to center something, be aware that this will *most likely never* be the exact center of the panel. This can be done with the *&#58;center* item.\015\012\015\012Example:\015\012\015\012<pre>{{hide}}<code class="ruby">\015\012# Left aligned\015\012screen 1 do\015\012  top [ :views ]\015\012end\015\012\015\012# Right aligned\015\012screen 1 do\015\012  top [ :spacer, :views ]\015\012end\015\012\015\012# Centered\015\012screen 1 do\015\012  top [ :spacer, :views, :spacer ]\015\012end\015\012</code></pre>\015\012\015\012h3. Center\015\012\015\012Items that are +enclosed by two center items+ will be moved into a special group, that is excluded from the overall alignment of the panel and guaranteed to be in the center of the panel. This group won't affect other items in the panel and spacers inside of it will affect the group only.\015\012\015\012Example:\015\012\015\012<pre><code class="ruby">\015\012# Left aligned\015\012screen 1 do\015\012  top [ :views, :center, :title, :center ]\015\012end\015\012\015\012# Right aligned\015\012screen 1 do\015\012  top [ :spacer, :views, :center, :title, :center ]\015\012end\015\012\015\012# Centered\015\012screen 1 do\015\012  top [ :spacer, :views, :spacer, :center, :title, :center ]\015\012end\015\012</code></pre>\015\012\015\012h2. Examples\015\012\015\012<pre>{{hide}}<code class="ruby">screen 1 do\015\012  top    [ :views, :title, :spacer, :tray, :sublets ]\015\012  bottom [ ]\015\012end\015\012\015\012screen 1 do\015\012 top    [ :tray, :title, :spacer, :sublets, :spacer, :views ]\015\012 bottom [ :clock, :spacer, :mpd ]\015\012end\015\012</code></pre>