i managed to fake it by checking if the length is >=4 then changing the font, else make font normal.
-- {{{ internet traffic
up_traffic = wibox.widget {
align = "center",
valign = "center",
widget = wibox.widget.textbox,
}
down_traffic = wibox.widget {
align = "center",
valign = "center",
widget = wibox.widget.textbox,
}
lain.widget.net({
units = 1, -- set the units to bytes, not kilobytes (1024)
settings = function()
up = net_now.sent
up_amount = "b"
if tonumber(up) > 1000000 then
up = up/1000000
up_amount = "m"
elseif tonumber(up) > 1000 then
up = up/1000
up_amount = "k"
else
up_amount = "b"
end
down = net_now.received
down_amount = "b"
if tonumber(down) > 1000000 then
down = down/1000000
down_amount = "m"
elseif tonumber(down) > 1000 then
down = down/1000
down_amount = "k"
else
down_amount = "b"
end
--widget:set_markup("↑" .. net_now.sent.."\n↓" .. net_now.received)
--widget:set_markup(math.floor(up)..up_amount.."\n"..math.floor(down)..down_amount)
--textbox.text = (math.floor(up)..up_amount.."\n"..math.floor(down)..down_amount)
up_traffic.text = math.floor(up)..up_amount
small_font = "Noto Sans Regular 8"
big_font = "Noto Sans Regular 10"
if #up_traffic.text >= 4 then
up_traffic.font = small_font
else
up_traffic.font = big_font
end
down_traffic.text = math.floor(down)..down_amount
if #down_traffic.text >= 4 then
down_traffic.font = small_font
else
down_traffic.font = big_font
end
end
})
net = wibox.widget { -- internet monitor
{
up_traffic,
down_traffic,
forced_height = 35,
layout = wibox.layout.fixed.vertical,
},
direction = "west",
widget = wibox.container.rotate,
}
-- }}}
but it would still be nice to have an actual way (non hack way) to do it