X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/f7aa28919588d307083b4b5b1c010f26cbc63cde..44facf162420816bdcfc851d4ff5e033996fa948:/widgets/net.lua?ds=sidebyside diff --git a/widgets/net.lua b/widgets/net.lua index d79e117..7851d5a 100644 --- a/widgets/net.lua +++ b/widgets/net.lua @@ -29,13 +29,13 @@ local net = { function net.get_device() f = io.popen("ip link show | cut -d' ' -f2,9") - ws = f:read("*all") + ws = f:read("*a") f:close() ws = ws:match("%w+: UP") if ws ~= nil then return ws:gsub(": UP", "") else - return "" + return "network off" end end @@ -44,6 +44,7 @@ local function worker(args) local timeout = args.timeout or 2 local iface = args.iface or net.get_device() local units = args.units or 1024 --kb + local notify = args.notify or "on" local settings = args.settings or function() end net.widget = wibox.widget.textbox('') @@ -76,19 +77,18 @@ local function worker(args) net.last_t = now_t net.last_r = now_r - if net_now.carrier ~= "1" + if net_now.carrier ~= "1" and notify == "on" then if helpers.get_map(iface) then - n_title = iface - if n_title == "" then n_title = "network" end naughty.notify({ - title = n_title, + title = iface, text = "no carrier", timeout = 7, position = "top_left", icon = helpers.icons_dir .. "no_net.png", - fg = notify_fg or "#FFFFFF" + fg = notify_fg or "#FFFFFF", + screen = client.focus and client.focus.screen or 1 }) helpers.set_map(iface, false) end