Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net widget units issue #514

Open
t0m5k1 opened this issue Sep 2, 2021 · 2 comments
Open

net widget units issue #514

t0m5k1 opened this issue Sep 2, 2021 · 2 comments

Comments

@t0m5k1
Copy link

t0m5k1 commented Sep 2, 2021

Hi,

I've tried to read the wiki but I can't fathom why when U try to include a setting for units on the net widget it has no effect and doesn't produce an error.

❯ awesome -v
awesome v4.3 (Too long)
 • Compiled against Lua 5.3.5 (running with Lua 5.3)
 • D-Bus support: ✔
 • execinfo support: ✔
 • xcb-randr version: 1.6
 • LGI version: 0.9.2
❯ lua -v
Lua 5.4.3  Copyright (C) 1994-2021 Lua.org, PUC-Rio

My expected behaviour is that when I add units = 1024^2 the metrics displayed in the widget will change from a 4-5 digit number (8546.3) to a 1 or 2 digit number (5.6)

This is the widget I'm using:

-- Net
local neticon = wibox.widget.imagebox(theme.widget_net)
local net = lain.widget.net({
	
	settings = function()
	units = 1024^2
		widget:set_markup(markup.font(theme.font,
				markup("#7AC82E", " " .. net_now.received)
					.. " " ..
				markup("#46A8C3", " " .. net_now.sent .. " ")))
	end
})

The units setting is being ignored as I still see a 4 digit number for received and sent, now considering my connection is 69 mb/ps I'd expect to see maybe 6.9 or lower if it was displaying megabytes.

I hope someone can help as I'm finding this quite confusing as I'm not a programmer and have no full grasp of lua.

Cheers

@t0m5k1
Copy link
Author

t0m5k1 commented Sep 2, 2021

Resolved it by moving the units line:

-- Net
local neticon = wibox.widget.imagebox(theme.widget_net)
local net = lain.widget.net({
        units = 1024^2  --<<It needs to be placed here
	settings = function()
		widget:set_markup(markup.font(theme.font,
				markup("#7AC82E", " " .. net_now.received)
					.. " " ..
				markup("#46A8C3", " " .. net_now.sent .. " ")))
	end
})

It really would be great if the wiki went into more detail about placement of these things.
Cheers

@lcpz
Copy link
Owner

lcpz commented Sep 2, 2021

The wiki specifies that the input argument of the widget is a table, in which units and settings are two separate entities. Here, it also refers to awesome-copycats for examples. I thought these were enough details.

But I am obviously open to suggestions. Feel free to propose me modifications to the wiki.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants