From 712d11568afe8b9da82920f9e8b08f12c4029736 Mon Sep 17 00:00:00 2001 From: streetturtle Date: Sun, 2 Jun 2019 22:05:37 -0400 Subject: externalize config for cpu widget --- cpu-widget/README.md | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) (limited to 'cpu-widget/README.md') diff --git a/cpu-widget/README.md b/cpu-widget/README.md index 500e1b9..31fb0d6 100644 --- a/cpu-widget/README.md +++ b/cpu-widget/README.md @@ -2,9 +2,7 @@ This widget shows the average CPU load among all cores of the machine: -![screenshot](out.gif) - -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. +![screenshot](cpu.gif) ## How it works @@ -18,6 +16,32 @@ cpu 197294 718 50102 2002182 3844 0 2724 0 0 0 and calculates the percentage. +## Customization + +It is possible to customize widget by providing a table with all or some of the following config parameters: + +| Name | Default | Description | +|---|---|---| +| `width` | 50 | Width of the widget | +| `step_width` | 2 | Width of the step | +| `step_spacing` | 1 | Space size between steps | +| `color` | `beautiful.fg_normal` | Color of the graph | + +### Example + +```lua +cpu_widget({ + width = 70, + step_width = 2, + step_spacing = 0, + color = '#434c5e' +}) +``` + +The config above results in the following widget: + +![custom](./custom.png) + ## Installation Clone/download repo and use widget in **rc.lua**: @@ -29,6 +53,14 @@ s.mytasklist, -- Middle widget { -- Right widgets layout = wibox.layout.fixed.horizontal, ... - cpu_widget, + -- default + cpu_widget(), + -- or custom + cpu_widget({ + width = 70, + step_width = 2, + step_spacing = 0, + color = '#434c5e' + }) ... ``` -- cgit v1.2.3