From 1983667ca66d0dfb7e01bf4de87ae96b8db49a35 Mon Sep 17 00:00:00 2001 From: zachir Date: Fri, 10 Feb 2023 13:23:54 -0600 Subject: add font option to net-speed --- net-speed-widget/net-speed.lua | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/net-speed-widget/net-speed.lua b/net-speed-widget/net-speed.lua index 6dd3b05..248e913 100644 --- a/net-speed-widget/net-speed.lua +++ b/net-speed-widget/net-speed.lua @@ -23,19 +23,19 @@ local function convert_to_h(bytes) local bits = bytes * 8 if bits < 1000 then speed = bits - dim = 'b/s' + dim = 'b' elseif bits < 1000000 then speed = bits/1000 - dim = 'kb/s' + dim = 'k' elseif bits < 1000000000 then speed = bits/1000000 - dim = 'mb/s' + dim = 'm' elseif bits < 1000000000000 then speed = bits/1000000000 - dim = 'gb/s' + dim = 'g' else speed = tonumber(bits) - dim = 'b/s' + dim = 'b' end return math.floor(speed + 0.5) .. dim end @@ -55,17 +55,21 @@ local function worker(user_args) local args = user_args or {} + local font = args.font or 'mononoki Nerd Font Mono 1' + local interface = args.interface or '*' local timeout = args.timeout or 1 - local width = args.width or 55 + local width = args.width or 40 net_speed_widget = wibox.widget { { id = 'rx_speed', forced_width = width, align = 'right', + font = font, widget = wibox.widget.textbox }, + ---[[ { image = ICONS_DIR .. 'down.svg', widget = wibox.widget.imagebox @@ -74,10 +78,12 @@ local function worker(user_args) image = ICONS_DIR .. 'up.svg', widget = wibox.widget.imagebox }, + --]] { id = 'tx_speed', forced_width = width, align = 'left', + font = font, widget = wibox.widget.textbox }, layout = wibox.layout.fixed.horizontal, -- cgit v1.2.3