init vars flanked by _ instead of __

This commit is contained in:
petrucci4prez 2017-07-16 14:50:33 -04:00
parent 85361b55d4
commit 8a6089586e
13 changed files with 200 additions and 204 deletions

2
core

@ -1 +1 @@
Subproject commit d3b3c385a2371e747676d2b53b73da0c24b6d7ad
Subproject commit 391c9179765e2bb70e1b458aadef58d7b96bb934

View File

@ -2,22 +2,22 @@ local Widget = require 'Widget'
local FillRect = require 'FillRect'
local left = Widget.Panel{
x = __G_INIT_DATA__.LEFT_X - __G_INIT_DATA__.PANEL_MARGIN_X,
y = __G_INIT_DATA__.TOP_Y - __G_INIT_DATA__.PANEL_MARGIN_Y,
width = __G_INIT_DATA__.SECTION_WIDTH + __G_INIT_DATA__.PANEL_MARGIN_X * 2,
height = __G_INIT_DATA__.SIDE_HEIGHT + __G_INIT_DATA__.PANEL_MARGIN_Y * 2,
x = _G_INIT_DATA_.LEFT_X - _G_INIT_DATA_.PANEL_MARGIN_X,
y = _G_INIT_DATA_.TOP_Y - _G_INIT_DATA_.PANEL_MARGIN_Y,
width = _G_INIT_DATA_.SECTION_WIDTH + _G_INIT_DATA_.PANEL_MARGIN_X * 2,
height = _G_INIT_DATA_.SIDE_HEIGHT + _G_INIT_DATA_.PANEL_MARGIN_Y * 2,
}
local center = Widget.Panel{
x = __G_INIT_DATA__.CENTER_LEFT_X - __G_INIT_DATA__.PANEL_MARGIN_X,
y = __G_INIT_DATA__.TOP_Y - __G_INIT_DATA__.PANEL_MARGIN_Y,
width = __G_INIT_DATA__.CENTER_WIDTH + __G_INIT_DATA__.PANEL_MARGIN_Y * 2 + __G_INIT_DATA__.CENTER_PAD,
height = __G_INIT_DATA__.CENTER_HEIGHT + __G_INIT_DATA__.PANEL_MARGIN_Y * 2,
x = _G_INIT_DATA_.CENTER_LEFT_X - _G_INIT_DATA_.PANEL_MARGIN_X,
y = _G_INIT_DATA_.TOP_Y - _G_INIT_DATA_.PANEL_MARGIN_Y,
width = _G_INIT_DATA_.CENTER_WIDTH + _G_INIT_DATA_.PANEL_MARGIN_Y * 2 + _G_INIT_DATA_.CENTER_PAD,
height = _G_INIT_DATA_.CENTER_HEIGHT + _G_INIT_DATA_.PANEL_MARGIN_Y * 2,
}
local right = Widget.Panel{
x = __G_INIT_DATA__.RIGHT_X - __G_INIT_DATA__.PANEL_MARGIN_X,
y = __G_INIT_DATA__.TOP_Y - __G_INIT_DATA__.PANEL_MARGIN_Y,
width = __G_INIT_DATA__.SECTION_WIDTH + __G_INIT_DATA__.PANEL_MARGIN_X * 2,
height = __G_INIT_DATA__.SIDE_HEIGHT + __G_INIT_DATA__.PANEL_MARGIN_Y * 2,
x = _G_INIT_DATA_.RIGHT_X - _G_INIT_DATA_.PANEL_MARGIN_X,
y = _G_INIT_DATA_.TOP_Y - _G_INIT_DATA_.PANEL_MARGIN_Y,
width = _G_INIT_DATA_.SECTION_WIDTH + _G_INIT_DATA_.PANEL_MARGIN_X * 2,
height = _G_INIT_DATA_.SIDE_HEIGHT + _G_INIT_DATA_.PANEL_MARGIN_Y * 2,
}
Widget = nil

View File

@ -46,7 +46,7 @@ Var names:
- Temporal Scope
- init: only relevent to startup (nil'ed before first rendering loop)
- persistant: always relevent (potentially)
- flank init vars with __
- flank init vars with _
- Mutability
- variable: lowercase
- constant: ALL_CAPS
@ -58,7 +58,7 @@ Var names:
local UPDATE_FREQUENCY = 1 --Hz
__G_INIT_DATA__ = {
_G_INIT_DATA_ = {
UPDATE_INTERVAL = 1 / UPDATE_FREQUENCY,
LEFT_X = 32,
@ -75,26 +75,26 @@ __G_INIT_DATA__ = {
ABS_PATH = os.getenv('CONKY_LUA_HOME')
}
__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
_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
package.path = __G_INIT_DATA__.ABS_PATH..'/?.lua;'..
__G_INIT_DATA__.ABS_PATH..'/interface/?.lua;'..
__G_INIT_DATA__.ABS_PATH..'/module/?.lua;'..
__G_INIT_DATA__.ABS_PATH..'/schema/?.lua;'..
__G_INIT_DATA__.ABS_PATH..'/core/func/?.lua;'..
__G_INIT_DATA__.ABS_PATH..'/core/super/?.lua;'..
__G_INIT_DATA__.ABS_PATH..'/core/widget/?.lua;'..
__G_INIT_DATA__.ABS_PATH..'/core/widget/arc/?.lua;'..
__G_INIT_DATA__.ABS_PATH..'/core/widget/text/?.lua;'..
__G_INIT_DATA__.ABS_PATH..'/core/widget/plot/?.lua;'..
__G_INIT_DATA__.ABS_PATH..'/core/widget/rect/?.lua;'..
__G_INIT_DATA__.ABS_PATH..'/core/widget/poly/?.lua;'..
__G_INIT_DATA__.ABS_PATH..'/core/widget/image/?.lua;'
package.path = _G_INIT_DATA_.ABS_PATH..'/?.lua;'..
_G_INIT_DATA_.ABS_PATH..'/interface/?.lua;'..
_G_INIT_DATA_.ABS_PATH..'/module/?.lua;'..
_G_INIT_DATA_.ABS_PATH..'/schema/?.lua;'..
_G_INIT_DATA_.ABS_PATH..'/core/func/?.lua;'..
_G_INIT_DATA_.ABS_PATH..'/core/super/?.lua;'..
_G_INIT_DATA_.ABS_PATH..'/core/widget/?.lua;'..
_G_INIT_DATA_.ABS_PATH..'/core/widget/arc/?.lua;'..
_G_INIT_DATA_.ABS_PATH..'/core/widget/text/?.lua;'..
_G_INIT_DATA_.ABS_PATH..'/core/widget/plot/?.lua;'..
_G_INIT_DATA_.ABS_PATH..'/core/widget/rect/?.lua;'..
_G_INIT_DATA_.ABS_PATH..'/core/widget/poly/?.lua;'..
_G_INIT_DATA_.ABS_PATH..'/core/widget/image/?.lua;'
conky_set_update_interval(__G_INIT_DATA__.UPDATE_INTERVAL)
conky_set_update_interval(_G_INIT_DATA_.UPDATE_INTERVAL)
require 'imlib2'
require 'cairo'
@ -125,7 +125,7 @@ _unrequire('Gradient')
_unrequire = nil
__G_INIT_DATA__ = nil
_G_INIT_DATA_ = nil
local __cairo_xlib_surface_create = cairo_xlib_surface_create
local __cairo_create = cairo_create

View File

@ -22,16 +22,16 @@ local SPACING = 20
local BAR_PAD = 100
local header = Widget.Header{
x = __G_INIT_DATA__.RIGHT_X,
x = _G_INIT_DATA_.RIGHT_X,
y = MODULE_Y,
width = __G_INIT_DATA__.SECTION_WIDTH,
width = _G_INIT_DATA_.SECTION_WIDTH,
header = 'FILE SYSTEMS'
}
local HEADER_BOTTOM_Y = header.bottom_y
local labels = Widget.TextColumn{
x = __G_INIT_DATA__.RIGHT_X,
x = _G_INIT_DATA_.RIGHT_X,
y = HEADER_BOTTOM_Y,
spacing = SPACING,
'root',
@ -46,7 +46,7 @@ local labels = Widget.TextColumn{
--~ for i = 1, FS_NUM do
--~ totals[i] = Widget.CriticalText{
--~ x = __G_INIT_DATA__.RIGHT_X + TEXT_WIDTH,
--~ x = _G_INIT_DATA_.RIGHT_X + TEXT_WIDTH,
--~ y = HEADER_BOTTOM_Y + (i - 1) * SPACING,
--~ x_align = 'right',
--~ text_color = schema.blue,
@ -66,11 +66,11 @@ for i, v in _PAIRS(FS_PATHS) do
end
local bars = Widget.CompoundBar{
--~ x = __G_INIT_DATA__.RIGHT_X + TEXT_WIDTH + BAR_PAD,
x = __G_INIT_DATA__.RIGHT_X + BAR_PAD,
--~ x = _G_INIT_DATA_.RIGHT_X + TEXT_WIDTH + BAR_PAD,
x = _G_INIT_DATA_.RIGHT_X + BAR_PAD,
y = HEADER_BOTTOM_Y,
--~ length = __G_INIT_DATA__.SECTION_WIDTH - (TEXT_WIDTH + BAR_PAD),
length = __G_INIT_DATA__.SECTION_WIDTH - BAR_PAD,
--~ length = _G_INIT_DATA_.SECTION_WIDTH - (TEXT_WIDTH + BAR_PAD),
length = _G_INIT_DATA_.SECTION_WIDTH - BAR_PAD,
spacing = SPACING,
num_bars = FS_NUM,
critical_limit = '>0.8'

View File

@ -17,17 +17,17 @@ local PLOT_SEC_BREAK = 20
local PLOT_HEIGHT = 56
local header = Widget.Header{
x = __G_INIT_DATA__.LEFT_X,
x = _G_INIT_DATA_.LEFT_X,
y = MODULE_Y,
width = __G_INIT_DATA__.SECTION_WIDTH,
width = _G_INIT_DATA_.SECTION_WIDTH,
header = 'NVIDIA GRAPHICS'
}
local RIGHT_X = __G_INIT_DATA__.LEFT_X + __G_INIT_DATA__.SECTION_WIDTH
local RIGHT_X = _G_INIT_DATA_.LEFT_X + _G_INIT_DATA_.SECTION_WIDTH
local status = {
label = Widget.Text{
x = __G_INIT_DATA__.LEFT_X,
x = _G_INIT_DATA_.LEFT_X,
y = header.bottom_y,
text = 'Status'
},
@ -43,7 +43,7 @@ local status = {
local SEP_Y_1 = header.bottom_y + SEPARATOR_SPACING
local separator1 = Widget.Line{
p1 = {x = __G_INIT_DATA__.LEFT_X, y = SEP_Y_1},
p1 = {x = _G_INIT_DATA_.LEFT_X, y = SEP_Y_1},
p2 = {x = RIGHT_X, y = SEP_Y_1}
}
@ -51,7 +51,7 @@ local INTERNAL_TEMP_Y = SEP_Y_1 + SEPARATOR_SPACING
local internal_temp = {
label = Widget.Text{
x = __G_INIT_DATA__.LEFT_X,
x = _G_INIT_DATA_.LEFT_X,
y = INTERNAL_TEMP_Y,
text = 'Internal Temperature'
},
@ -68,7 +68,7 @@ local PCI_UTIL_Y = INTERNAL_TEMP_Y + TEXT_SPACING
local pci_util = {
label = Widget.Text{
x = __G_INIT_DATA__.LEFT_X,
x = _G_INIT_DATA_.LEFT_X,
y = PCI_UTIL_Y,
text = 'PCI Utilization'
},
@ -84,7 +84,7 @@ local pci_util = {
local SEP_Y_2 = PCI_UTIL_Y + SEPARATOR_SPACING
local separator2 = Widget.Line{
p1 = {x = __G_INIT_DATA__.LEFT_X, y = SEP_Y_2},
p1 = {x = _G_INIT_DATA_.LEFT_X, y = SEP_Y_2},
p2 = {x = RIGHT_X, y = SEP_Y_2}
}
@ -92,14 +92,14 @@ local CLOCK_SPEED_Y = SEP_Y_2 + SEPARATOR_SPACING
local clock_speed = {
labels = Widget.TextColumn{
x = __G_INIT_DATA__.LEFT_X,
x = _G_INIT_DATA_.LEFT_X,
y = CLOCK_SPEED_Y,
spacing = TEXT_SPACING,
'GPU Clock Speed',
'Memory Clock Speed'
},
values = Widget.TextColumn{
x = __G_INIT_DATA__.LEFT_X + __G_INIT_DATA__.SECTION_WIDTH,
x = _G_INIT_DATA_.LEFT_X + _G_INIT_DATA_.SECTION_WIDTH,
y = CLOCK_SPEED_Y,
spacing = TEXT_SPACING,
x_align = 'right',
@ -111,7 +111,7 @@ local clock_speed = {
local SEP_Y_3 = CLOCK_SPEED_Y + TEXT_SPACING * 2
local separator3 = Widget.Line{
p1 = {x = __G_INIT_DATA__.LEFT_X, y = SEP_Y_3},
p1 = {x = _G_INIT_DATA_.LEFT_X, y = SEP_Y_3},
p2 = {x = RIGHT_X, y = SEP_Y_3}
}
@ -120,7 +120,7 @@ local GPU_UTIL_PLOT_Y = GPU_UTIL_Y + PLOT_SEC_BREAK
local gpu_util = {
label = Widget.Text{
x = __G_INIT_DATA__.LEFT_X,
x = _G_INIT_DATA_.LEFT_X,
y = GPU_UTIL_Y,
text = 'GPU Utilization'
},
@ -132,9 +132,9 @@ local gpu_util = {
text = '<gpu_util>'
},
plot = Widget.LabelPlot{
x = __G_INIT_DATA__.LEFT_X,
x = _G_INIT_DATA_.LEFT_X,
y = GPU_UTIL_PLOT_Y,
width = __G_INIT_DATA__.SECTION_WIDTH,
width = _G_INIT_DATA_.SECTION_WIDTH,
height = PLOT_HEIGHT
}
}
@ -144,7 +144,7 @@ local MEM_UTIL_PLOT_Y = MEM_UTIL_Y + PLOT_SEC_BREAK
local mem_util = {
label = Widget.Text{
x = __G_INIT_DATA__.LEFT_X,
x = _G_INIT_DATA_.LEFT_X,
y = MEM_UTIL_Y,
text = 'Memory Utilization'
},
@ -156,9 +156,9 @@ local mem_util = {
text = '<mem_util>'
},
plot = Widget.LabelPlot{
x = __G_INIT_DATA__.LEFT_X,
x = _G_INIT_DATA_.LEFT_X,
y = MEM_UTIL_PLOT_Y,
width = __G_INIT_DATA__.SECTION_WIDTH,
width = _G_INIT_DATA_.SECTION_WIDTH,
height = PLOT_HEIGHT
}
}
@ -168,7 +168,7 @@ local VID_UTIL_PLOT_Y = VID_UTIL_Y + PLOT_SEC_BREAK
local vid_util = {
label = Widget.Text{
x = __G_INIT_DATA__.LEFT_X,
x = _G_INIT_DATA_.LEFT_X,
y = VID_UTIL_Y,
text = 'Video Utilization'
},
@ -180,9 +180,9 @@ local vid_util = {
text = '<vid_util>'
},
plot = Widget.LabelPlot{
x = __G_INIT_DATA__.LEFT_X,
x = _G_INIT_DATA_.LEFT_X,
y = VID_UTIL_PLOT_Y,
width = __G_INIT_DATA__.SECTION_WIDTH,
width = _G_INIT_DATA_.SECTION_WIDTH,
height = PLOT_HEIGHT
}
}

View File

@ -42,16 +42,16 @@ local TABLE_SECTION_BREAK = 20
local TABLE_HEIGHT = 114
local header = Widget.Header{
x = __G_INIT_DATA__.RIGHT_X,
x = _G_INIT_DATA_.RIGHT_X,
y = MODULE_Y,
width = __G_INIT_DATA__.SECTION_WIDTH,
width = _G_INIT_DATA_.SECTION_WIDTH,
header = "MEMORY"
}
local HEADER_BOTTOM_Y = header.bottom_y
--don't nil these
local DIAL_X = __G_INIT_DATA__.RIGHT_X + DIAL_RADIUS + DIAL_THICKNESS * 0.5
local DIAL_X = _G_INIT_DATA_.RIGHT_X + DIAL_RADIUS + DIAL_THICKNESS * 0.5
local DIAL_Y = HEADER_BOTTOM_Y + DIAL_RADIUS + DIAL_THICKNESS * 0.5
local dial = Widget.Dial{
@ -85,8 +85,8 @@ local inner_ring = Widget.Arc{
}
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 RIGHT_X = __G_INIT_DATA__.RIGHT_X + __G_INIT_DATA__.SECTION_WIDTH
local TEXT_LEFT_X = _G_INIT_DATA_.RIGHT_X + DIAL_RADIUS * 2 + TEXT_LEFT_X_OFFSET
local RIGHT_X = _G_INIT_DATA_.RIGHT_X + _G_INIT_DATA_.SECTION_WIDTH
local swap= {
label = Widget.Text{
@ -127,18 +127,18 @@ local cache = {
local PLOT_Y = PLOT_SECTION_BREAK + HEADER_BOTTOM_Y + DIAL_RADIUS * 2
local plot = Widget.LabelPlot{
x = __G_INIT_DATA__.RIGHT_X,
x = _G_INIT_DATA_.RIGHT_X,
y = PLOT_Y,
width = __G_INIT_DATA__.SECTION_WIDTH,
width = _G_INIT_DATA_.SECTION_WIDTH,
height = PLOT_HEIGHT
}
local TABLE_Y = PLOT_Y + PLOT_HEIGHT + TABLE_SECTION_BREAK
local tbl = Widget.Table{
x = __G_INIT_DATA__.RIGHT_X,
x = _G_INIT_DATA_.RIGHT_X,
y = TABLE_Y,
width = __G_INIT_DATA__.SECTION_WIDTH,
width = _G_INIT_DATA_.SECTION_WIDTH,
height = TABLE_HEIGHT,
'Name',
'PID',

View File

@ -27,18 +27,18 @@ local __network_label_function = function(bytes)
end
local header = Widget.Header{
x = __G_INIT_DATA__.CENTER_RIGHT_X,
y = __G_INIT_DATA__.TOP_Y,
width = __G_INIT_DATA__.SECTION_WIDTH,
x = _G_INIT_DATA_.CENTER_RIGHT_X,
y = _G_INIT_DATA_.TOP_Y,
width = _G_INIT_DATA_.SECTION_WIDTH,
header = "NETWORK"
}
local RIGHT_X = __G_INIT_DATA__.CENTER_RIGHT_X + __G_INIT_DATA__.SECTION_WIDTH
local RIGHT_X = _G_INIT_DATA_.CENTER_RIGHT_X + _G_INIT_DATA_.SECTION_WIDTH
local DOWNLOAD_PLOT_Y = header.bottom_y + PLOT_SEC_BREAK
local dnload = {
label = Widget.Text{
x = __G_INIT_DATA__.CENTER_RIGHT_X,
x = _G_INIT_DATA_.CENTER_RIGHT_X,
y = header.bottom_y,
text = 'Download',
},
@ -49,9 +49,9 @@ local dnload = {
text_color = schema.blue
},
plot = Widget.ScalePlot{
x = __G_INIT_DATA__.CENTER_RIGHT_X,
x = _G_INIT_DATA_.CENTER_RIGHT_X,
y = DOWNLOAD_PLOT_Y,
width = __G_INIT_DATA__.SECTION_WIDTH,
width = _G_INIT_DATA_.SECTION_WIDTH,
height = PLOT_HEIGHT,
y_label_func = __network_label_function
}
@ -62,7 +62,7 @@ local UPLOAD_PLOT_Y = UPLOAD_Y + PLOT_SEC_BREAK
local upload = {
label = Widget.Text{
x = __G_INIT_DATA__.CENTER_RIGHT_X,
x = _G_INIT_DATA_.CENTER_RIGHT_X,
y = UPLOAD_Y,
text = 'Upload',
},
@ -73,9 +73,9 @@ local upload = {
text_color = schema.blue
},
plot = Widget.ScalePlot{
x = __G_INIT_DATA__.CENTER_RIGHT_X,
x = _G_INIT_DATA_.CENTER_RIGHT_X,
y = UPLOAD_PLOT_Y,
width = __G_INIT_DATA__.SECTION_WIDTH,
width = _G_INIT_DATA_.SECTION_WIDTH,
height = PLOT_HEIGHT,
y_label_func = __network_label_function
}

View File

@ -10,14 +10,14 @@ local schema = require 'default_patterns'
local TEXT_SPACING = 20
local header = Widget.Header{
x = __G_INIT_DATA__.RIGHT_X,
y = __G_INIT_DATA__.TOP_Y,
width = __G_INIT_DATA__.SECTION_WIDTH,
x = _G_INIT_DATA_.RIGHT_X,
y = _G_INIT_DATA_.TOP_Y,
width = _G_INIT_DATA_.SECTION_WIDTH,
header = "PACMAN"
}
local labels = Widget.TextColumn{
x = __G_INIT_DATA__.RIGHT_X,
x = _G_INIT_DATA_.RIGHT_X,
y = header.bottom_y,
spacing = TEXT_SPACING,
'Total',
@ -27,7 +27,7 @@ local labels = Widget.TextColumn{
'Local'
}
local info = Widget.TextColumn{
x = __G_INIT_DATA__.RIGHT_X + __G_INIT_DATA__.SECTION_WIDTH,
x = _G_INIT_DATA_.RIGHT_X + _G_INIT_DATA_.SECTION_WIDTH,
y = header.bottom_y,
spacing = TEXT_SPACING,
x_align = 'right',

View File

@ -25,17 +25,17 @@ local __calculate_power = function(cr, prev_cnt, cnt, update_frequency)
end
local header = Widget.Header{
x = __G_INIT_DATA__.RIGHT_X,
x = _G_INIT_DATA_.RIGHT_X,
y = MODULE_Y,
width = __G_INIT_DATA__.SECTION_WIDTH,
width = _G_INIT_DATA_.SECTION_WIDTH,
header = 'POWER'
}
local RIGHT_X = __G_INIT_DATA__.RIGHT_X + __G_INIT_DATA__.SECTION_WIDTH
local RIGHT_X = _G_INIT_DATA_.RIGHT_X + _G_INIT_DATA_.SECTION_WIDTH
local pp01 = {
labels = Widget.TextColumn{
x = __G_INIT_DATA__.RIGHT_X,
x = _G_INIT_DATA_.RIGHT_X,
y = header.bottom_y,
spacing = TEXT_SPACING,
'Core',
@ -55,7 +55,7 @@ local pp01 = {
local SEP_Y = header.bottom_y + TEXT_SPACING + SEPARATOR_SPACING
local separator = Widget.Line{
p1 = {x = __G_INIT_DATA__.RIGHT_X, y = SEP_Y},
p1 = {x = _G_INIT_DATA_.RIGHT_X, y = SEP_Y},
p2 = {x = RIGHT_X, y = SEP_Y}
}
@ -63,7 +63,7 @@ local PKG0_Y = SEP_Y + SEPARATOR_SPACING
local pkg0 = {
label = Widget.Text{
x = __G_INIT_DATA__.RIGHT_X,
x = _G_INIT_DATA_.RIGHT_X,
y = PKG0_Y,
text = 'PKG 0'
},
@ -76,9 +76,9 @@ local pkg0 = {
append_end = ' W'
},
plot = Widget.ScalePlot{
x = __G_INIT_DATA__.RIGHT_X,
x = _G_INIT_DATA_.RIGHT_X,
y = PKG0_Y + PLOT_SEC_BREAK,
width = __G_INIT_DATA__.SECTION_WIDTH,
width = _G_INIT_DATA_.SECTION_WIDTH,
height = PLOT_HEIGHT,
y_label_func = __power_label_function,
}
@ -88,7 +88,7 @@ local DRAM_Y = PKG0_Y + PLOT_SEC_BREAK * 2 + PLOT_HEIGHT
local dram = {
label = Widget.Text{
x = __G_INIT_DATA__.RIGHT_X,
x = _G_INIT_DATA_.RIGHT_X,
y = DRAM_Y,
text = 'DRAM'
},
@ -101,9 +101,9 @@ local dram = {
append_end = ' W'
},
plot = Widget.ScalePlot{
x = __G_INIT_DATA__.RIGHT_X,
x = _G_INIT_DATA_.RIGHT_X,
y = DRAM_Y + PLOT_SEC_BREAK,
width = __G_INIT_DATA__.SECTION_WIDTH,
width = _G_INIT_DATA_.SECTION_WIDTH,
height = PLOT_HEIGHT,
y_label_func = __power_label_function,
}
@ -113,7 +113,7 @@ local BATTERY_DRAW_Y = DRAM_Y + PLOT_SEC_BREAK * 2 + PLOT_HEIGHT
local battery_draw = {
label = Widget.Text{
x = __G_INIT_DATA__.RIGHT_X,
x = _G_INIT_DATA_.RIGHT_X,
y = BATTERY_DRAW_Y,
spacing = TEXT_SPACING,
text = 'Battery Draw'
@ -124,9 +124,9 @@ local battery_draw = {
x_align = 'right',
},
plot = Widget.ScalePlot{
x = __G_INIT_DATA__.RIGHT_X,
x = _G_INIT_DATA_.RIGHT_X,
y = BATTERY_DRAW_Y + PLOT_SEC_BREAK,
width = __G_INIT_DATA__.SECTION_WIDTH,
width = _G_INIT_DATA_.SECTION_WIDTH,
height = PLOT_HEIGHT,
y_label_func = __power_label_function,
}

View File

@ -23,18 +23,18 @@ for r = 1, NUM_ROWS do
TABLE_CONKY[3][r] = '${top cpu '..r..'}'
end
local MODULE_Y_ = 636
local DIAL_INNER_RADIUS_ = 30
local DIAL_OUTER_RADIUS_ = 42
local DIAL_SPACING_ = 1
local TEXT_Y_OFFSET_ = 15
local SEPARATOR_SPACING_ = 20
local PLOT_SECTION_BREAK_ = 23
local PLOT_HEIGHT_ = 56
local TABLE_SECTION_BREAK_ = 20
local TABLE_HEIGHT_ = 114
local _MODULE_Y_ = 636
local _DIAL_INNER_RADIUS_ = 30
local _DIAL_OUTER_RADIUS_ = 42
local _DIAL_SPACING_ = 1
local _TEXT_Y_OFFSET_ = 15
local _SEPARATOR_SPACING_ = 20
local _PLOT_SECTION_BREAK_ = 23
local _PLOT_HEIGHT_ = 56
local _TABLE_SECTION_BREAK_ = 20
local _TABLE_HEIGHT_ = 114
local create_core_ = function(cores, id, x, y)
local _create_core_ = function(cores, id, x, y)
local conky_threads = {}
for c = 0, NUM_PHYSICAL_CORES * NUM_PHYSICAL_CORE_THREADS - 1 do
@ -52,16 +52,16 @@ local create_core_ = function(cores, id, x, y)
dials = Widget.CompoundDial{
x = x,
y = y,
inner_radius = DIAL_INNER_RADIUS_,
outer_radius = DIAL_OUTER_RADIUS_,
spacing = DIAL_SPACING_,
inner_radius = _DIAL_INNER_RADIUS_,
outer_radius = _DIAL_OUTER_RADIUS_,
spacing = _DIAL_SPACING_,
num_dials = NUM_PHYSICAL_CORE_THREADS,
critical_limit = '>0.8'
},
inner_ring = Widget.Arc{
x = x,
y = y,
radius = DIAL_INNER_RADIUS_ - 2,
radius = _DIAL_INNER_RADIUS_ - 2,
theta0 = 0,
theta1 = 360
},
@ -79,88 +79,86 @@ local create_core_ = function(cores, id, x, y)
end
local header = Widget.Header{
x = __G_INIT_DATA__.LEFT_X,
y = MODULE_Y_,
width = __G_INIT_DATA__.SECTION_WIDTH,
x = _G_INIT_DATA_.LEFT_X,
y = _MODULE_Y_,
width = _G_INIT_DATA_.SECTION_WIDTH,
header = "PROCESSOR"
}
local HEADER_BOTTOM_Y_ = header.bottom_y
--we assume that this cpu has 4 physical cores with 2 logical each
local cores = {}
for c = 0, NUM_PHYSICAL_CORES - 1 do
local dial_x = __G_INIT_DATA__.LEFT_X + DIAL_OUTER_RADIUS_ + (__G_INIT_DATA__.SECTION_WIDTH - 2 * DIAL_OUTER_RADIUS_) * c / 3
create_core_(cores, c, dial_x, HEADER_BOTTOM_Y_ + DIAL_OUTER_RADIUS_)
local dial_x = _G_INIT_DATA_.LEFT_X + _DIAL_OUTER_RADIUS_ +
(_G_INIT_DATA_.SECTION_WIDTH - 2 * _DIAL_OUTER_RADIUS_) * c / 3
local dial_y = header.bottom_y + _DIAL_OUTER_RADIUS_
_create_core_(cores, c, dial_x, dial_y)
end
local RIGHT_X = __G_INIT_DATA__.LEFT_X + __G_INIT_DATA__.SECTION_WIDTH
local _RIGHT_X_ = _G_INIT_DATA_.LEFT_X + _G_INIT_DATA_.SECTION_WIDTH
local PROCESS_Y = HEADER_BOTTOM_Y_ + DIAL_OUTER_RADIUS_ * 2 + PLOT_SECTION_BREAK_
local _PROCESS_Y_ = header.bottom_y + _DIAL_OUTER_RADIUS_ * 2 + _PLOT_SECTION_BREAK_
local process = {
labels = Widget.Text{
x = __G_INIT_DATA__.LEFT_X,
y = PROCESS_Y,
x = _G_INIT_DATA_.LEFT_X,
y = _PROCESS_Y_,
text = 'R | S | D | T | Z'
},
values = Widget.Text{
x = RIGHT_X,
y = PROCESS_Y,
x = _RIGHT_X_,
y = _PROCESS_Y_,
x_align = 'right',
text_color = schema.blue,
text = '<R.S.D.T.Z>'
}
}
local SEP_Y = PROCESS_Y + SEPARATOR_SPACING_
local _SEP_Y_ = _PROCESS_Y_ + _SEPARATOR_SPACING_
local separator = Widget.Line{
p1 = {x = __G_INIT_DATA__.LEFT_X, y = SEP_Y},
p2 = {x = RIGHT_X, y = SEP_Y}
p1 = {x = _G_INIT_DATA_.LEFT_X, y = _SEP_Y_},
p2 = {x = _RIGHT_X_, y = _SEP_Y_}
}
local LOAD_Y = SEP_Y + SEPARATOR_SPACING_
local _LOAD_Y_ = _SEP_Y_ + _SEPARATOR_SPACING_
local total_load = {
label = Widget.Text{
x = __G_INIT_DATA__.LEFT_X,
y = LOAD_Y,
x = _G_INIT_DATA_.LEFT_X,
y = _LOAD_Y_,
text = 'Total Load'
},
value = Widget.CriticalText{
x = RIGHT_X,
y = LOAD_Y,
x = _RIGHT_X_,
y = _LOAD_Y_,
x_align = 'right',
append_end = '%',
critical_limit = '>80'
}
}
local PLOT_Y = LOAD_Y + PLOT_SECTION_BREAK_
local _PLOT_Y_ = _LOAD_Y_ + _PLOT_SECTION_BREAK_
local plot = Widget.LabelPlot{
x = __G_INIT_DATA__.LEFT_X,
y = PLOT_Y,
width = __G_INIT_DATA__.SECTION_WIDTH,
height = PLOT_HEIGHT_
x = _G_INIT_DATA_.LEFT_X,
y = _PLOT_Y_,
width = _G_INIT_DATA_.SECTION_WIDTH,
height = _PLOT_HEIGHT_
}
local TABLE_Y = PLOT_Y + PLOT_HEIGHT_ + TABLE_SECTION_BREAK_
local tbl = Widget.Table{
x = __G_INIT_DATA__.LEFT_X,
y = TABLE_Y,
width = __G_INIT_DATA__.SECTION_WIDTH,
height = TABLE_HEIGHT_,
x = _G_INIT_DATA_.LEFT_X,
y = _PLOT_Y_ + _PLOT_HEIGHT_ + _TABLE_SECTION_BREAK_,
width = _G_INIT_DATA_.SECTION_WIDTH,
height = _TABLE_HEIGHT_,
num_rows = NUM_ROWS,
'Name',
'PID',
'CPU (%)'
}
local __update = function(cr)
local update = function(cr)
local conky = util.conky
local char_count = util.char_count
@ -202,27 +200,25 @@ end
Widget = nil
schema = nil
MODULE_Y_ = nil
DIAL_INNER_RADIUS_ = nil
DIAL_OUTER_RADIUS_ = nil
DIAL_SPACING_ = nil
TEXT_Y_OFFSET_ = nil
SEPARATOR_SPACING_ = nil
PLOT_SECTION_BREAK_ = nil
PLOT_HEIGHT_ = nil
TABLE_SECTION_BREAK_ = nil
TABLE_HEIGHT_ = nil
create_core_ = nil
HEADER_BOTTOM_Y_ = nil
LOAD_Y = nil
RIGHT_X = nil
SEP_Y = nil
PROCESS_Y = nil
PLOT_Y = nil
TABLE_Y = nil
_MODULE_Y_ = nil
_DIAL_INNER_RADIUS_ = nil
_DIAL_OUTER_RADIUS_ = nil
_DIAL_SPACING_ = nil
_TEXT_Y_OFFSET_ = nil
_SEPARATOR_SPACING_ = nil
_PLOT_SECTION_BREAK_ = nil
_PLOT_HEIGHT_ = nil
_TABLE_SECTION_BREAK_ = nil
_TABLE_HEIGHT_ = nil
_create_core_ = nil
_LOAD_Y_ = nil
_RIGHT_X_ = nil
_SEP_Y_ = nil
_PROCESS_Y_ = nil
_PLOT_Y_ = nil
local draw = function(cr, current_interface)
__update(cr)
update(cr)
if current_interface == 0 then
Text.draw(header.text, cr)

View File

@ -45,19 +45,19 @@ local __io_label_function = function(bytes)
end
local header = Widget.Header{
x = __G_INIT_DATA__.CENTER_LEFT_X,
y = __G_INIT_DATA__.TOP_Y,
width = __G_INIT_DATA__.SECTION_WIDTH,
x = _G_INIT_DATA_.CENTER_LEFT_X,
y = _G_INIT_DATA_.TOP_Y,
width = _G_INIT_DATA_.SECTION_WIDTH,
header = "INPUT / OUTPUT"
}
local HEADER_BOTTOM_Y = header.bottom_y
local RIGHT_X = __G_INIT_DATA__.CENTER_LEFT_X + __G_INIT_DATA__.SECTION_WIDTH
local RIGHT_X = _G_INIT_DATA_.CENTER_LEFT_X + _G_INIT_DATA_.SECTION_WIDTH
local READS_PLOT_Y = header.bottom_y + PLOT_SEC_BREAK
local reads = {
label = Widget.Text{
x = __G_INIT_DATA__.CENTER_LEFT_X,
x = _G_INIT_DATA_.CENTER_LEFT_X,
y = HEADER_BOTTOM_Y,
text = 'Reads',
},
@ -69,9 +69,9 @@ local reads = {
text_color = schema.blue
},
plot = Widget.ScalePlot{
x = __G_INIT_DATA__.CENTER_LEFT_X,
x = _G_INIT_DATA_.CENTER_LEFT_X,
y = READS_PLOT_Y,
width = __G_INIT_DATA__.SECTION_WIDTH,
width = _G_INIT_DATA_.SECTION_WIDTH,
height = PLOT_HEIGHT,
y_label_func = __io_label_function,
}
@ -82,7 +82,7 @@ local WRITES_PLOT_Y = WRITE_Y + PLOT_SEC_BREAK
local writes = {
label = Widget.Text{
x = __G_INIT_DATA__.CENTER_LEFT_X,
x = _G_INIT_DATA_.CENTER_LEFT_X,
y = WRITE_Y,
text = 'Writes',
},
@ -94,9 +94,9 @@ local writes = {
text_color = schema.blue
},
plot = Widget.ScalePlot{
x = __G_INIT_DATA__.CENTER_LEFT_X,
x = _G_INIT_DATA_.CENTER_LEFT_X,
y = WRITES_PLOT_Y,
width = __G_INIT_DATA__.SECTION_WIDTH,
width = _G_INIT_DATA_.SECTION_WIDTH,
height = PLOT_HEIGHT,
y_label_func = __io_label_function,
}

View File

@ -17,14 +17,14 @@ local SYNC_CMD = "sed -n '/ synchronizing package lists/p' /var/log/pacman.log |
local TEXT_SPACING = 20
local header = Widget.Header{
x = __G_INIT_DATA__.LEFT_X,
y = __G_INIT_DATA__.TOP_Y,
width = __G_INIT_DATA__.SECTION_WIDTH,
x = _G_INIT_DATA_.LEFT_X,
y = _G_INIT_DATA_.TOP_Y,
width = _G_INIT_DATA_.SECTION_WIDTH,
header = "SYSTEM"
}
local labels = Widget.TextColumn{
x = __G_INIT_DATA__.LEFT_X,
x = _G_INIT_DATA_.LEFT_X,
y = header.bottom_y,
spacing = TEXT_SPACING,
'Kernel',
@ -33,7 +33,7 @@ local labels = Widget.TextColumn{
'Last Sync'
}
local info = Widget.TextColumn{
x = __G_INIT_DATA__.LEFT_X + __G_INIT_DATA__.SECTION_WIDTH,
x = _G_INIT_DATA_.LEFT_X + _G_INIT_DATA_.SECTION_WIDTH,
y = header.bottom_y,
spacing = TEXT_SPACING,
x_align = 'right',

View File

@ -20,7 +20,7 @@ local SECTIONS = 8
local WEATHER_UPDATE_INTERVAL = 900
local WEATHER_PATH = '/tmp/weather.json'
local ICON_PATH = __G_INIT_DATA__.ABS_PATH .. '/images/weather/'
local ICON_PATH = _G_INIT_DATA_.ABS_PATH .. '/images/weather/'
local RECENTLY_UPDATED_PATH = '/tmp/weather_recently_updated'
local NA = 'N/A'
local NA_IMAGE_PATH = ICON_PATH .. 'na.png'
@ -46,7 +46,7 @@ local __create_side_section = function(x_offset, y_offset, section_table)
}
current_widget.period = Widget.Text{
x = x_offset + __G_INIT_DATA__.SECTION_WIDTH,
x = x_offset + _G_INIT_DATA_.SECTION_WIDTH,
y = current_y,
x_align = 'right',
text_color = schema.blue
@ -84,7 +84,7 @@ local __create_side_section = function(x_offset, y_offset, section_table)
}
current_widget.info_column = Widget.TextColumn{
x = x_offset + __G_INIT_DATA__.SECTION_WIDTH,
x = x_offset + _G_INIT_DATA_.SECTION_WIDTH,
y = current_y + HEADER_PAD + 10,
spacing = SPACING,
x_align = 'right',
@ -99,7 +99,7 @@ local __create_side_section = function(x_offset, y_offset, section_table)
y = current_y + SECTION_HEIGHT - 18
},
p2 = {
x = x_offset + __G_INIT_DATA__.SECTION_WIDTH,
x = x_offset + _G_INIT_DATA_.SECTION_WIDTH,
y = current_y + SECTION_HEIGHT - 18
},
line_pattern = schema.mid_grey
@ -111,34 +111,34 @@ end
--LEFT
local left = {
header = Widget.Header{
x = __G_INIT_DATA__.LEFT_X,
y = __G_INIT_DATA__.TOP_Y,
width = __G_INIT_DATA__.SECTION_WIDTH,
x = _G_INIT_DATA_.LEFT_X,
y = _G_INIT_DATA_.TOP_Y,
width = _G_INIT_DATA_.SECTION_WIDTH,
header = 'HOURLY FORECAST'
},
hours = {}
}
__create_side_section(__G_INIT_DATA__.LEFT_X, left.header.bottom_y, left.hours)
__create_side_section(_G_INIT_DATA_.LEFT_X, left.header.bottom_y, left.hours)
--CENTER
local center = {}
center.header = Widget.Header{
x = __G_INIT_DATA__.CENTER_LEFT_X,
y = __G_INIT_DATA__.TOP_Y,
width = __G_INIT_DATA__.CENTER_WIDTH,
x = _G_INIT_DATA_.CENTER_LEFT_X,
y = _G_INIT_DATA_.TOP_Y,
width = _G_INIT_DATA_.CENTER_WIDTH,
header = 'CURRENT CONDITIONS'
}
center.current_desc = Widget.Text{
x = __G_INIT_DATA__.CENTER_LEFT_X,
x = _G_INIT_DATA_.CENTER_LEFT_X,
y = center.header.bottom_y + 8,
text_color = schema.blue,
font_size = 24
}
local CENTER_X_1 = __G_INIT_DATA__.CENTER_LEFT_X + __G_INIT_DATA__.SECTION_WIDTH * 0.25
local CENTER_X_1 = _G_INIT_DATA_.CENTER_LEFT_X + _G_INIT_DATA_.SECTION_WIDTH * 0.25
local CENTER_ICON_WIDTH = 120
local CENTER_ICON_Y = center.header.bottom_y + 105 - CENTER_ICON_WIDTH / 2
@ -149,7 +149,7 @@ center.icon = Widget.ScaledImage{
height = CENTER_ICON_WIDTH
}
local CENTER_X_2 = __G_INIT_DATA__.CENTER_LEFT_X + __G_INIT_DATA__.SECTION_WIDTH * 0.70
local CENTER_X_2 = _G_INIT_DATA_.CENTER_LEFT_X + _G_INIT_DATA_.SECTION_WIDTH * 0.70
local INFO_Y = center.header.bottom_y + 70
center.current_temp = Widget.Text{
@ -178,7 +178,7 @@ local COLUMN_PADDING = 15
local CENTER_SPACING = SPACING + 7
center.label_column_1 = Widget.TextColumn{
x = __G_INIT_DATA__.CENTER_RIGHT_X,
x = _G_INIT_DATA_.CENTER_RIGHT_X,
y = center.header.bottom_y,
spacing = CENTER_SPACING,
font_size = 14,
@ -192,7 +192,7 @@ center.label_column_1 = Widget.TextColumn{
}
center.info_column_1 = Widget.TextColumn{
x = __G_INIT_DATA__.CENTER_RIGHT_X + (__G_INIT_DATA__.SECTION_WIDTH - COLUMN_PADDING) / 2,
x = _G_INIT_DATA_.CENTER_RIGHT_X + (_G_INIT_DATA_.SECTION_WIDTH - COLUMN_PADDING) / 2,
y = center.header.bottom_y,
x_align = 'right',
text_color = schema.blue,
@ -202,7 +202,7 @@ center.info_column_1 = Widget.TextColumn{
}
center.label_column_2 = Widget.TextColumn{
x = __G_INIT_DATA__.CENTER_RIGHT_X + (__G_INIT_DATA__.SECTION_WIDTH + COLUMN_PADDING) / 2,
x = _G_INIT_DATA_.CENTER_RIGHT_X + (_G_INIT_DATA_.SECTION_WIDTH + COLUMN_PADDING) / 2,
y = center.header.bottom_y,
spacing = CENTER_SPACING,
font_size = 14,
@ -216,7 +216,7 @@ center.label_column_2 = Widget.TextColumn{
}
center.info_column_2 = Widget.TextColumn{
x = __G_INIT_DATA__.CENTER_RIGHT_X + __G_INIT_DATA__.SECTION_WIDTH,
x = _G_INIT_DATA_.CENTER_RIGHT_X + _G_INIT_DATA_.SECTION_WIDTH,
y = center.header.bottom_y,
x_align = 'right',
text_color = schema.blue,
@ -229,15 +229,15 @@ center.info_column_2 = Widget.TextColumn{
local right = {
header = Widget.Header{
x = __G_INIT_DATA__.RIGHT_X,
y = __G_INIT_DATA__.TOP_Y,
width = __G_INIT_DATA__.SECTION_WIDTH,
x = _G_INIT_DATA_.RIGHT_X,
y = _G_INIT_DATA_.TOP_Y,
width = _G_INIT_DATA_.SECTION_WIDTH,
header = '8 DAY FORECAST'
},
days = {}
}
__create_side_section(__G_INIT_DATA__.RIGHT_X, right.header.bottom_y, right.days)
__create_side_section(_G_INIT_DATA_.RIGHT_X, right.header.bottom_y, right.days)
Widget = nil
schema = nil