Project

General

Profile

unexist.dev

Assorted tidbits and projects

Panel » History » Version 21

Christoph Kappel, 01/23/2018 12:22 PM

1 21 Christoph Kappel
h1. Panel
2 21 Christoph Kappel
3 21 Christoph Kappel
{{>toc}}
4 21 Christoph Kappel
5 21 Christoph Kappel
[[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 the [[styles]]. 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.
6 21 Christoph Kappel
7 21 Christoph Kappel
Using [[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 padding [[styles|style]] property.
8 21 Christoph Kappel
9 21 Christoph Kappel
[[Styles]] allow to define different borders, spacings and colors for every item type.
10 21 Christoph Kappel
11 21 Christoph Kappel
h2. Item types
12 21 Christoph Kappel
13 21 Christoph Kappel
The panels can contain different items and will be hidden when empty.
14 21 Christoph Kappel
15 21 Christoph Kappel
Following items are available:
16 21 Christoph Kappel
17 21 Christoph Kappel
|_. Items          |_. Description                                     |
18 21 Christoph Kappel
| *:views*     | List of views with buttons                        |
19 21 Christoph Kappel
| *:title*     | Title of the current active window                |
20 21 Christoph Kappel
| *:tray*      | Systray icons (Can be used only once)             |
21 21 Christoph Kappel
| *:keychain*  | Display current chain (Can be used only once)     |
22 21 Christoph Kappel
| *:sublets*   | Catch-all for installed [[sublets]]               |
23 21 Christoph Kappel
| *:sublet*    | Name of a [[sublets|sublet]] for direct placement |
24 21 Christoph Kappel
| *:spacer*    | Variable spacer (free width / count of spacers)   |
25 21 Christoph Kappel
| *:center*    | Enclose items with :center to center them         |
26 21 Christoph Kappel
| *:separator* | Insert separator                                  |
27 21 Christoph Kappel
| icon             | Insert an icon (see [[Panel#Icons|here]])         |
28 21 Christoph Kappel
29 21 Christoph Kappel
All items except the *:tray* and *:keychain* items can be used freely in any combination and multiple times on every panel.
30 21 Christoph Kappel
31 21 Christoph Kappel
<pre><code class="ruby">
32 21 Christoph Kappel
# Panels
33 21 Christoph Kappel
screen 1 do
34 21 Christoph Kappel
  top    [ :views, :spacer, :title ]
35 21 Christoph Kappel
  bottom [ :views, :spacer, :title ]
36 21 Christoph Kappel
end
37 21 Christoph Kappel
</code></pre>
38 21 Christoph Kappel
39 21 Christoph Kappel
h2. Sublets
40 21 Christoph Kappel
41 21 Christoph Kappel
[[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.
42 21 Christoph Kappel
43 21 Christoph Kappel
Example:
44 21 Christoph Kappel
45 21 Christoph Kappel
<pre><code class="ruby">
46 21 Christoph Kappel
# Sublets: Direct placement
47 21 Christoph Kappel
screen 1 do
48 21 Christoph Kappel
  top [ :sublets, :clock ]
49 21 Christoph Kappel
end
50 21 Christoph Kappel
51 21 Christoph Kappel
# Sublets: Catch-all
52 21 Christoph Kappel
screen 1 do
53 21 Christoph Kappel
  top [ :sublets ]
54 21 Christoph Kappel
end
55 21 Christoph Kappel
</code></pre>
56 21 Christoph Kappel
57 21 Christoph Kappel
h2. Icons
58 21 Christoph Kappel
59 21 Christoph Kappel
Since r2457 it's possible to add icons directly to the panel, this makes it possible e.g. to use an icon as spacer.
60 21 Christoph Kappel
61 21 Christoph Kappel
Example:
62 21 Christoph Kappel
63 21 Christoph Kappel
<pre><code class="ruby">
64 21 Christoph Kappel
icon = Subtlext::Icon.new("/path/to/icon.xbm")
65 21 Christoph Kappel
66 21 Christoph Kappel
screen 1 do
67 21 Christoph Kappel
  top [ icon, :sublets, icon, :clock ]
68 21 Christoph Kappel
end
69 21 Christoph Kappel
</code></pre>
70 21 Christoph Kappel
71 21 Christoph Kappel
h2. Alignment
72 21 Christoph Kappel
73 21 Christoph Kappel
The alignment inside of a panel can be changed with *&#58;spacer* and the *&#58;center*, per default all items are left-aligned.
74 21 Christoph Kappel
75 21 Christoph Kappel
h3. Spacer
76 21 Christoph Kappel
77 21 Christoph Kappel
Basically, 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.
78 21 Christoph Kappel
79 21 Christoph Kappel
Example:
80 21 Christoph Kappel
81 21 Christoph Kappel
<pre><code class="ruby">
82 21 Christoph Kappel
# Left aligned
83 21 Christoph Kappel
screen 1 do
84 21 Christoph Kappel
  top [ :views ]
85 21 Christoph Kappel
end
86 21 Christoph Kappel
87 21 Christoph Kappel
# Right aligned
88 21 Christoph Kappel
screen 1 do
89 21 Christoph Kappel
  top [ :spacer, :views ]
90 21 Christoph Kappel
end
91 21 Christoph Kappel
92 21 Christoph Kappel
# Centered
93 21 Christoph Kappel
screen 1 do
94 21 Christoph Kappel
  top [ :spacer, :views, :spacer ]
95 21 Christoph Kappel
end
96 21 Christoph Kappel
</code></pre>
97 21 Christoph Kappel
98 21 Christoph Kappel
h3. Center
99 21 Christoph Kappel
100 21 Christoph Kappel
Items 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.
101 21 Christoph Kappel
102 21 Christoph Kappel
Example:
103 21 Christoph Kappel
104 21 Christoph Kappel
<pre><code class="ruby">
105 21 Christoph Kappel
# Left aligned
106 21 Christoph Kappel
screen 1 do
107 21 Christoph Kappel
  top [ :views, :center, :title, :center ]
108 21 Christoph Kappel
end
109 21 Christoph Kappel
110 21 Christoph Kappel
# Right aligned
111 21 Christoph Kappel
screen 1 do
112 21 Christoph Kappel
  top [ :spacer, :views, :center, :title, :center ]
113 21 Christoph Kappel
end
114 21 Christoph Kappel
115 21 Christoph Kappel
# Centered
116 21 Christoph Kappel
screen 1 do
117 21 Christoph Kappel
  top [ :spacer, :views, :spacer, :center, :title, :center ]
118 21 Christoph Kappel
end
119 21 Christoph Kappel
</code></pre>
120 21 Christoph Kappel
121 21 Christoph Kappel
h2. Examples
122 21 Christoph Kappel
123 21 Christoph Kappel
<pre><code class="ruby">screen 1 do
124 21 Christoph Kappel
  top    [ :views, :title, :spacer, :tray, :sublets ]
125 21 Christoph Kappel
  bottom [ ]
126 21 Christoph Kappel
end
127 21 Christoph Kappel
128 21 Christoph Kappel
screen 1 do
129 21 Christoph Kappel
 top    [ :tray, :title, :spacer, :sublets, :spacer, :views ]
130 21 Christoph Kappel
 bottom [ :clock, :spacer, :mpd ]
131 21 Christoph Kappel
end
132 21 Christoph Kappel
</code></pre>