| 1 | ; The island machinery, adopted from Murzchnvok/polybar-collection. |
| 2 | ; |
| 3 | ; [bar/main] is one full-width, fully transparent window. An island is just a |
| 4 | ; run of modules that paint their own background, opened and closed by these |
| 5 | ; two text modules: a half circle drawn in the island colour at font-1 |
| 6 | ; (%{T2}). The result is a rounded block only as wide as what is inside it -- |
| 7 | ; no bar widths to measure and no second bar window to keep in sync. |
| 8 | ; |
| 9 | ; The corner radius is font-1's *size*, and the trick is that the glyph is far |
| 10 | ; taller than the bar: at 30pt it is 48px tall, the bar keeps the middle 32px, |
| 11 | ; and a shallow 6px corner is all that shows. Bigger size, flatter corner -- |
| 12 | ; the inset at the bar's top and bottom edge works out to about |
| 13 | ; |
| 14 | ; 0.636 * em * (1 - sqrt(1 - (16 / (0.6065 * em))^2)) em = size * 4/3 |
| 15 | ; |
| 16 | ; The %{O-8} is what keeps the cap from being fat: the glyph's advance is |
| 17 | ; 0.6em (24px at 30pt), far more than the corner needs, so the cursor is |
| 18 | ; pulled back 8px to leave a 16px cap. Which side of the glyph the pullback |
| 19 | ; goes on matters. cap-left trims after, because its ink runs to the right |
| 20 | ; into the next module's background, which is painted afterwards and covers |
| 21 | ; it. cap-right trims before, because its ink runs left over the *previous* |
| 22 | ; module -- so keep that pullback under that module's format-padding (10px) |
| 23 | ; or the cap will paint over the last of its text. |
| 24 | ; |
| 25 | ; The contract for anything that goes in an island: set a background and some |
| 26 | ; padding on every format the module can show, e.g. |
| 27 | ; |
| 28 | ; format-background = ${colors.background} |
| 29 | ; format-padding = 1 |
| 30 | ; |
| 31 | ; A format without a background leaves a see-through hole in the island. Note |
| 32 | ; that it is format-<name>-background for modules with named formats |
| 33 | ; (mounted, volume, connected, ...) -- there is no fallback to a bare |
| 34 | ; format-background. |
| 35 | |
| 36 | [module/cap-left] |
| 37 | type = custom/text |
| 38 | label = %{T2}%{T-}%{O-8} |
| 39 | label-foreground = ${colors.background} |
| 40 | |
| 41 | [module/cap-right] |
| 42 | type = custom/text |
| 43 | label = %{O-8}%{T2}%{T-} |
| 44 | label-foreground = ${colors.background} |
| 45 | |
| 46 | ; A transparent spacer, for a real gap between two islands on the same side. |
| 47 | ; One font-1 space, so it is a cap's worth of nothing: 24px. |
| 48 | [module/gap] |
| 49 | type = custom/text |
| 50 | label = %{T2} %{T-} |
| 51 | label-foreground = ${colors.transparent} |
| 52 | |
| 53 | ; vim:ft=dosini |