dotfiles/.config/awesome/signals/disk.lua

26 lines
531 B
Lua
Raw Normal View History

2024-02-19 19:41:33 -08:00
local awful = require("awful")
local gears = require("gears")
local config = require("config")
local which_disk = config.widget.disk.name
local function get_disk()
local script = [[
2024-02-19 19:41:33 -08:00
df -kH -B 1MB ]] .. which_disk .. [[ | tail -1 | awk '{printf $5}'
]]
awful.spawn.easy_async_with_shell(script, function(disk_perc)
disk_perc = disk_perc:match("%d+")
awesome.emit_signal("signal::disk", disk_perc)
end)
end
2024-02-19 19:41:33 -08:00
gears.timer({
timeout = 2000,
call_now = true,
autostart = true,
callback = function()
get_disk()
2024-02-19 19:41:33 -08:00
end,
})