dotfiles

custom dotfiles
git clone git://git.pyratebeard.net/dotfiles.git
Log | Files | Refs | README

commit f6cb1f0fca05b69925b7b369bbac5967c153eb1c
parent 7595ec2d0c9636a288820927b285c90fcc270d45
Author: pyratebeard <root@pyratebeard.net>
Date:   Mon,  9 Oct 2017 15:57:29 +0100

function for determining eth or wifi network then displaying netwidget with correct interface

Diffstat:
Mawesome/.config/awesome/rc.lua | 21++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/awesome/.config/awesome/rc.lua b/awesome/.config/awesome/rc.lua @@ -125,8 +125,27 @@ memwidget = wibox.widget.textbox() vicious.register(memwidget, vicious.widgets.mem, "M:$1%", 10) -- Network +eths = { 'eno1', 'wlp2s0' } netwidget = wibox.widget.textbox() -vicious.register(netwidget, vicious.widgets.net, "U:${enp8s0 up_kb} D:${enp8s0 down_kb}", 3) +vicious.register(netwidget, vicious.widgets.net, + function(widget,args) + t='' + for i = 1, #eths do + e = eths[i] + if args["{"..e.." carrier}"] == 1 then + if e == 'wlp2s0' then + t=t..'|'..'wifi: u '..args['{'..e..' up_kb}']..' d '..args['{'..e..' down_kb}'] + else + t=t..'|'..'eth: u '..args['{'..e..' up_kb}']..' d '..args['{'..e..' down_kb}'] + end + end + end + if string.len(t)>0 then -- remove leading | + return string.sub(t,2,-1) + end + return 'no network' + end + , 1 ) -- Battery batwidget = wibox.widget.textbox()