Fuxx
This commit is contained in:
parent
8268fba83d
commit
7ed2a6e110
9565 changed files with 1315332 additions and 90 deletions
48
home/.config/awesome/widgets/memory.lua
Normal file
48
home/.config/awesome/widgets/memory.lua
Normal file
|
@ -0,0 +1,48 @@
|
|||
-- ## Memory ##
|
||||
-- ~~~~~~~~~
|
||||
|
||||
-- requirements
|
||||
-- ~~~~~~~~~~~~
|
||||
local wibox = require('wibox')
|
||||
local beautiful = require('beautiful')
|
||||
local watch = require('awful.widget.watch')
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
|
||||
|
||||
local memory = wibox.widget.textbox()
|
||||
memory.font = theme.font
|
||||
|
||||
--function round(exact, quantum)
|
||||
-- local quant,frac = math.modf(exact/quantum)
|
||||
-- return quantum * (quant + (frac > 0.5 and 1 or 0))
|
||||
--end
|
||||
|
||||
--watch('bash -c "free | grep -z Mem.*Swap.*"', 2, function(_, stdout)
|
||||
-- local total, used, free, shared, buff_cache, available, total_swap, used_swap, free_swap =
|
||||
-- stdout:match('(%d+)%s*(%d+)%s*(%d+)%s*(%d+)%s*(%d+)%s*(%d+)%s*Swap:%s*(%d+)%s*(%d+)%s*(%d+)')
|
||||
--
|
||||
-- memory.text = round((used / 1048576), 0.01) .. ' GB'
|
||||
-- collectgarbage('collect')
|
||||
--end)
|
||||
|
||||
watch([[bash -c "free -h | awk '/^Mem/ { print $3 }' | sed s/i//g"]], 2, function(_, stdout)
|
||||
memory.text = stdout
|
||||
end)
|
||||
|
||||
|
||||
--return memory
|
||||
memory_icon = wibox.widget {
|
||||
markup = '<span font="' .. theme.icon_font .. '"foreground="'.. colors.brightblue ..'"> </span>',
|
||||
widget = wibox.widget.textbox,
|
||||
}
|
||||
|
||||
return wibox.widget {
|
||||
memory_icon,
|
||||
wibox.widget{
|
||||
memory,
|
||||
fg = colors.brightwhite,
|
||||
widget = wibox.container.background
|
||||
},
|
||||
spacing = dpi(2),
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue