REF use separate file to define geometry
This commit is contained in:
parent
c94a618062
commit
ca136ad551
|
@ -1,3 +1,5 @@
|
||||||
|
local update_interval = 1 -- in seconds
|
||||||
|
|
||||||
conky.config = {
|
conky.config = {
|
||||||
background = false,
|
background = false,
|
||||||
|
|
||||||
|
@ -28,7 +30,8 @@ conky.config = {
|
||||||
|
|
||||||
--Lua Load
|
--Lua Load
|
||||||
lua_load = '~/.config/conky/main.lua',
|
lua_load = '~/.config/conky/main.lua',
|
||||||
lua_draw_hook_post = 'main'
|
lua_draw_hook_post = 'main',
|
||||||
|
lua_startup_hook = string.format('start %f', update_interval)
|
||||||
}
|
}
|
||||||
|
|
||||||
--control updates entirely in lua
|
--control updates entirely in lua
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
local Util = require 'Util'
|
local Util = require 'Util'
|
||||||
|
local Theme = require 'Patterns'
|
||||||
|
local Startup = require 'Widget'
|
||||||
local Arc = require 'Arc'
|
local Arc = require 'Arc'
|
||||||
local Text = require 'Text'
|
local Text = require 'Text'
|
||||||
local CompoundBar = require 'CompoundBar'
|
local CompoundBar = require 'CompoundBar'
|
||||||
|
@ -58,15 +60,15 @@ M.normal_font_spec = M.make_font_spec(FONT, NORMAL_FONT_SIZE, false)
|
||||||
M.label_font_spec = M.make_font_spec(FONT, PLOT_LABEL_FONT_SIZE, false)
|
M.label_font_spec = M.make_font_spec(FONT, PLOT_LABEL_FONT_SIZE, false)
|
||||||
|
|
||||||
local _text_row_style = function(x_align, color)
|
local _text_row_style = function(x_align, color)
|
||||||
return _G_Widget_.text_style(M.normal_font_spec, color, x_align, 'center')
|
return Startup.text_style(M.normal_font_spec, color, x_align, 'center')
|
||||||
end
|
end
|
||||||
|
|
||||||
M.left_text_style = _text_row_style('left', _G_Patterns_.INACTIVE_TEXT_FG)
|
M.left_text_style = _text_row_style('left', Theme.INACTIVE_TEXT_FG)
|
||||||
|
|
||||||
M.right_text_style = _text_row_style('right', _G_Patterns_.PRIMARY_FG)
|
M.right_text_style = _text_row_style('right', Theme.PRIMARY_FG)
|
||||||
|
|
||||||
local _bare_text = function(pt, text, style)
|
local _bare_text = function(pt, text, style)
|
||||||
return _G_Widget_.plainText(pt, text, style)
|
return Startup.plainText(pt, text, style)
|
||||||
end
|
end
|
||||||
|
|
||||||
local _left_text = function(pt, text)
|
local _left_text = function(pt, text)
|
||||||
|
@ -84,23 +86,23 @@ M.Header = function(x, y, w, s)
|
||||||
local bottom_y = y + HEADER_HEIGHT
|
local bottom_y = y + HEADER_HEIGHT
|
||||||
local underline_y = y + HEADER_UNDERLINE_OFFSET
|
local underline_y = y + HEADER_UNDERLINE_OFFSET
|
||||||
return {
|
return {
|
||||||
text = _G_Widget_.plainText(
|
text = Startup.plainText(
|
||||||
_G_Widget_.make_point(x, y),
|
Startup.make_point(x, y),
|
||||||
s,
|
s,
|
||||||
_G_Widget_.text_style(
|
Startup.text_style(
|
||||||
M.make_font_spec(FONT, HEADER_FONT_SIZE, true),
|
M.make_font_spec(FONT, HEADER_FONT_SIZE, true),
|
||||||
_G_Patterns_.HEADER_FG,
|
Theme.HEADER_FG,
|
||||||
'left',
|
'left',
|
||||||
'top'
|
'top'
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
bottom_y = bottom_y,
|
bottom_y = bottom_y,
|
||||||
underline = _G_Widget_.Line(
|
underline = Startup.Line(
|
||||||
_G_Widget_.make_point(x, underline_y),
|
Startup.make_point(x, underline_y),
|
||||||
_G_Widget_.make_point(x + w, underline_y),
|
Startup.make_point(x + w, underline_y),
|
||||||
_G_Widget_.line_style(
|
Startup.line_style(
|
||||||
HEADER_UNDERLINE_THICKNESS,
|
HEADER_UNDERLINE_THICKNESS,
|
||||||
_G_Patterns_.HEADER_FG,
|
Theme.HEADER_FG,
|
||||||
HEADER_UNDERLINE_CAP
|
HEADER_UNDERLINE_CAP
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -115,29 +117,29 @@ end
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- label plot
|
-- label plot
|
||||||
|
|
||||||
M.default_grid_style = _G_Widget_.grid_style(
|
M.default_grid_style = Startup.grid_style(
|
||||||
PLOT_GRID_X_N,
|
PLOT_GRID_X_N,
|
||||||
PLOT_GRID_Y_N,
|
PLOT_GRID_Y_N,
|
||||||
_G_Patterns_.BORDER_FG
|
Theme.BORDER_FG
|
||||||
)
|
)
|
||||||
|
|
||||||
M.default_plot_style = _G_Widget_.plot_style(
|
M.default_plot_style = Startup.plot_style(
|
||||||
PLOT_NUM_POINTS,
|
PLOT_NUM_POINTS,
|
||||||
_G_Patterns_.BORDER_FG,
|
Theme.BORDER_FG,
|
||||||
_G_Patterns_.PLOT_FILL_BORDER_PRIMARY,
|
Theme.PLOT_FILL_BORDER_PRIMARY,
|
||||||
_G_Patterns_.PLOT_FILL_BG_PRIMARY,
|
Theme.PLOT_FILL_BG_PRIMARY,
|
||||||
M.default_grid_style
|
M.default_grid_style
|
||||||
)
|
)
|
||||||
|
|
||||||
M.percent_label_style = _G_Widget_.label_style(
|
M.percent_label_style = Startup.label_style(
|
||||||
_G_Patterns_.INACTIVE_TEXT_FG,
|
Theme.INACTIVE_TEXT_FG,
|
||||||
M.label_font_spec,
|
M.label_font_spec,
|
||||||
function(z) return Util.round_to_string(z * 100)..'%' end
|
function(z) return Util.round_to_string(z * 100)..'%' end
|
||||||
)
|
)
|
||||||
|
|
||||||
M.initThemedLabelPlot = function(x, y, w, h, label_style)
|
M.initThemedLabelPlot = function(x, y, w, h, label_style)
|
||||||
return _G_Widget_.LabelPlot(
|
return Startup.LabelPlot(
|
||||||
_G_Widget_.make_box(x, y, w, h),
|
Startup.make_box(x, y, w, h),
|
||||||
1 / _G_INIT_DATA_.UPDATE_INTERVAL,
|
1 / _G_INIT_DATA_.UPDATE_INTERVAL,
|
||||||
M.default_plot_style,
|
M.default_plot_style,
|
||||||
label_style
|
label_style
|
||||||
|
@ -149,13 +151,13 @@ end
|
||||||
|
|
||||||
M.initPercentPlot_formatted = function(x, y, w, h, spacing, label, format)
|
M.initPercentPlot_formatted = function(x, y, w, h, spacing, label, format)
|
||||||
return {
|
return {
|
||||||
label = _left_text(_G_Widget_.make_point(x, y), label),
|
label = _left_text(Startup.make_point(x, y), label),
|
||||||
value = _G_Widget_.formattedThresholdText(
|
value = Startup.formattedThresholdText(
|
||||||
_G_Widget_.make_point(x + w, y),
|
Startup.make_point(x + w, y),
|
||||||
nil,
|
nil,
|
||||||
M.right_text_style,
|
M.right_text_style,
|
||||||
format,
|
format,
|
||||||
_G_Widget_.threshold_text_style(_G_Patterns_.CRITICAL_FG, 80)
|
Startup.threshold_text_style(Theme.CRITICAL_FG, 80)
|
||||||
),
|
),
|
||||||
plot = M.initThemedLabelPlot(
|
plot = M.initThemedLabelPlot(
|
||||||
x,
|
x,
|
||||||
|
@ -198,16 +200,16 @@ end
|
||||||
-- scaled plot
|
-- scaled plot
|
||||||
|
|
||||||
M.base_2_scale_data = function(m)
|
M.base_2_scale_data = function(m)
|
||||||
return _G_Widget_.scale_data(2, m, 0.9)
|
return Startup.scale_data(2, m, 0.9)
|
||||||
end
|
end
|
||||||
|
|
||||||
M.initThemedScalePlot = function(x, y, w, h, f, min_domain)
|
M.initThemedScalePlot = function(x, y, w, h, f, min_domain)
|
||||||
return _G_Widget_.ScalePlot(
|
return Startup.ScalePlot(
|
||||||
_G_Widget_.make_box(x, y, w, h),
|
Startup.make_box(x, y, w, h),
|
||||||
1 / _G_INIT_DATA_.UPDATE_INTERVAL,
|
1 / _G_INIT_DATA_.UPDATE_INTERVAL,
|
||||||
M.default_plot_style,
|
M.default_plot_style,
|
||||||
_G_Widget_.label_style(
|
Startup.label_style(
|
||||||
_G_Patterns_.INACTIVE_TEXT_FG,
|
Theme.INACTIVE_TEXT_FG,
|
||||||
M.label_font_spec,
|
M.label_font_spec,
|
||||||
f
|
f
|
||||||
),
|
),
|
||||||
|
@ -221,9 +223,9 @@ end
|
||||||
M.initLabeledScalePlot = function(x, y, w, h, format_fun, label_fun, spacing,
|
M.initLabeledScalePlot = function(x, y, w, h, format_fun, label_fun, spacing,
|
||||||
label, min_domain)
|
label, min_domain)
|
||||||
return {
|
return {
|
||||||
label = _left_text(_G_Widget_.make_point(x, y), label),
|
label = _left_text(Startup.make_point(x, y), label),
|
||||||
value = _G_Widget_.formatted_text(
|
value = Startup.formatted_text(
|
||||||
_G_Widget_.make_point(x + w, y),
|
Startup.make_point(x + w, y),
|
||||||
0,
|
0,
|
||||||
M.right_text_style,
|
M.right_text_style,
|
||||||
format_fun
|
format_fun
|
||||||
|
@ -253,9 +255,9 @@ end
|
||||||
-- I have multiple layers on top of each other
|
-- I have multiple layers on top of each other
|
||||||
|
|
||||||
M.arc = function(x, y, r, thickness, pattern)
|
M.arc = function(x, y, r, thickness, pattern)
|
||||||
return _G_Widget_.Arc(
|
return Startup.Arc(
|
||||||
_G_Widget_.make_semicircle(x, y, r, 90, 360),
|
Startup.make_semicircle(x, y, r, 90, 360),
|
||||||
_G_Widget_.arc_style(thickness, pattern)
|
Startup.arc_style(thickness, pattern)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -263,9 +265,9 @@ end
|
||||||
-- ring
|
-- ring
|
||||||
|
|
||||||
M.initRing = function(x, y, r)
|
M.initRing = function(x, y, r)
|
||||||
return _G_Widget_.Arc(
|
return Startup.Arc(
|
||||||
_G_Widget_.make_semicircle(x, y, r, 0, 360),
|
Startup.make_semicircle(x, y, r, 0, 360),
|
||||||
_G_Widget_.arc_style(ARC_WIDTH, _G_Patterns_.BORDER_FG)
|
Startup.arc_style(ARC_WIDTH, Theme.BORDER_FG)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -275,17 +277,17 @@ end
|
||||||
M.initTextRing = function(x, y, r, fmt, limit)
|
M.initTextRing = function(x, y, r, fmt, limit)
|
||||||
return {
|
return {
|
||||||
ring = M.initRing(x, y, r),
|
ring = M.initRing(x, y, r),
|
||||||
value = _G_Widget_.formattedThresholdText(
|
value = Startup.formattedThresholdText(
|
||||||
_G_Widget_.make_point(x, y),
|
Startup.make_point(x, y),
|
||||||
nil,
|
nil,
|
||||||
_G_Widget_.text_style(
|
Startup.text_style(
|
||||||
M.normal_font_spec,
|
M.normal_font_spec,
|
||||||
_G_Patterns_.PRIMARY_FG,
|
Theme.PRIMARY_FG,
|
||||||
'center',
|
'center',
|
||||||
'center'
|
'center'
|
||||||
),
|
),
|
||||||
fmt,
|
fmt,
|
||||||
_G_Widget_.threshold_text_style(_G_Patterns_.CRITICAL_FG, limit)
|
Startup.threshold_text_style(Theme.CRITICAL_FG, limit)
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -306,17 +308,17 @@ end
|
||||||
-- dial
|
-- dial
|
||||||
|
|
||||||
local threshold_indicator = function(threshold)
|
local threshold_indicator = function(threshold)
|
||||||
return _G_Widget_.threshold_style(
|
return Startup.threshold_style(
|
||||||
_G_Patterns_.INDICATOR_FG_PRIMARY,
|
Theme.INDICATOR_FG_PRIMARY,
|
||||||
_G_Patterns_.INDICATOR_FG_CRITICAL,
|
Theme.INDICATOR_FG_CRITICAL,
|
||||||
threshold
|
threshold
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
M.dial = function(x, y, radius, thickness, threshold)
|
M.dial = function(x, y, radius, thickness, threshold)
|
||||||
return _G_Widget_.Dial(
|
return Startup.Dial(
|
||||||
_G_Widget_.make_semicircle(x, y, radius, DIAL_THETA0, DIAL_THETA1),
|
Startup.make_semicircle(x, y, radius, DIAL_THETA0, DIAL_THETA1),
|
||||||
_G_Widget_.arc_style(thickness, _G_Patterns_.INDICATOR_BG),
|
Startup.arc_style(thickness, Theme.INDICATOR_BG),
|
||||||
threshold_indicator(threshold)
|
threshold_indicator(threshold)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -326,9 +328,9 @@ end
|
||||||
|
|
||||||
M.compound_dial = function(x, y, outer_radius, inner_radius, thickness,
|
M.compound_dial = function(x, y, outer_radius, inner_radius, thickness,
|
||||||
threshold, num_dials)
|
threshold, num_dials)
|
||||||
return _G_Widget_.CompoundDial(
|
return Startup.CompoundDial(
|
||||||
_G_Widget_.make_semicircle(x, y, outer_radius, DIAL_THETA0, DIAL_THETA1),
|
Startup.make_semicircle(x, y, outer_radius, DIAL_THETA0, DIAL_THETA1),
|
||||||
_G_Widget_.arc_style(thickness, _G_Patterns_.INDICATOR_BG),
|
Startup.arc_style(thickness, Theme.INDICATOR_BG),
|
||||||
threshold_indicator(threshold),
|
threshold_indicator(threshold),
|
||||||
inner_radius,
|
inner_radius,
|
||||||
num_dials
|
num_dials
|
||||||
|
@ -340,19 +342,19 @@ end
|
||||||
|
|
||||||
M.compound_bar = function(x, y, w, pad, labels, spacing, thickness, threshold)
|
M.compound_bar = function(x, y, w, pad, labels, spacing, thickness, threshold)
|
||||||
return {
|
return {
|
||||||
labels = _G_Widget_.TextColumn(
|
labels = Startup.TextColumn(
|
||||||
_G_Widget_.make_point(x, y),
|
Startup.make_point(x, y),
|
||||||
labels,
|
labels,
|
||||||
M.left_text_style,
|
M.left_text_style,
|
||||||
nil,
|
nil,
|
||||||
spacing
|
spacing
|
||||||
),
|
),
|
||||||
bars = _G_Widget_.CompoundBar(
|
bars = Startup.CompoundBar(
|
||||||
_G_Widget_.make_point(x + pad, y),
|
Startup.make_point(x + pad, y),
|
||||||
w - pad,
|
w - pad,
|
||||||
_G_Widget_.line_style(
|
Startup.line_style(
|
||||||
thickness,
|
thickness,
|
||||||
_G_Patterns_.INDICATOR_BG,
|
Theme.INDICATOR_BG,
|
||||||
CAIRO_LINE_JOIN_MITER
|
CAIRO_LINE_JOIN_MITER
|
||||||
),
|
),
|
||||||
threshold_indicator(threshold),
|
threshold_indicator(threshold),
|
||||||
|
@ -380,12 +382,12 @@ end
|
||||||
-- separator (eg a horizontal line)
|
-- separator (eg a horizontal line)
|
||||||
|
|
||||||
M.initSeparator = function(x, y, w)
|
M.initSeparator = function(x, y, w)
|
||||||
return _G_Widget_.Line(
|
return Startup.Line(
|
||||||
_G_Widget_.make_point(x, y),
|
Startup.make_point(x, y),
|
||||||
_G_Widget_.make_point(x + w, y),
|
Startup.make_point(x + w, y),
|
||||||
_G_Widget_.line_style(
|
Startup.line_style(
|
||||||
SEPARATOR_THICKNESS,
|
SEPARATOR_THICKNESS,
|
||||||
_G_Patterns_.BORDER_FG,
|
Theme.BORDER_FG,
|
||||||
CAIRO_LINE_CAP_BUTT
|
CAIRO_LINE_CAP_BUTT
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -396,8 +398,8 @@ end
|
||||||
|
|
||||||
M.initTextRow = function(x, y, w, label)
|
M.initTextRow = function(x, y, w, label)
|
||||||
return {
|
return {
|
||||||
label = _left_text(_G_Widget_.make_point(x, y), label),
|
label = _left_text(Startup.make_point(x, y), label),
|
||||||
value = _right_text(_G_Widget_.make_point(x + w, y), nil),
|
value = _right_text(Startup.make_point(x + w, y), nil),
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -418,18 +420,18 @@ end
|
||||||
|
|
||||||
M.initTextRowCrit = function(x, y, w, label, append_end, limit)
|
M.initTextRowCrit = function(x, y, w, label, append_end, limit)
|
||||||
return{
|
return{
|
||||||
label = _left_text(_G_Widget_.make_point(x, y), label),
|
label = _left_text(Startup.make_point(x, y), label),
|
||||||
value = _G_Widget_.formattedThresholdText(
|
value = Startup.formattedThresholdText(
|
||||||
_G_Widget_.make_point(x + w, y),
|
Startup.make_point(x + w, y),
|
||||||
nil,
|
nil,
|
||||||
_G_Widget_.text_style(
|
Startup.text_style(
|
||||||
M.normal_font_spec,
|
M.normal_font_spec,
|
||||||
_G_Patterns_.PRIMARY_FG,
|
Theme.PRIMARY_FG,
|
||||||
'right',
|
'right',
|
||||||
'center'
|
'center'
|
||||||
),
|
),
|
||||||
append_end,
|
append_end,
|
||||||
_G_Widget_.threshold_text_style(_G_Patterns_.CRITICAL_FG, limit)
|
Startup.threshold_text_style(Theme.CRITICAL_FG, limit)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -448,8 +450,8 @@ end
|
||||||
-- text column
|
-- text column
|
||||||
|
|
||||||
M.text_column = function(x, y, spacing, labels, x_align, color)
|
M.text_column = function(x, y, spacing, labels, x_align, color)
|
||||||
return _G_Widget_.TextColumn(
|
return Startup.TextColumn(
|
||||||
_G_Widget_.make_point(x, y),
|
Startup.make_point(x, y),
|
||||||
labels,
|
labels,
|
||||||
_text_row_style(x_align, color),
|
_text_row_style(x_align, color),
|
||||||
nil,
|
nil,
|
||||||
|
@ -462,15 +464,15 @@ end
|
||||||
|
|
||||||
M.initTextRows_color = function(x, y, w, spacing, labels, color, format)
|
M.initTextRows_color = function(x, y, w, spacing, labels, color, format)
|
||||||
return {
|
return {
|
||||||
labels = _G_Widget_.TextColumn(
|
labels = Startup.TextColumn(
|
||||||
_G_Widget_.make_point(x, y),
|
Startup.make_point(x, y),
|
||||||
labels,
|
labels,
|
||||||
M.left_text_style,
|
M.left_text_style,
|
||||||
nil,
|
nil,
|
||||||
spacing
|
spacing
|
||||||
),
|
),
|
||||||
values = _G_Widget_.initTextColumnN(
|
values = Startup.initTextColumnN(
|
||||||
_G_Widget_.make_point(x + w, y),
|
Startup.make_point(x + w, y),
|
||||||
#labels,
|
#labels,
|
||||||
_text_row_style('right', color),
|
_text_row_style('right', color),
|
||||||
format,
|
format,
|
||||||
|
@ -486,7 +488,7 @@ M.initTextRows = function(x, y, w, spacing, labels)
|
||||||
w,
|
w,
|
||||||
spacing,
|
spacing,
|
||||||
labels,
|
labels,
|
||||||
_G_Patterns_.PRIMARY_FG,
|
Theme.PRIMARY_FG,
|
||||||
nil
|
nil
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -508,27 +510,27 @@ end
|
||||||
|
|
||||||
M.default_table_font_spec = M.make_font_spec(FONT, TABLE_FONT_SIZE, false)
|
M.default_table_font_spec = M.make_font_spec(FONT, TABLE_FONT_SIZE, false)
|
||||||
|
|
||||||
M.default_table_style = _G_Widget_.table_style(
|
M.default_table_style = Startup.table_style(
|
||||||
_G_Widget_.rect_style(
|
Startup.rect_style(
|
||||||
TABLE_LINE_THICKNESS,
|
TABLE_LINE_THICKNESS,
|
||||||
_G_Patterns_.BORDER_FG
|
Theme.BORDER_FG
|
||||||
),
|
),
|
||||||
_G_Widget_.line_style(
|
Startup.line_style(
|
||||||
TABLE_LINE_THICKNESS,
|
TABLE_LINE_THICKNESS,
|
||||||
_G_Patterns_.BORDER_FG,
|
Theme.BORDER_FG,
|
||||||
CAIRO_LINE_CAP_BUTT
|
CAIRO_LINE_CAP_BUTT
|
||||||
),
|
),
|
||||||
_G_Widget_.table_header_style(
|
Startup.table_header_style(
|
||||||
M.default_table_font_spec,
|
M.default_table_font_spec,
|
||||||
_G_Patterns_.PRIMARY_FG,
|
Theme.PRIMARY_FG,
|
||||||
TABLE_HEADER_PAD
|
TABLE_HEADER_PAD
|
||||||
),
|
),
|
||||||
_G_Widget_.table_body_style(
|
Startup.table_body_style(
|
||||||
M.default_table_font_spec,
|
M.default_table_font_spec,
|
||||||
_G_Patterns_.INACTIVE_TEXT_FG,
|
Theme.INACTIVE_TEXT_FG,
|
||||||
TABLE_BODY_FORMAT
|
TABLE_BODY_FORMAT
|
||||||
),
|
),
|
||||||
_G_Widget_.padding(
|
Startup.padding(
|
||||||
TABLE_HORZ_PAD,
|
TABLE_HORZ_PAD,
|
||||||
TABLE_VERT_PAD,
|
TABLE_VERT_PAD,
|
||||||
TABLE_HORZ_PAD,
|
TABLE_HORZ_PAD,
|
||||||
|
@ -537,8 +539,8 @@ M.default_table_style = _G_Widget_.table_style(
|
||||||
)
|
)
|
||||||
|
|
||||||
M.initTable = function(x, y, w, h, n, labels)
|
M.initTable = function(x, y, w, h, n, labels)
|
||||||
return _G_Widget_.Table(
|
return Startup.Table(
|
||||||
_G_Widget_.make_box(x, y, w, h),
|
Startup.make_box(x, y, w, h),
|
||||||
n,
|
n,
|
||||||
labels,
|
labels,
|
||||||
M.default_table_style
|
M.default_table_style
|
||||||
|
@ -549,10 +551,10 @@ end
|
||||||
-- panel
|
-- panel
|
||||||
|
|
||||||
M.initPanel = function(x, y, w, h, thickness)
|
M.initPanel = function(x, y, w, h, thickness)
|
||||||
return _G_Widget_.FillRect(
|
return Startup.FillRect(
|
||||||
_G_Widget_.make_box(x, y, w, h),
|
Startup.make_box(x, y, w, h),
|
||||||
_G_Widget_.rect_style(thickness, _G_Patterns_.BORDER_FG),
|
Startup.rect_style(thickness, Theme.BORDER_FG),
|
||||||
_G_Patterns_.PANEL_BG
|
Theme.PANEL_BG
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ local M = {}
|
||||||
local Line = require 'Line'
|
local Line = require 'Line'
|
||||||
local Util = require 'Util'
|
local Util = require 'Util'
|
||||||
local Common = require 'Common'
|
local Common = require 'Common'
|
||||||
|
local Geometry = require 'Geometry'
|
||||||
|
|
||||||
local _FS_PATHS_ = {'/', '/boot', '/home', '/mnt/data', '/mnt/dcache', "/tmp"}
|
local _FS_PATHS_ = {'/', '/boot', '/home', '/mnt/data', '/mnt/dcache', "/tmp"}
|
||||||
local _MODULE_Y_ = 170
|
local _MODULE_Y_ = 170
|
||||||
|
@ -13,9 +14,9 @@ local _SEPARATOR_SPACING_ = 20
|
||||||
local FS_NUM = #_FS_PATHS_
|
local FS_NUM = #_FS_PATHS_
|
||||||
|
|
||||||
local header = Common.Header(
|
local header = Common.Header(
|
||||||
_G_INIT_DATA_.RIGHT_X,
|
Geometry.RIGHT_X,
|
||||||
_MODULE_Y_,
|
_MODULE_Y_,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH,
|
Geometry.SECTION_WIDTH,
|
||||||
'FILE SYSTEMS'
|
'FILE SYSTEMS'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -26,26 +27,26 @@ for i, v in pairs(_FS_PATHS_) do
|
||||||
end
|
end
|
||||||
|
|
||||||
local smart = Common.initTextRow(
|
local smart = Common.initTextRow(
|
||||||
_G_INIT_DATA_.RIGHT_X,
|
Geometry.RIGHT_X,
|
||||||
header.bottom_y,
|
header.bottom_y,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH,
|
Geometry.SECTION_WIDTH,
|
||||||
'SMART Daemon'
|
'SMART Daemon'
|
||||||
)
|
)
|
||||||
|
|
||||||
local _SEP_Y_ = header.bottom_y + _SEPARATOR_SPACING_
|
local _SEP_Y_ = header.bottom_y + _SEPARATOR_SPACING_
|
||||||
|
|
||||||
local separator = Common.initSeparator(
|
local separator = Common.initSeparator(
|
||||||
_G_INIT_DATA_.RIGHT_X,
|
Geometry.RIGHT_X,
|
||||||
_SEP_Y_,
|
_SEP_Y_,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH
|
Geometry.SECTION_WIDTH
|
||||||
)
|
)
|
||||||
|
|
||||||
local _BAR_Y_ = _SEP_Y_ + _SEPARATOR_SPACING_
|
local _BAR_Y_ = _SEP_Y_ + _SEPARATOR_SPACING_
|
||||||
|
|
||||||
local fs = Common.compound_bar(
|
local fs = Common.compound_bar(
|
||||||
_G_INIT_DATA_.RIGHT_X,
|
Geometry.RIGHT_X,
|
||||||
_BAR_Y_,
|
_BAR_Y_,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH,
|
Geometry.SECTION_WIDTH,
|
||||||
_BAR_PAD_,
|
_BAR_PAD_,
|
||||||
{'root', 'boot', 'home', 'data', 'dcache', 'tmpfs'},
|
{'root', 'boot', 'home', 'data', 'dcache', 'tmpfs'},
|
||||||
_SPACING_,
|
_SPACING_,
|
||||||
|
|
|
@ -2,9 +2,9 @@ local M = {}
|
||||||
|
|
||||||
local Text = require 'Text'
|
local Text = require 'Text'
|
||||||
local Line = require 'Line'
|
local Line = require 'Line'
|
||||||
local LabelPlot = require 'LabelPlot'
|
|
||||||
local Util = require 'Util'
|
local Util = require 'Util'
|
||||||
local Common = require 'Common'
|
local Common = require 'Common'
|
||||||
|
local Geometry = require 'Geometry'
|
||||||
|
|
||||||
local __string_match = string.match
|
local __string_match = string.match
|
||||||
|
|
||||||
|
@ -21,33 +21,33 @@ local na_percent_format = function(x)
|
||||||
end
|
end
|
||||||
|
|
||||||
local header = Common.Header(
|
local header = Common.Header(
|
||||||
_G_INIT_DATA_.LEFT_X,
|
Geometry.LEFT_X,
|
||||||
_MODULE_Y_,
|
_MODULE_Y_,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH,
|
Geometry.SECTION_WIDTH,
|
||||||
'NVIDIA GRAPHICS'
|
'NVIDIA GRAPHICS'
|
||||||
)
|
)
|
||||||
|
|
||||||
local status = Common.initTextRow(
|
local status = Common.initTextRow(
|
||||||
_G_INIT_DATA_.LEFT_X,
|
Geometry.LEFT_X,
|
||||||
header.bottom_y,
|
header.bottom_y,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH,
|
Geometry.SECTION_WIDTH,
|
||||||
'Status'
|
'Status'
|
||||||
)
|
)
|
||||||
|
|
||||||
local _SEP_Y_1_ = header.bottom_y + _SEPARATOR_SPACING_
|
local _SEP_Y_1_ = header.bottom_y + _SEPARATOR_SPACING_
|
||||||
|
|
||||||
local separator1 = Common.initSeparator(
|
local separator1 = Common.initSeparator(
|
||||||
_G_INIT_DATA_.LEFT_X,
|
Geometry.LEFT_X,
|
||||||
_SEP_Y_1_,
|
_SEP_Y_1_,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH
|
Geometry.SECTION_WIDTH
|
||||||
)
|
)
|
||||||
|
|
||||||
local _INTERNAL_TEMP_Y_ = _SEP_Y_1_ + _SEPARATOR_SPACING_
|
local _INTERNAL_TEMP_Y_ = _SEP_Y_1_ + _SEPARATOR_SPACING_
|
||||||
|
|
||||||
local internal_temp = Common.initTextRowCrit(
|
local internal_temp = Common.initTextRowCrit(
|
||||||
_G_INIT_DATA_.LEFT_X,
|
Geometry.LEFT_X,
|
||||||
_INTERNAL_TEMP_Y_,
|
_INTERNAL_TEMP_Y_,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH,
|
Geometry.SECTION_WIDTH,
|
||||||
'Internal Temperature',
|
'Internal Temperature',
|
||||||
function(s) if s == -1 then return NA else return string.format('%s°C', s) end end,
|
function(s) if s == -1 then return NA else return string.format('%s°C', s) end end,
|
||||||
80
|
80
|
||||||
|
@ -56,17 +56,17 @@ local internal_temp = Common.initTextRowCrit(
|
||||||
local _SEP_Y_2_ = _INTERNAL_TEMP_Y_ + _SEPARATOR_SPACING_
|
local _SEP_Y_2_ = _INTERNAL_TEMP_Y_ + _SEPARATOR_SPACING_
|
||||||
|
|
||||||
local separator2 = Common.initSeparator(
|
local separator2 = Common.initSeparator(
|
||||||
_G_INIT_DATA_.LEFT_X,
|
Geometry.LEFT_X,
|
||||||
_SEP_Y_2_,
|
_SEP_Y_2_,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH
|
Geometry.SECTION_WIDTH
|
||||||
)
|
)
|
||||||
|
|
||||||
local _CLOCK_SPEED_Y_ = _SEP_Y_2_ + _SEPARATOR_SPACING_
|
local _CLOCK_SPEED_Y_ = _SEP_Y_2_ + _SEPARATOR_SPACING_
|
||||||
|
|
||||||
local clock_speed = Common.initTextRows(
|
local clock_speed = Common.initTextRows(
|
||||||
_G_INIT_DATA_.LEFT_X,
|
Geometry.LEFT_X,
|
||||||
_CLOCK_SPEED_Y_,
|
_CLOCK_SPEED_Y_,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH,
|
Geometry.SECTION_WIDTH,
|
||||||
_TEXT_SPACING_,
|
_TEXT_SPACING_,
|
||||||
{'GPU Clock Speed', 'Memory Clock Speed'}
|
{'GPU Clock Speed', 'Memory Clock Speed'}
|
||||||
)
|
)
|
||||||
|
@ -74,17 +74,17 @@ local clock_speed = Common.initTextRows(
|
||||||
local _SEP_Y_3_ = _CLOCK_SPEED_Y_ + _TEXT_SPACING_ * 2
|
local _SEP_Y_3_ = _CLOCK_SPEED_Y_ + _TEXT_SPACING_ * 2
|
||||||
|
|
||||||
local separator3 = Common.initSeparator(
|
local separator3 = Common.initSeparator(
|
||||||
_G_INIT_DATA_.LEFT_X,
|
Geometry.LEFT_X,
|
||||||
_SEP_Y_3_,
|
_SEP_Y_3_,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH
|
Geometry.SECTION_WIDTH
|
||||||
)
|
)
|
||||||
|
|
||||||
local _GPU_UTIL_Y_ = _SEP_Y_3_ + _SEPARATOR_SPACING_
|
local _GPU_UTIL_Y_ = _SEP_Y_3_ + _SEPARATOR_SPACING_
|
||||||
|
|
||||||
local gpu_util = Common.initPercentPlot_formatted(
|
local gpu_util = Common.initPercentPlot_formatted(
|
||||||
_G_INIT_DATA_.LEFT_X,
|
Geometry.LEFT_X,
|
||||||
_GPU_UTIL_Y_,
|
_GPU_UTIL_Y_,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH,
|
Geometry.SECTION_WIDTH,
|
||||||
_PLOT_HEIGHT_,
|
_PLOT_HEIGHT_,
|
||||||
_PLOT_SEC_BREAK_,
|
_PLOT_SEC_BREAK_,
|
||||||
'GPU Utilization',
|
'GPU Utilization',
|
||||||
|
@ -94,9 +94,9 @@ local gpu_util = Common.initPercentPlot_formatted(
|
||||||
local _MEM_UTIL_Y_ = _GPU_UTIL_Y_ + _PLOT_HEIGHT_ + _PLOT_SEC_BREAK_ * 2
|
local _MEM_UTIL_Y_ = _GPU_UTIL_Y_ + _PLOT_HEIGHT_ + _PLOT_SEC_BREAK_ * 2
|
||||||
|
|
||||||
local mem_util = Common.initPercentPlot_formatted(
|
local mem_util = Common.initPercentPlot_formatted(
|
||||||
_G_INIT_DATA_.LEFT_X,
|
Geometry.LEFT_X,
|
||||||
_MEM_UTIL_Y_,
|
_MEM_UTIL_Y_,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH,
|
Geometry.SECTION_WIDTH,
|
||||||
_PLOT_HEIGHT_,
|
_PLOT_HEIGHT_,
|
||||||
_PLOT_SEC_BREAK_,
|
_PLOT_SEC_BREAK_,
|
||||||
'Memory Utilization',
|
'Memory Utilization',
|
||||||
|
@ -106,9 +106,9 @@ local mem_util = Common.initPercentPlot_formatted(
|
||||||
local _VID_UTIL_Y_ = _MEM_UTIL_Y_ + _PLOT_HEIGHT_ + _PLOT_SEC_BREAK_ * 2
|
local _VID_UTIL_Y_ = _MEM_UTIL_Y_ + _PLOT_HEIGHT_ + _PLOT_SEC_BREAK_ * 2
|
||||||
|
|
||||||
local vid_util = Common.initPercentPlot_formatted(
|
local vid_util = Common.initPercentPlot_formatted(
|
||||||
_G_INIT_DATA_.LEFT_X,
|
Geometry.LEFT_X,
|
||||||
_VID_UTIL_Y_,
|
_VID_UTIL_Y_,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH,
|
Geometry.SECTION_WIDTH,
|
||||||
_PLOT_HEIGHT_,
|
_PLOT_HEIGHT_,
|
||||||
_PLOT_SEC_BREAK_,
|
_PLOT_SEC_BREAK_,
|
||||||
'Video Utilization',
|
'Video Utilization',
|
||||||
|
|
|
@ -6,6 +6,8 @@ local LabelPlot = require 'LabelPlot'
|
||||||
local Table = require 'Table'
|
local Table = require 'Table'
|
||||||
local Util = require 'Util'
|
local Util = require 'Util'
|
||||||
local Common = require 'Common'
|
local Common = require 'Common'
|
||||||
|
local Theme = require 'Patterns'
|
||||||
|
local Geometry = require 'Geometry'
|
||||||
|
|
||||||
local __string_match = string.match
|
local __string_match = string.match
|
||||||
local __cairo_path_destroy = cairo_path_destroy
|
local __cairo_path_destroy = cairo_path_destroy
|
||||||
|
@ -41,16 +43,16 @@ for r = 1, NUM_ROWS do
|
||||||
end
|
end
|
||||||
|
|
||||||
local header = Common.Header(
|
local header = Common.Header(
|
||||||
_G_INIT_DATA_.RIGHT_X,
|
Geometry.RIGHT_X,
|
||||||
_MODULE_Y_,
|
_MODULE_Y_,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH,
|
Geometry.SECTION_WIDTH,
|
||||||
'MEMORY'
|
'MEMORY'
|
||||||
)
|
)
|
||||||
|
|
||||||
local DIAL_RADIUS = 32
|
local DIAL_RADIUS = 32
|
||||||
local DIAL_THETA_0 = math.rad(90)
|
local DIAL_THETA_0 = math.rad(90)
|
||||||
local DIAL_THETA_1 = math.rad(360)
|
local DIAL_THETA_1 = math.rad(360)
|
||||||
local DIAL_X = _G_INIT_DATA_.RIGHT_X + DIAL_RADIUS + _DIAL_THICKNESS_ / 2
|
local DIAL_X = Geometry.RIGHT_X + DIAL_RADIUS + _DIAL_THICKNESS_ / 2
|
||||||
local DIAL_Y = header.bottom_y + DIAL_RADIUS + _DIAL_THICKNESS_ / 2
|
local DIAL_Y = header.bottom_y + DIAL_RADIUS + _DIAL_THICKNESS_ / 2
|
||||||
|
|
||||||
local dial = Common.dial(DIAL_X, DIAL_Y, DIAL_RADIUS, _DIAL_THICKNESS_, 0.8)
|
local dial = Common.dial(DIAL_X, DIAL_Y, DIAL_RADIUS, _DIAL_THICKNESS_, 0.8)
|
||||||
|
@ -59,7 +61,7 @@ local cache_arc = Common.arc(
|
||||||
DIAL_Y,
|
DIAL_Y,
|
||||||
DIAL_RADIUS,
|
DIAL_RADIUS,
|
||||||
_DIAL_THICKNESS_,
|
_DIAL_THICKNESS_,
|
||||||
_G_Patterns_.INDICATOR_FG_SECONDARY
|
Theme.INDICATOR_FG_SECONDARY
|
||||||
)
|
)
|
||||||
|
|
||||||
local text_ring = Common.initTextRing(
|
local text_ring = Common.initTextRing(
|
||||||
|
@ -71,8 +73,8 @@ local text_ring = Common.initTextRing(
|
||||||
)
|
)
|
||||||
|
|
||||||
local _LINE_1_Y_ = header.bottom_y + _TEXT_Y_OFFSET_
|
local _LINE_1_Y_ = header.bottom_y + _TEXT_Y_OFFSET_
|
||||||
local _TEXT_LEFT_X_ = _G_INIT_DATA_.RIGHT_X + DIAL_RADIUS * 2 + _TEXT_LEFT_X_OFFSET_
|
local _TEXT_LEFT_X_ = Geometry.RIGHT_X + DIAL_RADIUS * 2 + _TEXT_LEFT_X_OFFSET_
|
||||||
local _RIGHT_X_ = _G_INIT_DATA_.RIGHT_X + _G_INIT_DATA_.SECTION_WIDTH
|
local _RIGHT_X_ = Geometry.RIGHT_X + Geometry.SECTION_WIDTH
|
||||||
|
|
||||||
local swap = Common.initTextRowCrit(
|
local swap = Common.initTextRowCrit(
|
||||||
_TEXT_LEFT_X_,
|
_TEXT_LEFT_X_,
|
||||||
|
@ -87,27 +89,27 @@ local swap = Common.initTextRowCrit(
|
||||||
local cache = Common.initTextRows_color(
|
local cache = Common.initTextRows_color(
|
||||||
_TEXT_LEFT_X_,
|
_TEXT_LEFT_X_,
|
||||||
_LINE_1_Y_ + _TEXT_SPACING_,
|
_LINE_1_Y_ + _TEXT_SPACING_,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH - _TEXT_LEFT_X_OFFSET_ - DIAL_RADIUS * 2,
|
Geometry.SECTION_WIDTH - _TEXT_LEFT_X_OFFSET_ - DIAL_RADIUS * 2,
|
||||||
_TEXT_SPACING_,
|
_TEXT_SPACING_,
|
||||||
{'Page Cache', 'Buffers', 'Kernel Slab'},
|
{'Page Cache', 'Buffers', 'Kernel Slab'},
|
||||||
_G_Patterns_.SECONDARY_FG,
|
Theme.SECONDARY_FG,
|
||||||
'%s%%'
|
'%s%%'
|
||||||
)
|
)
|
||||||
|
|
||||||
local _PLOT_Y_ = _PLOT_SECTION_BREAK_ + header.bottom_y + DIAL_RADIUS * 2
|
local _PLOT_Y_ = _PLOT_SECTION_BREAK_ + header.bottom_y + DIAL_RADIUS * 2
|
||||||
|
|
||||||
local plot = Common.initThemedLabelPlot(
|
local plot = Common.initThemedLabelPlot(
|
||||||
_G_INIT_DATA_.RIGHT_X,
|
Geometry.RIGHT_X,
|
||||||
_PLOT_Y_,
|
_PLOT_Y_,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH,
|
Geometry.SECTION_WIDTH,
|
||||||
_PLOT_HEIGHT_,
|
_PLOT_HEIGHT_,
|
||||||
Common.percent_label_style
|
Common.percent_label_style
|
||||||
)
|
)
|
||||||
|
|
||||||
local tbl = Common.initTable(
|
local tbl = Common.initTable(
|
||||||
_G_INIT_DATA_.RIGHT_X,
|
Geometry.RIGHT_X,
|
||||||
_PLOT_Y_ + _PLOT_HEIGHT_ + _TABLE_SECTION_BREAK_,
|
_PLOT_Y_ + _PLOT_HEIGHT_ + _TABLE_SECTION_BREAK_,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH,
|
Geometry.SECTION_WIDTH,
|
||||||
_TABLE_HEIGHT_,
|
_TABLE_HEIGHT_,
|
||||||
NUM_ROWS,
|
NUM_ROWS,
|
||||||
{'Name', 'PID', 'Mem (%)'}
|
{'Name', 'PID', 'Mem (%)'}
|
||||||
|
|
|
@ -2,6 +2,7 @@ local M = {}
|
||||||
|
|
||||||
local Util = require 'Util'
|
local Util = require 'Util'
|
||||||
local Common = require 'Common'
|
local Common = require 'Common'
|
||||||
|
local Geometry = require 'Geometry'
|
||||||
|
|
||||||
local __string_gmatch = string.gmatch
|
local __string_gmatch = string.gmatch
|
||||||
local __math_floor = math.floor
|
local __math_floor = math.floor
|
||||||
|
@ -20,16 +21,16 @@ local value_format_function = function(bits)
|
||||||
end
|
end
|
||||||
|
|
||||||
local header = Common.Header(
|
local header = Common.Header(
|
||||||
_G_INIT_DATA_.CENTER_RIGHT_X,
|
Geometry.CENTER_RIGHT_X,
|
||||||
_G_INIT_DATA_.TOP_Y,
|
Geometry.TOP_Y,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH,
|
Geometry.SECTION_WIDTH,
|
||||||
'NETWORK'
|
'NETWORK'
|
||||||
)
|
)
|
||||||
|
|
||||||
local dnload = Common.initLabeledScalePlot(
|
local dnload = Common.initLabeledScalePlot(
|
||||||
_G_INIT_DATA_.CENTER_RIGHT_X,
|
Geometry.CENTER_RIGHT_X,
|
||||||
header.bottom_y,
|
header.bottom_y,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH,
|
Geometry.SECTION_WIDTH,
|
||||||
_PLOT_HEIGHT_,
|
_PLOT_HEIGHT_,
|
||||||
value_format_function,
|
value_format_function,
|
||||||
network_label_function,
|
network_label_function,
|
||||||
|
@ -39,9 +40,9 @@ local dnload = Common.initLabeledScalePlot(
|
||||||
)
|
)
|
||||||
|
|
||||||
local upload = Common.initLabeledScalePlot(
|
local upload = Common.initLabeledScalePlot(
|
||||||
_G_INIT_DATA_.CENTER_RIGHT_X,
|
Geometry.CENTER_RIGHT_X,
|
||||||
header.bottom_y + _PLOT_HEIGHT_ + _PLOT_SEC_BREAK_ * 2,
|
header.bottom_y + _PLOT_HEIGHT_ + _PLOT_SEC_BREAK_ * 2,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH,
|
Geometry.SECTION_WIDTH,
|
||||||
_PLOT_HEIGHT_,
|
_PLOT_HEIGHT_,
|
||||||
value_format_function,
|
value_format_function,
|
||||||
network_label_function,
|
network_label_function,
|
||||||
|
@ -95,21 +96,8 @@ local update = function(cr, update_frequency)
|
||||||
if tx_delta > 0 then uspeed = uspeed + tx_delta * update_frequency end
|
if tx_delta > 0 then uspeed = uspeed + tx_delta * update_frequency end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- local dspeed_unit, dspeed_value = Util.convert_data_val(dspeed)
|
Common.annotated_scale_plot_set(dnload, cr, dspeed)
|
||||||
-- local uspeed_unit, uspeed_value = Util.convert_data_val(uspeed)
|
Common.annotated_scale_plot_set(upload, cr, uspeed)
|
||||||
|
|
||||||
Common.annotated_scale_plot_set(
|
|
||||||
dnload,
|
|
||||||
cr,
|
|
||||||
-- Util.precision_round_to_string(dspeed_value, 3)..' '..dspeed_unit..'b/s',
|
|
||||||
dspeed
|
|
||||||
)
|
|
||||||
Common.annotated_scale_plot_set(
|
|
||||||
upload,
|
|
||||||
cr,
|
|
||||||
-- Util.precision_round_to_string(uspeed_value, 3)..' '..uspeed_unit..'b/s',
|
|
||||||
uspeed
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
_PLOT_SEC_BREAK_ = nil
|
_PLOT_SEC_BREAK_ = nil
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
local Common = require 'Common'
|
local Common = require 'Common'
|
||||||
|
local Geometry = require 'Geometry'
|
||||||
|
|
||||||
local __string_match = string.match
|
local __string_match = string.match
|
||||||
local __string_gmatch = string.gmatch
|
local __string_gmatch = string.gmatch
|
||||||
|
@ -8,16 +9,16 @@ local __string_gmatch = string.gmatch
|
||||||
local _TEXT_SPACING_ = 20
|
local _TEXT_SPACING_ = 20
|
||||||
|
|
||||||
local header = Common.Header(
|
local header = Common.Header(
|
||||||
_G_INIT_DATA_.RIGHT_X,
|
Geometry.RIGHT_X,
|
||||||
_G_INIT_DATA_.TOP_Y,
|
Geometry.TOP_Y,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH,
|
Geometry.SECTION_WIDTH,
|
||||||
'PACMAN'
|
'PACMAN'
|
||||||
)
|
)
|
||||||
|
|
||||||
local rows = Common.initTextRows(
|
local rows = Common.initTextRows(
|
||||||
_G_INIT_DATA_.RIGHT_X,
|
Geometry.RIGHT_X,
|
||||||
header.bottom_y,
|
header.bottom_y,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH,
|
Geometry.SECTION_WIDTH,
|
||||||
_TEXT_SPACING_,
|
_TEXT_SPACING_,
|
||||||
{'Total', 'Explicit', 'Outdated', 'Orphaned', 'Local'}
|
{'Total', 'Explicit', 'Outdated', 'Orphaned', 'Local'}
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,6 +2,7 @@ local M = {}
|
||||||
|
|
||||||
local Util = require 'Util'
|
local Util = require 'Util'
|
||||||
local Common = require 'Common'
|
local Common = require 'Common'
|
||||||
|
local Geometry = require 'Geometry'
|
||||||
|
|
||||||
local _MODULE_Y_ = 380
|
local _MODULE_Y_ = 380
|
||||||
local _TEXT_SPACING_ = 20
|
local _TEXT_SPACING_ = 20
|
||||||
|
@ -31,16 +32,16 @@ local ac_format_function = function(watts)
|
||||||
end
|
end
|
||||||
|
|
||||||
local header = Common.Header(
|
local header = Common.Header(
|
||||||
_G_INIT_DATA_.RIGHT_X,
|
Geometry.RIGHT_X,
|
||||||
_MODULE_Y_,
|
_MODULE_Y_,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH,
|
Geometry.SECTION_WIDTH,
|
||||||
'POWER'
|
'POWER'
|
||||||
)
|
)
|
||||||
|
|
||||||
local pkg0 = Common.initLabeledScalePlot(
|
local pkg0 = Common.initLabeledScalePlot(
|
||||||
_G_INIT_DATA_.RIGHT_X,
|
Geometry.RIGHT_X,
|
||||||
header.bottom_y,
|
header.bottom_y,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH,
|
Geometry.SECTION_WIDTH,
|
||||||
_PLOT_HEIGHT_,
|
_PLOT_HEIGHT_,
|
||||||
power_format_function,
|
power_format_function,
|
||||||
power_label_function,
|
power_label_function,
|
||||||
|
@ -52,9 +53,9 @@ local pkg0 = Common.initLabeledScalePlot(
|
||||||
local _CORE_Y_ = header.bottom_y + _TEXT_SPACING_ + _PLOT_SEC_BREAK_ + _PLOT_HEIGHT_
|
local _CORE_Y_ = header.bottom_y + _TEXT_SPACING_ + _PLOT_SEC_BREAK_ + _PLOT_HEIGHT_
|
||||||
|
|
||||||
local dram = Common.initLabeledScalePlot(
|
local dram = Common.initLabeledScalePlot(
|
||||||
_G_INIT_DATA_.RIGHT_X,
|
Geometry.RIGHT_X,
|
||||||
_CORE_Y_,
|
_CORE_Y_,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH,
|
Geometry.SECTION_WIDTH,
|
||||||
_PLOT_HEIGHT_,
|
_PLOT_HEIGHT_,
|
||||||
power_format_function,
|
power_format_function,
|
||||||
power_label_function,
|
power_label_function,
|
||||||
|
@ -65,9 +66,9 @@ local dram = Common.initLabeledScalePlot(
|
||||||
dram.value.append_end = ' W'
|
dram.value.append_end = ' W'
|
||||||
|
|
||||||
local battery_draw = Common.initLabeledScalePlot(
|
local battery_draw = Common.initLabeledScalePlot(
|
||||||
_G_INIT_DATA_.RIGHT_X,
|
Geometry.RIGHT_X,
|
||||||
_CORE_Y_ + _PLOT_SEC_BREAK_ * 2 + _PLOT_HEIGHT_,
|
_CORE_Y_ + _PLOT_SEC_BREAK_ * 2 + _PLOT_HEIGHT_,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH,
|
Geometry.SECTION_WIDTH,
|
||||||
_PLOT_HEIGHT_,
|
_PLOT_HEIGHT_,
|
||||||
ac_format_function,
|
ac_format_function,
|
||||||
power_label_function,
|
power_label_function,
|
||||||
|
|
|
@ -5,6 +5,7 @@ local Line = require 'Line'
|
||||||
local Table = require 'Table'
|
local Table = require 'Table'
|
||||||
local Util = require 'Util'
|
local Util = require 'Util'
|
||||||
local Common = require 'Common'
|
local Common = require 'Common'
|
||||||
|
local Geometry = require 'Geometry'
|
||||||
|
|
||||||
local __string_match = string.match
|
local __string_match = string.match
|
||||||
local __string_gmatch = string.gmatch
|
local __string_gmatch = string.gmatch
|
||||||
|
@ -74,9 +75,9 @@ local _create_core_ = function(cores, id, x, y)
|
||||||
end
|
end
|
||||||
|
|
||||||
local header = Common.Header(
|
local header = Common.Header(
|
||||||
_G_INIT_DATA_.LEFT_X,
|
Geometry.LEFT_X,
|
||||||
_MODULE_Y_,
|
_MODULE_Y_,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH,
|
Geometry.SECTION_WIDTH,
|
||||||
'PROCESSOR'
|
'PROCESSOR'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -84,8 +85,8 @@ local header = Common.Header(
|
||||||
local cores = {}
|
local cores = {}
|
||||||
|
|
||||||
for c = 0, NUM_PHYSICAL_CORES - 1 do
|
for c = 0, NUM_PHYSICAL_CORES - 1 do
|
||||||
local dial_x = _G_INIT_DATA_.LEFT_X + _DIAL_OUTER_RADIUS_ +
|
local dial_x = Geometry.LEFT_X + _DIAL_OUTER_RADIUS_ +
|
||||||
(_G_INIT_DATA_.SECTION_WIDTH - 2 * _DIAL_OUTER_RADIUS_) * c / 3
|
(Geometry.SECTION_WIDTH - 2 * _DIAL_OUTER_RADIUS_) * c / 3
|
||||||
local dial_y = header.bottom_y + _DIAL_OUTER_RADIUS_
|
local dial_y = header.bottom_y + _DIAL_OUTER_RADIUS_
|
||||||
_create_core_(cores, c, dial_x, dial_y)
|
_create_core_(cores, c, dial_x, dial_y)
|
||||||
end
|
end
|
||||||
|
@ -95,9 +96,9 @@ local _HWP_Y_ = header.bottom_y + _DIAL_OUTER_RADIUS_ * 2 + _PLOT_SECTION_BREAK_
|
||||||
local _FREQ_Y_ = _HWP_Y_ + _TEXT_SPACING_
|
local _FREQ_Y_ = _HWP_Y_ + _TEXT_SPACING_
|
||||||
|
|
||||||
local cpu_status = Common.initTextRows(
|
local cpu_status = Common.initTextRows(
|
||||||
_G_INIT_DATA_.LEFT_X,
|
Geometry.LEFT_X,
|
||||||
_HWP_Y_,
|
_HWP_Y_,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH,
|
Geometry.SECTION_WIDTH,
|
||||||
_TEXT_SPACING_,
|
_TEXT_SPACING_,
|
||||||
{'HWP Preference', 'Ave Freq'}
|
{'HWP Preference', 'Ave Freq'}
|
||||||
)
|
)
|
||||||
|
@ -105,9 +106,9 @@ local cpu_status = Common.initTextRows(
|
||||||
local _SEP_Y_ = _FREQ_Y_ + _SEPARATOR_SPACING_
|
local _SEP_Y_ = _FREQ_Y_ + _SEPARATOR_SPACING_
|
||||||
|
|
||||||
local separator = Common.initSeparator(
|
local separator = Common.initSeparator(
|
||||||
_G_INIT_DATA_.LEFT_X,
|
Geometry.LEFT_X,
|
||||||
_SEP_Y_,
|
_SEP_Y_,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH
|
Geometry.SECTION_WIDTH
|
||||||
)
|
)
|
||||||
|
|
||||||
local _LOAD_Y_ = _SEP_Y_ + _SEPARATOR_SPACING_
|
local _LOAD_Y_ = _SEP_Y_ + _SEPARATOR_SPACING_
|
||||||
|
@ -115,18 +116,18 @@ local _LOAD_Y_ = _SEP_Y_ + _SEPARATOR_SPACING_
|
||||||
local _PLOT_Y_ = _LOAD_Y_ + _PLOT_SECTION_BREAK_
|
local _PLOT_Y_ = _LOAD_Y_ + _PLOT_SECTION_BREAK_
|
||||||
|
|
||||||
local total_load = Common.initPercentPlot(
|
local total_load = Common.initPercentPlot(
|
||||||
_G_INIT_DATA_.LEFT_X,
|
Geometry.LEFT_X,
|
||||||
_LOAD_Y_,
|
_LOAD_Y_,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH,
|
Geometry.SECTION_WIDTH,
|
||||||
_PLOT_HEIGHT_,
|
_PLOT_HEIGHT_,
|
||||||
_PLOT_SECTION_BREAK_,
|
_PLOT_SECTION_BREAK_,
|
||||||
"Total Load"
|
"Total Load"
|
||||||
)
|
)
|
||||||
|
|
||||||
local tbl = Common.initTable(
|
local tbl = Common.initTable(
|
||||||
_G_INIT_DATA_.LEFT_X,
|
Geometry.LEFT_X,
|
||||||
_PLOT_Y_ + _PLOT_HEIGHT_ + _TABLE_SECTION_BREAK_,
|
_PLOT_Y_ + _PLOT_HEIGHT_ + _TABLE_SECTION_BREAK_,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH,
|
Geometry.SECTION_WIDTH,
|
||||||
_TABLE_HEIGHT_,
|
_TABLE_HEIGHT_,
|
||||||
NUM_ROWS,
|
NUM_ROWS,
|
||||||
{'Name', 'PID', 'CPU (%)'}
|
{'Name', 'PID', 'CPU (%)'}
|
||||||
|
|
|
@ -2,6 +2,7 @@ local M = {}
|
||||||
|
|
||||||
local Util = require 'Util'
|
local Util = require 'Util'
|
||||||
local Common = require 'Common'
|
local Common = require 'Common'
|
||||||
|
local Geometry = require 'Geometry'
|
||||||
|
|
||||||
local __tonumber = tonumber
|
local __tonumber = tonumber
|
||||||
local __string_match = string.match
|
local __string_match = string.match
|
||||||
|
@ -44,16 +45,16 @@ local format_value_function = function(bps)
|
||||||
end
|
end
|
||||||
|
|
||||||
local header = Common.Header(
|
local header = Common.Header(
|
||||||
_G_INIT_DATA_.CENTER_LEFT_X,
|
Geometry.CENTER_LEFT_X,
|
||||||
_G_INIT_DATA_.TOP_Y,
|
Geometry.TOP_Y,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH,
|
Geometry.SECTION_WIDTH,
|
||||||
'INPUT / OUTPUT'
|
'INPUT / OUTPUT'
|
||||||
)
|
)
|
||||||
|
|
||||||
local reads = Common.initLabeledScalePlot(
|
local reads = Common.initLabeledScalePlot(
|
||||||
_G_INIT_DATA_.CENTER_LEFT_X,
|
Geometry.CENTER_LEFT_X,
|
||||||
header.bottom_y,
|
header.bottom_y,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH,
|
Geometry.SECTION_WIDTH,
|
||||||
_PLOT_HEIGHT_,
|
_PLOT_HEIGHT_,
|
||||||
format_value_function,
|
format_value_function,
|
||||||
io_label_function,
|
io_label_function,
|
||||||
|
@ -64,9 +65,9 @@ local reads = Common.initLabeledScalePlot(
|
||||||
)
|
)
|
||||||
|
|
||||||
local writes = Common.initLabeledScalePlot(
|
local writes = Common.initLabeledScalePlot(
|
||||||
_G_INIT_DATA_.CENTER_LEFT_X,
|
Geometry.CENTER_LEFT_X,
|
||||||
header.bottom_y + _PLOT_HEIGHT_ + _PLOT_SEC_BREAK_ * 2,
|
header.bottom_y + _PLOT_HEIGHT_ + _PLOT_SEC_BREAK_ * 2,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH,
|
Geometry.SECTION_WIDTH,
|
||||||
_PLOT_HEIGHT_,
|
_PLOT_HEIGHT_,
|
||||||
format_value_function,
|
format_value_function,
|
||||||
io_label_function,
|
io_label_function,
|
||||||
|
|
|
@ -2,22 +2,23 @@ local M = {}
|
||||||
|
|
||||||
local Util = require 'Util'
|
local Util = require 'Util'
|
||||||
local Common = require 'Common'
|
local Common = require 'Common'
|
||||||
|
local Geometry = require 'Geometry'
|
||||||
|
|
||||||
local __string_match = string.match
|
local __string_match = string.match
|
||||||
|
|
||||||
local _TEXT_SPACING_ = 20
|
local _TEXT_SPACING_ = 20
|
||||||
|
|
||||||
local header = Common.Header(
|
local header = Common.Header(
|
||||||
_G_INIT_DATA_.LEFT_X,
|
Geometry.LEFT_X,
|
||||||
_G_INIT_DATA_.TOP_Y,
|
Geometry.TOP_Y,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH,
|
Geometry.SECTION_WIDTH,
|
||||||
'SYSTEM'
|
'SYSTEM'
|
||||||
)
|
)
|
||||||
|
|
||||||
local rows = Common.initTextRows(
|
local rows = Common.initTextRows(
|
||||||
_G_INIT_DATA_.LEFT_X,
|
Geometry.LEFT_X,
|
||||||
header.bottom_y,
|
header.bottom_y,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH,
|
Geometry.SECTION_WIDTH,
|
||||||
_TEXT_SPACING_,
|
_TEXT_SPACING_,
|
||||||
{'Kernel', 'Uptime', 'Last Upgrade', 'Last Sync'}
|
{'Kernel', 'Uptime', 'Last Upgrade', 'Last Sync'}
|
||||||
)
|
)
|
||||||
|
|
139
main.lua
139
main.lua
|
@ -1,49 +1,3 @@
|
||||||
--[[
|
|
||||||
Boolean conventions:
|
|
||||||
0 is true, 1 is false
|
|
||||||
|
|
||||||
Module format:
|
|
||||||
LIBRARY STRUCTURE (a collection of functions/values in a table):
|
|
||||||
local M = {} -- define module-level table to return
|
|
||||||
|
|
||||||
local modname = requires 'modname'
|
|
||||||
-- import all required modules
|
|
||||||
|
|
||||||
local foo = function()
|
|
||||||
-- code
|
|
||||||
end
|
|
||||||
|
|
||||||
-- define more functions
|
|
||||||
|
|
||||||
M.foo = foo -- dump all functions into table
|
|
||||||
|
|
||||||
return M -- return entire table (use functions as modname.foo)
|
|
||||||
|
|
||||||
Var names:
|
|
||||||
- delimiters: all words separated by _ (unless camalCase)
|
|
||||||
- booleans: preceed by is_ (as in is_awesome)
|
|
||||||
- Spacial scope:
|
|
||||||
- Everything declared local by default
|
|
||||||
- reassigning to local:
|
|
||||||
- upval to local: prefix with _
|
|
||||||
- global to local: prefix with __
|
|
||||||
- replace . with _ if callng from table
|
|
||||||
- the only reason to do either of these is for performance, therefore
|
|
||||||
no need to localize variables that are only used during init
|
|
||||||
- global: preceed with g_
|
|
||||||
- Temporal Scope
|
|
||||||
- init: only relevent to startup (nil'ed before first rendering loop)
|
|
||||||
- persistant: always relevent (potentially)
|
|
||||||
- flank init vars with _
|
|
||||||
- Mutability
|
|
||||||
- variable: lowercase
|
|
||||||
- constant: ALL_CAPS
|
|
||||||
- constants can be anything except functions
|
|
||||||
- Module Names:
|
|
||||||
- CapCamalCase
|
|
||||||
- var name is exactly the same as module name
|
|
||||||
--]]
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- initialialize global geometric data
|
-- initialialize global geometric data
|
||||||
--
|
--
|
||||||
|
@ -51,38 +5,8 @@ local UPDATE_FREQUENCY = 1 --Hz
|
||||||
|
|
||||||
_G_INIT_DATA_ = {
|
_G_INIT_DATA_ = {
|
||||||
UPDATE_INTERVAL = 1 / UPDATE_FREQUENCY,
|
UPDATE_INTERVAL = 1 / UPDATE_FREQUENCY,
|
||||||
|
|
||||||
LEFT_X = 32,
|
|
||||||
SECTION_WIDTH = 436,
|
|
||||||
CENTER_PAD = 20,
|
|
||||||
PANEL_HORZ_SPACING = 10,
|
|
||||||
PANEL_MARGIN_X = 20,
|
|
||||||
PANEL_MARGIN_Y = 10,
|
|
||||||
|
|
||||||
TOP_Y = 21,
|
|
||||||
SIDE_HEIGHT = 1020,
|
|
||||||
CENTER_HEIGHT = 220,
|
|
||||||
|
|
||||||
-- silly hack, the price of a litewait language
|
|
||||||
ABS_PATH = debug.getinfo(1).source:match("@?(.*/)")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_G_INIT_DATA_.CENTER_LEFT_X = _G_INIT_DATA_.LEFT_X +
|
|
||||||
_G_INIT_DATA_.SECTION_WIDTH + _G_INIT_DATA_.PANEL_MARGIN_X * 2 +
|
|
||||||
_G_INIT_DATA_.PANEL_HORZ_SPACING
|
|
||||||
|
|
||||||
_G_INIT_DATA_.CENTER_RIGHT_X = _G_INIT_DATA_.CENTER_LEFT_X +
|
|
||||||
_G_INIT_DATA_.SECTION_WIDTH + _G_INIT_DATA_.CENTER_PAD
|
|
||||||
|
|
||||||
_G_INIT_DATA_.CENTER_WIDTH = _G_INIT_DATA_.SECTION_WIDTH * 2 +
|
|
||||||
_G_INIT_DATA_.CENTER_PAD
|
|
||||||
|
|
||||||
_G_INIT_DATA_.RIGHT_X = _G_INIT_DATA_.CENTER_LEFT_X +
|
|
||||||
_G_INIT_DATA_.CENTER_WIDTH + _G_INIT_DATA_.PANEL_MARGIN_X * 2 +
|
|
||||||
_G_INIT_DATA_.PANEL_HORZ_SPACING
|
|
||||||
|
|
||||||
conky_set_update_interval(_G_INIT_DATA_.UPDATE_INTERVAL)
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- init cairo
|
-- init cairo
|
||||||
--
|
--
|
||||||
|
@ -96,24 +20,19 @@ local __cairo_surface_destroy = cairo_surface_destroy
|
||||||
local __cairo_destroy = cairo_destroy
|
local __cairo_destroy = cairo_destroy
|
||||||
local __cairo_translate = cairo_translate
|
local __cairo_translate = cairo_translate
|
||||||
|
|
||||||
--
|
local ABS_PATH = debug.getinfo(1).source:match("@?(.*/)")
|
||||||
-- import all packages and init with global geometric data
|
package.path = ABS_PATH..'?.lua;'..
|
||||||
--
|
ABS_PATH..'drawing/?.lua;'..
|
||||||
package.path = _G_INIT_DATA_.ABS_PATH..'?.lua;'..
|
ABS_PATH..'schema/?.lua;'..
|
||||||
_G_INIT_DATA_.ABS_PATH..'drawing/?.lua;'..
|
ABS_PATH..'core/func/?.lua;'..
|
||||||
_G_INIT_DATA_.ABS_PATH..'schema/?.lua;'..
|
ABS_PATH..'core/super/?.lua;'..
|
||||||
_G_INIT_DATA_.ABS_PATH..'core/func/?.lua;'..
|
ABS_PATH..'core/widget/?.lua;'..
|
||||||
_G_INIT_DATA_.ABS_PATH..'core/super/?.lua;'..
|
ABS_PATH..'core/widget/arc/?.lua;'..
|
||||||
_G_INIT_DATA_.ABS_PATH..'core/widget/?.lua;'..
|
ABS_PATH..'core/widget/text/?.lua;'..
|
||||||
_G_INIT_DATA_.ABS_PATH..'core/widget/arc/?.lua;'..
|
ABS_PATH..'core/widget/plot/?.lua;'..
|
||||||
_G_INIT_DATA_.ABS_PATH..'core/widget/text/?.lua;'..
|
ABS_PATH..'core/widget/rect/?.lua;'..
|
||||||
_G_INIT_DATA_.ABS_PATH..'core/widget/plot/?.lua;'..
|
ABS_PATH..'core/widget/poly/?.lua;'..
|
||||||
_G_INIT_DATA_.ABS_PATH..'core/widget/rect/?.lua;'..
|
ABS_PATH..'core/widget/image/?.lua;'
|
||||||
_G_INIT_DATA_.ABS_PATH..'core/widget/poly/?.lua;'..
|
|
||||||
_G_INIT_DATA_.ABS_PATH..'core/widget/image/?.lua;'
|
|
||||||
|
|
||||||
_G_Widget_ = require 'Widget'
|
|
||||||
_G_Patterns_ = require 'Patterns'
|
|
||||||
|
|
||||||
local Util = require 'Util'
|
local Util = require 'Util'
|
||||||
local FillRect = require 'FillRect'
|
local FillRect = require 'FillRect'
|
||||||
|
@ -127,6 +46,7 @@ local ReadWrite = require 'ReadWrite'
|
||||||
local Graphics = require 'Graphics'
|
local Graphics = require 'Graphics'
|
||||||
local Memory = require 'Memory'
|
local Memory = require 'Memory'
|
||||||
local Common = require 'Common'
|
local Common = require 'Common'
|
||||||
|
local Geometry = require 'Geometry'
|
||||||
|
|
||||||
--
|
--
|
||||||
-- initialize static surfaces
|
-- initialize static surfaces
|
||||||
|
@ -162,26 +82,26 @@ local draw_static_surface = function(cr, cs_obj)
|
||||||
end
|
end
|
||||||
|
|
||||||
local cs_left = _make_static_surface(
|
local cs_left = _make_static_surface(
|
||||||
_G_INIT_DATA_.LEFT_X - _G_INIT_DATA_.PANEL_MARGIN_X,
|
Geometry.LEFT_X - Geometry.PANEL_MARGIN_X,
|
||||||
_G_INIT_DATA_.TOP_Y - _G_INIT_DATA_.PANEL_MARGIN_Y,
|
Geometry.TOP_Y - Geometry.PANEL_MARGIN_Y,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH + _G_INIT_DATA_.PANEL_MARGIN_X * 2,
|
Geometry.SECTION_WIDTH + Geometry.PANEL_MARGIN_X * 2,
|
||||||
_G_INIT_DATA_.SIDE_HEIGHT + _G_INIT_DATA_.PANEL_MARGIN_Y * 2,
|
Geometry.SIDE_HEIGHT + Geometry.PANEL_MARGIN_Y * 2,
|
||||||
{System.draw_static, Graphics.draw_static, Processor.draw_static}
|
{System.draw_static, Graphics.draw_static, Processor.draw_static}
|
||||||
)
|
)
|
||||||
|
|
||||||
local cs_center = _make_static_surface(
|
local cs_center = _make_static_surface(
|
||||||
_G_INIT_DATA_.CENTER_LEFT_X - _G_INIT_DATA_.PANEL_MARGIN_X,
|
Geometry.CENTER_LEFT_X - Geometry.PANEL_MARGIN_X,
|
||||||
_G_INIT_DATA_.TOP_Y - _G_INIT_DATA_.PANEL_MARGIN_Y,
|
Geometry.TOP_Y - Geometry.PANEL_MARGIN_Y,
|
||||||
_G_INIT_DATA_.CENTER_WIDTH + _G_INIT_DATA_.PANEL_MARGIN_Y * 2 + _G_INIT_DATA_.CENTER_PAD,
|
Geometry.CENTER_WIDTH + Geometry.PANEL_MARGIN_Y * 2 + Geometry.CENTER_PAD,
|
||||||
_G_INIT_DATA_.CENTER_HEIGHT + _G_INIT_DATA_.PANEL_MARGIN_Y * 2,
|
Geometry.CENTER_HEIGHT + Geometry.PANEL_MARGIN_Y * 2,
|
||||||
{ReadWrite.draw_static, Network.draw_static}
|
{ReadWrite.draw_static, Network.draw_static}
|
||||||
)
|
)
|
||||||
|
|
||||||
local cs_right = _make_static_surface(
|
local cs_right = _make_static_surface(
|
||||||
_G_INIT_DATA_.RIGHT_X - _G_INIT_DATA_.PANEL_MARGIN_X,
|
Geometry.RIGHT_X - Geometry.PANEL_MARGIN_X,
|
||||||
_G_INIT_DATA_.TOP_Y - _G_INIT_DATA_.PANEL_MARGIN_Y,
|
Geometry.TOP_Y - Geometry.PANEL_MARGIN_Y,
|
||||||
_G_INIT_DATA_.SECTION_WIDTH + _G_INIT_DATA_.PANEL_MARGIN_X * 2,
|
Geometry.SECTION_WIDTH + Geometry.PANEL_MARGIN_X * 2,
|
||||||
_G_INIT_DATA_.SIDE_HEIGHT + _G_INIT_DATA_.PANEL_MARGIN_Y * 2,
|
Geometry.SIDE_HEIGHT + Geometry.PANEL_MARGIN_Y * 2,
|
||||||
{Pacman.draw_static, FileSystem.draw_static, Power.draw_static, Memory.draw_static}
|
{Pacman.draw_static, FileSystem.draw_static, Power.draw_static, Memory.draw_static}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -190,9 +110,6 @@ local cs_right = _make_static_surface(
|
||||||
--
|
--
|
||||||
local _unrequire = function(m) package.loaded[m] = nil end
|
local _unrequire = function(m) package.loaded[m] = nil end
|
||||||
|
|
||||||
_G_Widget_ = nil
|
|
||||||
_G_Patterns_ = nil
|
|
||||||
|
|
||||||
_unrequire('Super')
|
_unrequire('Super')
|
||||||
_unrequire('Color')
|
_unrequire('Color')
|
||||||
_unrequire('Widget')
|
_unrequire('Widget')
|
||||||
|
@ -216,6 +133,10 @@ end
|
||||||
local updates = -2 -- this accounts for the first few spazzy iterations
|
local updates = -2 -- this accounts for the first few spazzy iterations
|
||||||
local STATS_FILE = '/tmp/.conky_pacman'
|
local STATS_FILE = '/tmp/.conky_pacman'
|
||||||
|
|
||||||
|
function conky_start(update_interval)
|
||||||
|
conky_set_update_interval(update_interval)
|
||||||
|
end
|
||||||
|
|
||||||
function conky_main()
|
function conky_main()
|
||||||
local _cw = conky_window
|
local _cw = conky_window
|
||||||
if not _cw then return end
|
if not _cw then return end
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.LEFT_X = 32
|
||||||
|
M.SECTION_WIDTH = 436
|
||||||
|
M.CENTER_PAD = 20
|
||||||
|
M.PANEL_HORZ_SPACING = 10
|
||||||
|
M.PANEL_MARGIN_X = 20
|
||||||
|
M.PANEL_MARGIN_Y = 10
|
||||||
|
M.TOP_Y = 21
|
||||||
|
M.SIDE_HEIGHT = 1020
|
||||||
|
M.CENTER_HEIGHT = 220
|
||||||
|
|
||||||
|
local margin_width = M.PANEL_MARGIN_X * 2 + M.PANEL_HORZ_SPACING
|
||||||
|
|
||||||
|
M.CENTER_LEFT_X = M.LEFT_X + M.SECTION_WIDTH + margin_width
|
||||||
|
M.CENTER_RIGHT_X = M.CENTER_LEFT_X + M.SECTION_WIDTH + M.CENTER_PAD
|
||||||
|
M.CENTER_WIDTH = M.SECTION_WIDTH * 2 + M.CENTER_PAD
|
||||||
|
M.RIGHT_X = M.CENTER_LEFT_X + M.CENTER_WIDTH + margin_width
|
||||||
|
|
||||||
|
return M
|
Loading…
Reference in New Issue