From: copycat-killer Date: Tue, 13 Sep 2016 14:29:17 +0000 (+0200) Subject: net: specify ip path; #102 X-Git-Url: https://git.madduck.net/etc/awesome.git/commitdiff_plain/7e6f1336f26e8c36a1768ae1f7f076a30030a8a8 net: specify ip path; #102 --- diff --git a/helpers.lua b/helpers.lua index 309162e..b681cb0 100644 --- a/helpers.lua +++ b/helpers.lua @@ -8,6 +8,7 @@ local debug = require("debug") +local assert = assert local capi = { timer = (type(timer) == 'table' and timer or require ("gears.timer")) } local io = { open = io.open, lines = io.lines, @@ -61,9 +62,9 @@ end function helpers.lines_match(regexp, file) local lines = {} for index,line in pairs(helpers.lines_from(file)) do - if string.match(line, regexp) then + if string.match(line, regexp) then lines[index] = line - end + end end return lines end diff --git a/widgets/net.lua b/widgets/net.lua index 1883168..4dbacf5 100644 --- a/widgets/net.lua +++ b/widgets/net.lua @@ -24,7 +24,7 @@ local function worker(args) local net = { last_t = 0, last_r = 0, devices = {} } function net.get_first_device() - local ws = helpers.read_pipe("ip link show | cut -d' ' -f2,9") + local ws = helpers.read_pipe("/usr/sbin/ip link show | cut -d' ' -f2,9") ws = ws:match("%w+: UP") or ws:match("ppp%w+: UNKNOWN") if ws then return { ws:match("(%w+):") } else return {} end