24 lines
580 B
Lua
24 lines
580 B
Lua
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
|
|
}
|