awesome-wm-widgets/cpu-widget
Klimov Nikolay 8c3f67920b Calling bash in watch command 2018-09-20 19:20:27 +03:00
..
README.md Update README.md 2017-09-28 09:39:16 -04:00
cpu-widget.lua Calling bash in watch command 2018-09-20 19:20:27 +03:00
out.gif cpu screenshot 2017-09-27 19:47:04 -04:00

README.md

CPU widget

This widget shows the average CPU load among all cores of the machine:

screenshot

When the load is more than 80% the graph becomes red. You can easily customize the widget by changing colors, step width, step spacing, width and interval.

How it works

To measure the load I took Paul Colby's bash script and rewrote it in Lua, which was quite simple. So awesome simply reads the first line of /proc/stat:

$ cat /proc/stat | grep '^cpu '
cpu  197294 718 50102 2002182 3844 0 2724 0 0 0

and calculates the percentage.

Installation

Clone/download repo and use widget in rc.lua:

require("awesome-wm-widgets.cpu-widget.cpu-widget")
...
s.mytasklist, -- Middle widget
	{ -- Right widgets
    	layout = wibox.layout.fixed.horizontal,
		...
		cpu_widget,
		...