diff options
author | zachir <zachir@librem.one> | 2023-02-10 13:23:54 -0600 |
---|---|---|
committer | zachir <zachir@librem.one> | 2023-02-10 13:23:54 -0600 |
commit | 1983667ca66d0dfb7e01bf4de87ae96b8db49a35 (patch) | |
tree | ffae6e08bcff2df0c8d527530c1b5f4cb0af451b /net-speed-widget | |
parent | ef70d16c43c2f566a4fe2955b8d6c08f6c185af8 (diff) |
add font option to net-speed
Diffstat (limited to 'net-speed-widget')
-rw-r--r-- | net-speed-widget/net-speed.lua | 18 |
1 files 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, |