|
|
|
@ -225,6 +225,65 @@ local function set_wallpaper(s)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local iostat_tooltiptext = ""
|
|
|
|
|
-- Widget de monitoring de l'activité des disques https://awesomewm.org/recipes/watch/
|
|
|
|
|
-- disk I/O using iostat from sysstat utilities
|
|
|
|
|
local iotable = {}
|
|
|
|
|
local iostat = awful.widget.watch("iostat -dm -y -z 1 1", 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
|
|
|
|
|
|
|
|
|
|
local label = ""
|
|
|
|
|
for device,values in spairs(iotable) do
|
|
|
|
|
label = label..(device..": "..iotable[device][2].." MB_read/s |"..iotable[device][3].." MB_wrtn/s").."\n"
|
|
|
|
|
end
|
|
|
|
|
iostat_tooltiptext = label
|
|
|
|
|
|
|
|
|
|
-- customize here
|
|
|
|
|
--widget:set_text("sda: "..iotable["sda"][2].."/"..iotable["sda"][3]) -- read_s/wrtn_s
|
|
|
|
|
widget:set_text("iostat")
|
|
|
|
|
|
|
|
|
|
widget_t = awful.tooltip({
|
|
|
|
|
--objects = { },
|
|
|
|
|
timer_function = function()
|
|
|
|
|
return iostat_tooltiptext
|
|
|
|
|
end,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
widget_t:add_to_object(widget)
|
|
|
|
|
end
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
-- tris d'un tableau par la clef https://stackoverflow.com/questions/15706270/sort-a-table-in-lua
|
|
|
|
|
function spairs(t, order)
|
|
|
|
|
-- collect the keys
|
|
|
|
|
local keys = {}
|
|
|
|
|
for k in pairs(t) do keys[#keys+1] = k end
|
|
|
|
|
|
|
|
|
|
-- if order function given, sort by it by passing the table and keys a, b,
|
|
|
|
|
-- otherwise just sort the keys
|
|
|
|
|
if order then
|
|
|
|
|
table.sort(keys, function(a,b) return order(t, a, b) end)
|
|
|
|
|
else
|
|
|
|
|
table.sort(keys)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- return the iterator function
|
|
|
|
|
local i = 0
|
|
|
|
|
return function()
|
|
|
|
|
i = i + 1
|
|
|
|
|
if keys[i] then
|
|
|
|
|
return keys[i], t[keys[i]]
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
|
|
|
|
|
screen.connect_signal("property::geometry", set_wallpaper)
|
|
|
|
|
|
|
|
|
@ -268,6 +327,9 @@ awful.screen.connect_for_each_screen(
|
|
|
|
|
s.mytasklist, -- Middle widget
|
|
|
|
|
{ -- Right widgets
|
|
|
|
|
layout = wibox.layout.fixed.horizontal,
|
|
|
|
|
wibox.widget.textbox(' | '),
|
|
|
|
|
iostat,
|
|
|
|
|
wibox.widget.textbox(' | '),
|
|
|
|
|
mykeyboardlayout,
|
|
|
|
|
wibox.widget.systray(),
|
|
|
|
|
mytextclock,
|
|
|
|
|