nixos-config/modules/home-manager/ricing/awesomewm/dotfiles/signal/connection/wifi.lua
2024-07-12 18:19:30 +09:00

24 lines
569 B
Lua

local awful = require('awful')
local gears = require('gears')
-- Network Fetching and Signal Emitting
---------------------------------------
local function emit_network_status()
awful.spawn.easy_async_with_shell(
"bash -c 'nmcli networking connectivity check'", function(stdout)
local status = not stdout:match("none") -- boolean
awesome.emit_signal('signal::network', status)
end)
end
-- Refreshing
-------------
gears.timer {
timeout = 2,
call_now = true,
autostart = true,
callback = function()
emit_network_status()
end
}