blob: f6b67f154023131ec59b05c1c6e8f2cc8e406a8a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
local gtimer = require "gears.timer"
gtimer {
timeout = 1,
call_now = true,
autostart = true,
callback = function()
local lines = {}
for line in io.lines("/proc/net/wireless") do
table.insert(lines, line)
end
if not lines[3] then
awesome.emit_signal("services::wifi", 0, false)
return
end
local strength = lines[3]:match("^%s*(.*)"):match("^.-%s+.-%s+.-(%S+)%.")
awesome.emit_signal("services::wifi", math.floor(tonumber(strength) * 10 / 7), true)
end
}
|