-- disk I/O using iostat from sysstat utilities
local iotable = {}
local iostat = awful.widget.watch("iostat -dk", 2, -- in Kb, use -dm for Mb
function(widget, stdout)
for line in stdout:match("(sd.*)\n"):gmatch("(.-)\n") do
local device, tps, read_s, wrtn_s, read, wrtn =
line:match("(%w+)%s*(%d+,?%d*)%s*(%d+,?%d*)%s*(%d+,?%d*)%s*(%d+,?%d*)%s*(%d+,?%d*)")
-- [1] [2] [3] [4] [5]
iotable[device] = { tps, read_s, wrtn_s, read, wrtn }
end
-- customize here
widget:set_text("sda: "..iotable["sda"][2].."/"..iotable["sda"][3]) -- read_s/wrtn_s
end
)
Created
January 18, 2021 08:05
-
-
Save imabuddha/1bdd1b0950860646fc914bd4e1d8fb70 to your computer and use it in GitHub Desktop.
awful.widget.watch use case examples from: https://awesomewm.org/recipes/watch/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment