mirror of
https://github.com/elenapan/dotfiles.git
synced 2026-01-15 02:58:00 +08:00
evil daemon system, dependency list update, README improvements.
Former-commit-id: db310f8e49
Former-commit-id: 4f25f9200c3ac9f9385daca5a68378249ff0329e
Former-commit-id: 69fa3954e5738446a59b409b7e326233e7c3ef55
Former-commit-id: 673176f7857e39f3455f4ccb426eef2789c0e891
20 lines
615 B
Lua
20 lines
615 B
Lua
-- Provides:
|
|
-- evil::ram
|
|
-- used (integer - mega bytes)
|
|
-- total (integer - mega bytes)
|
|
local awful = require("awful")
|
|
|
|
local update_interval = 20
|
|
-- Returns the used amount of ram in percentage
|
|
local ram_script = [[
|
|
sh -c "
|
|
free -m | grep 'Mem:' | awk '{printf \"%d@@%d@\", $7, $2}'
|
|
"]]
|
|
|
|
-- Periodically get ram info
|
|
awful.widget.watch(ram_script, update_interval, function(widget, stdout)
|
|
local available = stdout:match('(.*)@@')
|
|
local total = stdout:match('@@(.*)@')
|
|
local used = tonumber(total) - tonumber(available)
|
|
awesome.emit_signal("evil::ram", used, tonumber(total))
|
|
end)
|