-
Notifications
You must be signed in to change notification settings - Fork 7
Customizing
The background of the bar is configured using the bar_background
config key. Its value is a markup element. See the markup reference for more details.
<Rect
Width="{bar_width}"
Height="{bar_height}"
Color="{bg_color}"
/>
<Pattern Height="{bar_height}" Width="{bar_width}">
<Image
Path="background.png"
Height="{bar_height}"
Width="5"
/>
</Pattern>
Modules in a <ModuleRow>
are wrapped by the markup defined in the module
config key. The module is injected into the element with ref="Content"
(see examples). See the markup reference for more details.
The variables made available by <Row>
are available inside module
and represent the index of the module in the bar part (left, center, right). Here we use it to hide the separator before the first module. Since we also use a <Row>
that would override these variables, we alias it to keep its value using ctx:mfirst="{is_first_visible}"
.
<Row ctx:mfirst="{is_first_visible}">
<Sizer
Visible="{!mfirst}"
PaddingLeft="10"
PaddingRight="10"
>
<Rect
Width="5"
Height="5"
Color="{neutral_color}"
/>
</Sizer>
<Sizer ref="Content" />
</Row>
Here we use a <Rect>
to give each module a background. Since this reduces the available space for the modules, we update bar_height
with ctx:bar_height="{bar_height - 4}"
so that modules that might use this variable still fit in the background.
<Sizer PaddingLeft="{is_first_visible ? 0 : h_padding}">
<Rect Color="#111111">
<Sizer
ref="Content"
ctx:bar_height="{bar_height - 4}"
Height="{bar_height - 2}"
PaddingTop="2"
PaddingRight="{h_padding}"
PaddingBottom="2"
PaddingLeft="{h_padding}"
/>
</Rect>
</Sizer>