Lemonbar node.js bindings
This is a library around Lemonboy's Bar, which lets you easily make use of the great formatting functionalities of the Lemonbar, together with node.js which is ideal for event-based processing.
Launching Lemonbar
var lb = ;lb
Writing to the Lemonbar
lb.append(<text>)
Append text to the buffer for the current line.
lb.write([text])
Send the current line plus text (if given) to Lemonbar, and thus updates the current view.
Example
var lb = ; lb; lblb
Formatting
Formatting is handled via the String prototype. You have the following helper functions:
"text".lbSwap
Swap the current background and foreground colors.
"text".lbLeft
, lb.left
Aligns the following text to the left side of the screen.
"text".lbCenter
, lb.center
Aligns the following text to the center of the screen.
"text".lbRight
, lb.right
Aligns the following text to the right side of the screen.
"text".lbUnderline
Draw a line under the text.
"text".lbOverline
Draw a line over the text.
"text".lbBg(<color>)
Set the text background color. The parameter color has to be a color in one of the formats lemonbar accepts (#rgb
, #rrggbb
, #aarrggbb
).
"text".lbFg(<color>)
Set the text foreground color. The parameter color has to be a color in one of the formats lemonbar accepts (#rgb
, #rrggbb
, #aarrggbb
).
"text".lbFont(<font>)
Set the font used to draw the following text. The parameter font has to be the exact name (with all XCB parameters) of the font as given in the fonts
lemonbar parameter.
"text".lbLinecolor(<color>)
Set the text underline color. The parameter color has to be a color in one of the formats lemonbar accepts (#rgb
, #rrggbb
, #aarrggbb
).
"text".lbAction(<command>, [button])
Create a clickable area, when the area is clicked command is sent to shell.
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.
You may want to use the more descriptive values lb.BUTTON_{LEFT|RIGHT|MIDDLE|SCROLLUP|SCROLLDOWN}
.
Nested clickable areas can trigger different commands:
"shutdown".lbAction("poweroff").lbAction("reboot", lb.BUTTON_RIGHT)
"text".lbMonitor(<monitor>)
, lb.monitor
Change the monitor the bar is rendered to. monitor can be either:
next
,previous
: Next/previous monitor.first
,last
: First/last monitor.0-9
: Nth monitor.