From 5facbc5e2b02c0b46b5a090bb76d382d009bb404 Mon Sep 17 00:00:00 2001 From: pmakhov Date: Wed, 27 Sep 2017 19:45:25 -0400 Subject: cpu widget --- cpu-widget/README.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 cpu-widget/README.md (limited to 'cpu-widget/README.md') diff --git a/cpu-widget/README.md b/cpu-widget/README.md new file mode 100644 index 0000000..77e0f93 --- /dev/null +++ b/cpu-widget/README.md @@ -0,0 +1,34 @@ +# CPU widget + +This widget shows the average CPU load among all cores of the machine: + +![screenshot](out.git) + +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](http://colby.id.au/calculating-cpu-usage-from-proc-stat/)and rewrote it in Lua, which was quite simple. +So awesome simply reads the first line of /proc/stat: + +```bash +$ 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**: + +```lua +require("awesome-wm-widgets.cpu-widget.cpu-widget") +... +s.mytasklist, -- Middle widget + { -- Right widgets + layout = wibox.layout.fixed.horizontal, + ... + cpu_widget, + ... +``` \ No newline at end of file -- cgit v1.2.3