Lemonbar Formatting
Created on 2020-11-19T19:33:52-06:00
This card was copied from the original URL.
Formatting
lemonbar provides a screenrc-inspired formatting syntax to allow full customization at runtime. Every formatting block is opened with %{ and closed by } and accepts the following commands, the parser tries its best to handle malformed input. Use %% to get a literal percent sign (%).
- R: Swap the current background and foreground colors.
- l: Aligns the following text to the left side of the screen.
- c: Aligns the following text to the center of the screen.
- r: Aligns the following text to the right side of the screen.
- Owidth: Offset the current position by width pixels in the alignment direction.
- Bcolor: Set the text background color. The parameter color can be - or a color in one of the formats mentioned before. The special value - resets the color to the default one.
- FColor: Set the text foreground color. The parameter color can be - or a color in one of the formats mentioned before. The special value - resets the color to the default one.
- Tindex: Set the font used to draw the following text. The parameter index can either be - or the 1-based index of the slot which contains the desired font. If the parameter is - lemonbar resets to the normal behavior (matching the first font that can be used for the character). If the selected font can't be used to draw a character, lemonbar will fall back to normal behavior for that character
- Ucolor: Set the text underline color. The parameter color can be - or a color in one of the formats mentioned before. The special value - resets the color to the default one.
- Sdir: Change the monitor the bar is rendered to. dir can be either
- +/-: Next/previous monitor.
- f/l: First/last monitor.
- 0-9: Nth monitor.
- nNAME: Named monitor. Eg. %{SnHDMI-0} This text will show up on the HDMI-0 output
Attribute modifiers
- +attribute: Set the attribute attribute for the following text.
- -attribute: Unset the attribute attribute for the following text.
- !attribute: Toggle the attribute attribute for the following text.
Where attribute is one of the following
- o: Draw a line over the text.
- u: Draw a line under the text.
Clickable buttons
- Abutton:command:
Create a clickable area starting from the current position, when the area is clicked command is printed on stdout. The area is closed when a A token, not followed by : is encountered.
Eg. %{A:reboot:} Click here to reboot %{A}
The button field is optional, it defaults to the left button, and it's a number ranging from 1 to 5 which maps to the left, middle, right, scroll up and scroll down movements. Your mileage may vary.
Nested clickable areas can trigger different commands.
Eg. %{A:reboot:}%{A3:halt:} Left click to reboot, right click to shutdown %{A}%{A}