40 lines
995 B
Lua
40 lines
995 B
Lua
local awful = require("awful")
|
|
local gears = require("gears")
|
|
local wibox = require("wibox")
|
|
local beautiful = require("beautiful")
|
|
local dpi = beautiful.xresources.apply_dpi
|
|
|
|
-- Set colors
|
|
local active_color = {
|
|
color = "#F4C8AF"
|
|
}
|
|
|
|
local background_color = "#ffffff"
|
|
|
|
local ram_bar = wibox.widget {
|
|
max_value = 100,
|
|
value = 50,
|
|
forced_height = 30,
|
|
forced_width = 350,
|
|
shape = function(cr,w,h) gears.shape.rounded_rect(cr,w,h, 8) end,
|
|
bar_shape = function(cr,w,h) gears.shape.rounded_rect(cr,w,h, 4) end,
|
|
color = active_color,
|
|
background_color = background_color,
|
|
border_width = 5,
|
|
border_color = "#272727",
|
|
widget = wibox.widget.progressbar
|
|
}
|
|
|
|
local update_interval = 1
|
|
|
|
local ram_script = [[
|
|
sh -c "
|
|
free -m | grep 'Mem:' | awk '{printf \"%d@@%d@\", $7, $2}'
|
|
"]]
|
|
|
|
awesome.connect_signal("signals::ram", function(used, total)
|
|
local used_ram_percentage = (used / total) * 100
|
|
ram_bar.value = used_ram_percentage
|
|
end)
|
|
|
|
return ram_bar |