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

22 lines
485 B
Lua

local awful = require('awful')
local gears = require('gears')
local function emit_disk_status()
awful.spawn.easy_async_with_shell(
"bash -c \"df --output=pcent / | sed '1d;s/^ //;s/%//'\""
,
function(stdout)
stdout = stdout:gsub("%s+", "")
stdout = tonumber(stdout)
awesome.emit_signal('signal::disk', stdout)
end)
end
gears.timer {
timeout = 600,
call_now = true,
autostart = true,
callback = function()
emit_disk_status()
end
}