summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Keller <tjkeller.xyz>2024-11-03 15:26:51 -0600
committerTim Keller <tjkeller.xyz>2024-11-03 15:26:51 -0600
commit9a11cd62ac1ca5659a36fb3111d3bf7dead9d85b (patch)
tree635365dcbbf089fa4c9b24d257ebd211b5ccaa57
parentcc68c3adcde665ca63ae0873e4dfca8c94a7c9e0 (diff)
downloadawesome-9a11cd62ac1ca5659a36fb3111d3bf7dead9d85b.tar.xz
awesome-9a11cd62ac1ca5659a36fb3111d3bf7dead9d85b.zip
use gears.table.clone instead of table.move
-rw-r--r--widgets/cpu.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/widgets/cpu.lua b/widgets/cpu.lua
index d92bce8..b539e08 100644
--- a/widgets/cpu.lua
+++ b/widgets/cpu.lua
@@ -1,5 +1,6 @@
local wibox = require("wibox")
local widgets = require("util.widgets")
+local gears = require("gears")
-- this is directly adapted from slstatus's cpu.c module
local cpu_time = { 0,0,0,0,0,0,0 } -- user, nice, system, idle, iowait, irq, softirq
@@ -12,8 +13,8 @@ function linux_cpu_usage(widget)
-- calc
local sum = 0
- local a, b = cpu_time, {} -- set cpu_time as a for smaller code
- table.move(a, 1, 7, 1, b) -- copy first 7 to b
+ local a = cpu_time -- set cpu_time as a for smaller code
+ local b = gears.table.clone(a) -- copy a to b
for i = 1, 7 do
a[i] = stat_iter()