luastatus-barlib-i3(7)
π Name π
Okay bestie, this is luastatus-barlib-i3(7) from the Miscellaneous Information Manual, and it's the i3 barlib for luastatus. Periodt. β¨
πΈ Overview πΈ
This barlib talks with i3bar. No cap.
To use this barlib, you need to specify luastatus-i3-wrapper with appropriate arguments as the status_command parameter of a bar in the i3 configuration file. For example:
bar {
status_command cd ~/.config/luastatus && exec luastatus-i3-wrapper -B no_separators time-battery-combined.lua alsa.lua xkb.lua
π Redirections and luastatus-i3-wrapper π
i3bar requires all the data to be written to stdout and read from stdin.
This makes it very easy to mess things up: Lua's print() prints to stdout, processes spawned by widgets/plugins inherit our stdin and stdout, etc. π
That's why this barlib requires that stdin and stdout file descriptors are manually redirected.
A shell wrapper, luastatus-i3-wrapper, is shipped with it; it does all the redirections and executes luastatus with -b i3, all the required -B options, and additional arguments passed by you. π«Ά
π¦ cb return value π¦
Either of:
- an empty table or
nilβ hide the widget. π - a table with strings keys β is interpreted as a single segment (or a "block"). The keys should not include
name, as it is set automatically to be able to tell which widget was clicked. For more information, seehttp://i3wm.org/docs/i3bar-protocol.html#_blocks_in_detail. π₯ - an array (table with numeric keys) β is interpreted as an array of segments. To be able to tell which one was clicked, set the
instancefield of a segment.nilelements are ignored. π
β event argument β
A table with all click properties i3bar provides.
For more information, see http://i3wm.org/docs/i3bar-protocol.html#_click_events.
π§ Functions π§
The following functions are provided:
escaped_str = luastatus.barlib.pango_escape(str)β escapes text for the Pango markup.
π Example π
An example that uses all possible features:
function get_user_name()
local f = io.popen('whoami', 'r')
local r = f:read('*line')
f:close()
return r
end
i = 0
widget = {
plugin = 'timer',
opts = {period = 2},
cb = function(t)
i = i + 1
if i == 1 then
return {} -- hides widget; alternatively, you can return nil.
elseif i == 2 then
-- no markup unless you specify markup='pango'
return {full_text = '<Hello!>', color = '#aaaa00'}
elseif i == 3 then
-- see https://developer.gnome.org/pygtk/stable/pango-markup-language.html
return {full_text = 'Hello, <span color="#aaaa00">'
.. luastatus.barlib.pango_escape(get_user_name())
.. '</span>!',
markup = 'pango'}
elseif i == 4 then
i = 0
return {
{full_text = 'Now,', instance = 'now-segment'},
nil, -- nils are ignored so that you can do
-- return {get_time(), get_battery(), get_smth_else()}
-- where, for example, get_battery() returns nil if the battery is full.
{full_text = 'click me!', instance = 'click-me-segment'},
}
end
end,
event = function(t)
local r = {'properties:'}
for k, v in pairs(t) do
table.insert(r, k .. '=' .. tostring(v))
end
assert(os.execute(string.format(
"notify-send 'Click event' '%s'", table.concat(r, ' '))))
end,
}
β¨ Options β¨
The following options are supported:
in_fd=<fd>β file descriptor to read i3bar input from. Usually set by the wrapper.out_fd=<fd>β file descriptor to write to. Usually set by the wrapper.no_click_eventsβ tell i3bar we don't want to receive click events. This changes i3bar behaviour in that it will interpret "clicks" on segments as if an empty space on the bar was clicked, particularly, will switch workspaces if you scroll on a segment.no_separatorsβ append"separator": falseto a segment, unless it has aseparatorkey. Also appends it to an (Error) segment.allow_stoppingβ allow i3bar to send luastatusSIGSTOPwhen it thinks it becomes invisible, andSIGCONTwhen it thinks it becomes visible. Quite a questionable feature. π
π Copyright π
LGPLv3
Footer check, bestie: source/version is luastatus-barlib-i3(7), and no date is printed on the page β the footer is just that manual name. That's the whole page. Mwah πβ¨
π¦ where this page comes from
- nixos 26.05: luastatus 0.6.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms