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: failing iface autodetection #102

Closed
vojinc opened this issue Mar 14, 2015 · 13 comments
Closed

net widget: failing iface autodetection #102

vojinc opened this issue Mar 14, 2015 · 13 comments

Comments

@vojinc
Copy link

vojinc commented Mar 14, 2015

Hello everyone.I have a problem with lain widget net.lua.I use a powerarrow-darker in my Slackware linux on laptop.Everything work without a problem,my wifi eth work but widget for download and uploud don't work.When i start my OS first on screen show icon no_net.png.Please help me.Thank you for a cooperation.

@lcpz
Copy link
Owner

lcpz commented Mar 15, 2015

If you are sure you have an active network device, then the widget is faliing to autodetect it.

But you can set it manually.

Execute the following command:

ip link show

the device which state is UP is the one you have to manually set as iface in the net widget, like this:

-- Net
neticon = wibox.widget.imagebox(beautiful.widget_net)
neticon:buttons(awful.util.table.join(awful.button({ }, 1, function () awful.util.spawn_with_shell(iptraf) end)))
netwidget = lain.widgets.net({
    iface = "your UP device", -- set it here
    settings = function()
        widget:set_markup(markup("#7AC82E", " " .. net_now.received)
                          .. " " ..
                          markup("#46A8C3", " " .. net_now.sent .. " "))
    end
})

@lcpz lcpz changed the title net widget net widget: failing iface autodetection Mar 15, 2015
@vojinc
Copy link
Author

vojinc commented Mar 15, 2015

Thank you very much ,it`s work.Great

@lcpz lcpz closed this as completed Mar 15, 2015
@Incognito4nonymous
Copy link

Incognito4nonymous commented Sep 12, 2016

Hello ! It is I again, I'll just drop this here, to make it work, simply change that line:

local ws = helpers.read_pipe("ip link show | cut -d' ' -f2,9")

Into

local ws = helpers.read_pipe("/usr/sbin/ip link show | cut -d' ' -f2,9")

Well if it doesn't for you, I guess you can simply fall back into the manual method.
Cheers !

@lcpz
Copy link
Owner

lcpz commented Sep 12, 2016

Just /usr/bin is working too?

@Incognito4nonymous
Copy link

Incognito4nonymous commented Sep 12, 2016

Negative, I bet it is because it is intended to be ran with elevated privileges, which is why it is in the /usr/sbin folder.
Still under Slackware by the way 😄
However, to simplify your code, it works with just /sbin
With the hope that my contribution was useful.

@lcpz
Copy link
Owner

lcpz commented Sep 13, 2016

Maybe you are not a sudoer?

@Incognito4nonymous
Copy link

I don't use sudo at all, I'm using "su-c" when I need elevated privileges, old school mode.

@lcpz
Copy link
Owner

lcpz commented Sep 13, 2016

That's the explanation then.

I've never met a su purist before, probably because sudo is a safe alternative since 1986.

I'll switch to /usr/sbin.

lcpz pushed a commit that referenced this issue Sep 13, 2016
@paescuj
Copy link

paescuj commented Sep 13, 2016

Now, it doesn't work anymore under Gentoo, because the binary is located at /bin/ip. I think we need another solution here, since there seems to be a inconsistency with the location between linux distributions.

@Incognito4nonymous
Copy link

Well, I think most Slackware users are Su purists since sudo is a pain in the ass to configure properly on that distribution.

And about the location varying, it is indeed a problem, perhaps a script to detect the location of the executable should be created with wereis or something like that, after all the iface detection in the net widget is pretty much using the same technique.
I also had the same problem with the Bat widget and with the Temp one, the input file location is varying...
Or to keep it simple and stupid, just a Wiki entry to explain how to modify the files in order to make them work. 😉

@lcpz
Copy link
Owner

lcpz commented Sep 13, 2016

The autodetection function is just a simple plus and I don't want to bloat it.

I revert to previous status.

@Incognito4nonymous
Copy link

Okay, at least that page will help anyone having this problem.

@paescuj
Copy link

paescuj commented Sep 14, 2016

The autodetection function is just a simple plus and I don't want to bloat it.

I quite agree.

I revert to previous status.

Thanks!

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

4 participants