diff --git a/drawing/Common.lua b/drawing/Common.lua index bf83691..5d67802 100644 --- a/drawing/Common.lua +++ b/drawing/Common.lua @@ -192,7 +192,7 @@ end -- TODO this is pretty confusing, nil means -1 which gets fed to any text -- formatting functions -M.percent_plot_set = function(pp, cr, value) +M.percent_plot_set = function(pp, value) local t = -1 local p = 0 if value ~= nil then @@ -278,7 +278,7 @@ M.annotated_scale_plot_draw_dynamic = function(asp, cr) ScaledTimeseries.draw_dynamic(asp.plot, cr) end -M.annotated_scale_plot_set = function(asp, cr, value) +M.annotated_scale_plot_set = function(asp, value) Text.set(asp.value, value) ScaledTimeseries.update(asp.plot, value) end @@ -322,7 +322,7 @@ M.build_rate_timeseries = function(x, y, w, h, format_fun, label_fun, spacing, } end -M.update_rate_timeseries = function(obj, cr, value) +M.update_rate_timeseries = function(obj, value) local rate = obj.derive(obj.prev_value, value) Text.set(obj.value, rate) ScaledTimeseries.update(obj.plot, rate) @@ -381,7 +381,7 @@ M.text_ring_draw_dynamic = function(tr, cr) ThresholdText.draw(tr.value, cr) end -M.text_ring_set = function(tr, cr, value) +M.text_ring_set = function(tr, value) ThresholdText.set(tr.value, value) end @@ -407,9 +407,9 @@ M.dial = function(x, y, radius, thickness, threshold, format) } end -M.dial_set = function(dl, cr, value) +M.dial_set = function(dl, value) Dial.set(dl.dial, value) - M.text_ring_set(dl.text_ring, cr, value) + M.text_ring_set(dl.text_ring, value) end M.dial_draw_static = function(dl, cr) @@ -510,7 +510,7 @@ M.text_row_draw_dynamic = function(row, cr) Text.draw(row.value, cr) end -M.text_row_set = function(row, cr, value) +M.text_row_set = function(row, value) Text.set(row.value, value) end @@ -541,7 +541,7 @@ M.text_row_crit_draw_dynamic = function(row, cr) ThresholdText.draw(row.value, cr) end -M.text_row_crit_set = function(row, cr, value) +M.text_row_crit_set = function(row, value) ThresholdText.set(row.value, value) end @@ -612,7 +612,7 @@ M.text_rows_draw_dynamic = function(rows, cr) TextColumn.draw(rows.values, cr) end -M.text_rows_set = function(rows, cr, i, value) +M.text_rows_set = function(rows, i, value) TextColumn.set(rows.values, i, value) end diff --git a/drawing/FileSystem.lua b/drawing/FileSystem.lua index 7e95ce6..7262035 100644 --- a/drawing/FileSystem.lua +++ b/drawing/FileSystem.lua @@ -63,9 +63,9 @@ return function() ----------------------------------------------------------------------------- -- main functions - local update = function(cr) + local update = function() local smart_pid = Util.execute_cmd('pidof smartd', nil, '*n') - Common.text_row_set(smart, cr, (smart_pid == '') and 'Error' or 'Running') + Common.text_row_set(smart, (smart_pid == '') and 'Error' or 'Running') for i = 1, FS_NUM do local percent = Util.conky_numeric(CONKY_USED_PERC[i]) @@ -81,7 +81,7 @@ return function() end local draw_dynamic = function(cr, trigger) - if trigger == 0 then update(cr) end + if trigger == 0 then update() end Common.text_row_draw_dynamic(smart, cr) Common.compound_bar_draw_dynamic(fs, cr) end diff --git a/drawing/Graphics.lua b/drawing/Graphics.lua index 87e497d..e75d98c 100644 --- a/drawing/Graphics.lua +++ b/drawing/Graphics.lua @@ -149,39 +149,39 @@ return function(update_freq) local GPU_BUS_CTRL = '/sys/bus/pci/devices/0000:01:00.0/power/control' - local nvidia_off = function(cr) - Common.text_row_crit_set(internal_temp, cr, -1) - Common.text_rows_set(clock_speed, cr, 1, NA) - Common.text_rows_set(clock_speed, cr, 2, NA) - Common.percent_plot_set(gpu_util, cr, nil) - Common.percent_plot_set(vid_util, cr, nil) - Common.percent_plot_set(mem_util, cr, nil) + local nvidia_off = function() + Common.text_row_crit_set(internal_temp, -1) + Common.text_rows_set(clock_speed, 1, NA) + Common.text_rows_set(clock_speed, 2, NA) + Common.percent_plot_set(gpu_util, nil) + Common.percent_plot_set(vid_util, nil) + Common.percent_plot_set(mem_util, nil) end - local update = function(cr) + local update = function() if Util.read_file(GPU_BUS_CTRL, nil, '*l') == 'on' then local nvidia_settings_glob = Util.execute_cmd(NV_QUERY) if nvidia_settings_glob == '' then - Text.set(status.value, cr, 'Error') - nvidia_off(cr) + Text.set(status.value, 'Error') + nvidia_off() else - Common.text_row_set(status, cr, 'On') + Common.text_row_set(status, 'On') local used_memory, total_memory, temp_reading, gpu_frequency, memory_frequency, gpu_utilization, vid_utilization = __string_match(nvidia_settings_glob, NV_REGEX) - Common.text_row_crit_set(internal_temp, cr, temp_reading) - Common.text_rows_set(clock_speed, cr, 1, gpu_frequency..' Mhz') - Common.text_rows_set(clock_speed, cr, 2, memory_frequency..' Mhz') + Common.text_row_crit_set(internal_temp, temp_reading) + Common.text_rows_set(clock_speed, 1, gpu_frequency..' Mhz') + Common.text_rows_set(clock_speed, 2, memory_frequency..' Mhz') - Common.percent_plot_set(gpu_util, cr, gpu_utilization) - Common.percent_plot_set(mem_util, cr, used_memory / total_memory * 100) - Common.percent_plot_set(vid_util, cr, vid_utilization) + Common.percent_plot_set(gpu_util, gpu_utilization) + Common.percent_plot_set(mem_util, used_memory / total_memory * 100) + Common.percent_plot_set(vid_util, vid_utilization) end else - Text.set(status.value, cr, 'Off') - nvidia_off(cr) + Text.set(status.value, 'Off') + nvidia_off() end end @@ -206,7 +206,7 @@ return function(update_freq) end local draw_dynamic = function(cr) - update(cr) + update() Common.text_row_draw_dynamic(status, cr) Common.text_row_crit_draw_dynamic(internal_temp, cr) diff --git a/drawing/Memory.lua b/drawing/Memory.lua index 66a81bb..a0f649b 100644 --- a/drawing/Memory.lua +++ b/drawing/Memory.lua @@ -134,7 +134,7 @@ return function(update_freq) ----------------------------------------------------------------------------- -- main functions - local update = function(cr) + local update = function() local conky = Util.conky -- see manpage for free command for formulas @@ -153,13 +153,13 @@ return function(update_freq) buffers - sreclaimable) / memtotal - Common.dial_set(mem, cr, used_percent) - Common.dial_set(swap, cr, (swaptotal - swapfree) / swaptotal) + Common.dial_set(mem, used_percent) + Common.dial_set(swap, (swaptotal - swapfree) / swaptotal) - Common.text_rows_set(cache, cr, 1, cached / memtotal * 100) - Common.text_rows_set(cache, cr, 2, buffers / memtotal * 100) - Common.text_rows_set(cache, cr, 3, shmem / memtotal * 100) - Common.text_rows_set(cache, cr, 4, sreclaimable / memtotal * 100) + Common.text_rows_set(cache, 1, cached / memtotal * 100) + Common.text_rows_set(cache, 2, buffers / memtotal * 100) + Common.text_rows_set(cache, 3, shmem / memtotal * 100) + Common.text_rows_set(cache, 4, sreclaimable / memtotal * 100) Timeseries.update(plot, used_percent) @@ -183,7 +183,7 @@ return function(update_freq) end local draw_dynamic = function(cr) - update(cr) + update() Common.dial_draw_dynamic(mem, cr) Common.dial_draw_dynamic(swap, cr) diff --git a/drawing/Network.lua b/drawing/Network.lua index 7f9804c..966fba5 100644 --- a/drawing/Network.lua +++ b/drawing/Network.lua @@ -88,10 +88,10 @@ return function(update_freq) ----------------------------------------------------------------------------- -- main drawing functions - local update = function(cr) + local update = function() local rx_bits, tx_bits = read_interfaces() - Common.update_rate_timeseries(rx, cr, rx_bits) - Common.update_rate_timeseries(tx, cr, tx_bits) + Common.update_rate_timeseries(rx, rx_bits) + Common.update_rate_timeseries(tx, tx_bits) end local draw_static = function(cr) @@ -101,7 +101,7 @@ return function(update_freq) end local draw_dynamic = function(cr) - update(cr) + update() Common.annotated_scale_plot_draw_dynamic(rx, cr) Common.annotated_scale_plot_draw_dynamic(tx, cr) end diff --git a/drawing/Pacman.lua b/drawing/Pacman.lua index 433656d..86dd4e4 100644 --- a/drawing/Pacman.lua +++ b/drawing/Pacman.lua @@ -22,17 +22,17 @@ return function() {'Total', 'Explicit', 'Outdated', 'Orphaned', 'Local'} ) - local update = function(cr, pacman_stats) + local update = function(pacman_stats) local stats = __string_match(pacman_stats, '%d+%s+[^%s]+%s+[^%s]+%s+(.*)$') if stats then local i = 1 for v in __string_gmatch(stats, '%d+') do - Common.text_rows_set(rows, cr, i, v) + Common.text_rows_set(rows, i, v) i = i + 1 end else for i=1, 5 do - Common.text_rows_set(rows, cr, i, 'N/A') + Common.text_rows_set(rows, i, 'N/A') end end end @@ -43,7 +43,7 @@ return function() end local draw_dynamic = function(cr, pacman_stats) - update(cr, pacman_stats) + update(pacman_stats) Common.text_rows_draw_dynamic(rows, cr) end diff --git a/drawing/Power.lua b/drawing/Power.lua index 88c37b5..361885b 100644 --- a/drawing/Power.lua +++ b/drawing/Power.lua @@ -114,10 +114,10 @@ return function(update_freq) ----------------------------------------------------------------------------- -- main functions - local update = function(cr, is_using_ac) - Common.update_rate_timeseries(pkg0, cr, read_pkg0_joules()) - Common.update_rate_timeseries(dram, cr, read_dram_joules()) - Common.annotated_scale_plot_set(bat, cr, read_battery_power(is_using_ac)) + local update = function(is_using_ac) + Common.update_rate_timeseries(pkg0, read_pkg0_joules()) + Common.update_rate_timeseries(dram, read_dram_joules()) + Common.annotated_scale_plot_set(bat, read_battery_power(is_using_ac)) end local draw_static = function(cr) @@ -128,7 +128,7 @@ return function(update_freq) end local draw_dynamic = function(cr, is_using_ac) - update(cr, is_using_ac) + update(is_using_ac) Common.annotated_scale_plot_draw_dynamic(pkg0, cr) Common.annotated_scale_plot_draw_dynamic(dram, cr) Common.annotated_scale_plot_draw_dynamic(bat, cr) diff --git a/drawing/Processor.lua b/drawing/Processor.lua index dbae682..d3023fd 100644 --- a/drawing/Processor.lua +++ b/drawing/Processor.lua @@ -134,7 +134,7 @@ return function(update_freq) ----------------------------------------------------------------------------- -- main functions - local update = function(cr, trigger) + local update = function(trigger) local conky = Util.conky local load_sum = 0 @@ -147,18 +147,18 @@ return function(update_freq) for conky_core_id, path in pairs(coretemp_paths) do local temp = __math_floor(0.001 * Util.read_file(path, nil, '*n')) - Common.text_ring_set(cores[conky_core_id].coretemp, cr, temp) + Common.text_ring_set(cores[conky_core_id].coretemp, temp) end -- For some reason this call is slow (querying anything with pstate in -- general seems slow), but I also don't need to see an update every cycle, -- hence the trigger if trigger == 0 then - Common.text_rows_set(cpu_status, cr, 1, CPU.read_hwp(hwp_paths)) + Common.text_rows_set(cpu_status, 1, CPU.read_hwp(hwp_paths)) end - Common.text_rows_set(cpu_status, cr, 2, CPU.read_freq()) + Common.text_rows_set(cpu_status, 2, CPU.read_freq()) - Common.percent_plot_set(total_load, cr, load_sum / ncpus * 100) + Common.percent_plot_set(total_load, load_sum / ncpus * 100) for r = 1, NUM_ROWS do local pid = conky(TABLE_CONKY[r].pid, '(%d+)') -- may have leading spaces @@ -187,7 +187,7 @@ return function(update_freq) end local draw_dynamic = function(cr, trigger) - update(cr, trigger) + update(trigger) for i = 1, #cores do CompoundDial.draw_dynamic(cores[i].loads, cr) diff --git a/drawing/ReadWrite.lua b/drawing/ReadWrite.lua index 0f2b4f5..ef6071c 100644 --- a/drawing/ReadWrite.lua +++ b/drawing/ReadWrite.lua @@ -85,10 +85,10 @@ return function(update_freq) ----------------------------------------------------------------------------- -- main drawing functions - local update = function(cr) + local update = function() local read_bytes, write_bytes = read_devices() - Common.update_rate_timeseries(reads, cr, read_bytes) - Common.update_rate_timeseries(writes, cr, write_bytes) + Common.update_rate_timeseries(reads, read_bytes) + Common.update_rate_timeseries(writes, write_bytes) end local draw_static = function(cr) @@ -98,7 +98,7 @@ return function(update_freq) end local draw_dynamic = function(cr) - update(cr) + update() Common.annotated_scale_plot_draw_dynamic(reads, cr) Common.annotated_scale_plot_draw_dynamic(writes, cr) end diff --git a/drawing/System.lua b/drawing/System.lua index 1342665..d1138f1 100644 --- a/drawing/System.lua +++ b/drawing/System.lua @@ -33,10 +33,10 @@ return function() last_update, last_sync = __string_match(pacman_stats, "^%d+%s+([^%s]+)%s+([^%s]+).*") end -- TODO this doesn't need to be update every time - Common.text_rows_set(rows, cr, 1, Util.conky('$kernel')) - Common.text_rows_set(rows, cr, 2, Util.conky('$uptime')) - Common.text_rows_set(rows, cr, 3, last_update) - Common.text_rows_set(rows, cr, 4, last_sync) + Common.text_rows_set(rows, 1, Util.conky('$kernel')) + Common.text_rows_set(rows, 2, Util.conky('$uptime')) + Common.text_rows_set(rows, 3, last_update) + Common.text_rows_set(rows, 4, last_sync) Common.text_rows_draw_dynamic(rows, cr) end