diff --git a/core b/core index b103435..f15bbe1 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit b1034354e38299cf997ddface80aaf43a4de8523 +Subproject commit f15bbe1bb31f75aad4b49566a11092e25a559205 diff --git a/drawing/Common.lua b/drawing/Common.lua index d0dac51..2f87110 100644 --- a/drawing/Common.lua +++ b/drawing/Common.lua @@ -17,6 +17,18 @@ local HEADER_UNDERLINE_CAP = CAIRO_LINE_CAP_ROUND local HEADER_UNDERLINE_OFFSET = -20 local HEADER_UNDERLINE_THICKNESS = 3 +M.make_font_spec = function(f, s, bold) + return { + family = f, + size = s, + weight = bold and CAIRO_FONT_WEIGHT_BOLD or CAIRO_FONT_WEIGHT_NORMAL, + slant = CAIRO_FONT_WEIGHT_NORMAL, + } +end + +M.normal_font_spec = M.make_font_spec(_G_Patterns_.FONT, 13, false) +M.label_font_spec = M.make_font_spec(_G_Patterns_.FONT, 8, false) + -------------------------------------------------------------------------------- -- header @@ -30,12 +42,13 @@ M.Header = function(x, y, w, s) x = x, y = y, text = s, - font_size = HEADER_FONT_SIZE, + font_spec = M.make_font_spec(_G_Patterns_.FONT, HEADER_FONT_SIZE, true), + -- font_size = HEADER_FONT_SIZE, x_align = 'left', y_align = 'top', text_color = _G_Patterns_.HEADER_FG, - slant = HEADER_FONT_SLANT, - weight = HEADER_FONT_WEIGHT + -- slant = HEADER_FONT_SLANT, + -- weight = HEADER_FONT_WEIGHT }, bottom_y = bottom_y, underline = _G_Widget_.Line{ @@ -69,6 +82,7 @@ M.initThemedLabelPlot = function(x, y, w, h) data_line_pattern = _G_Patterns_.PLOT_FILL_BORDER_PRIMARY, data_fill_pattern = _G_Patterns_.PLOT_FILL_BG_PRIMARY, label_color = _G_Patterns_.INACTIVE_TEXT_FG, + label_font_spec = M.label_font_spec, } end @@ -82,6 +96,7 @@ M.initPercentPlot = function(x, y, w, h, spacing, label) y = y, text = label, text_color = _G_Patterns_.INACTIVE_TEXT_FG, + font_spec = M.normal_font_spec, }, value = _G_Widget_.CriticalText{ x = x + w, @@ -91,6 +106,7 @@ M.initPercentPlot = function(x, y, w, h, spacing, label) critical_limit = '>80', text_color = _G_Patterns_.PRIMARY_FG, critical_color = _G_Patterns_.PRIMARY_FG, + font_spec = M.normal_font_spec, }, plot = M.initThemedLabelPlot(x, y + spacing, w, h), } @@ -126,6 +142,7 @@ M.initThemedScalePlot = function(x, y, w, h, f) data_line_pattern = _G_Patterns_.PLOT_FILL_BORDER_PRIMARY, data_fill_pattern = _G_Patterns_.PLOT_FILL_BG_PRIMARY, label_color = _G_Patterns_.INACTIVE_TEXT_FG, + label_font_spec = M.label_font_spec, } end @@ -139,12 +156,14 @@ M.initLabeledScalePlot = function(x, y, w, h, f, spacing, label) y = y, text = label, text_color = _G_Patterns_.INACTIVE_TEXT_FG, + font_spec = M.normal_font_spec, }, value = _G_Widget_.Text{ x = x + w, y = y, x_align = 'right', - text_color = _G_Patterns_.PRIMARY_FG + text_color = _G_Patterns_.PRIMARY_FG, + font_spec = M.normal_font_spec, }, plot = M.initThemedScalePlot(x, y + spacing, w, h, f), } @@ -194,6 +213,7 @@ M.initTextRing = function(x, y, r, append_end, limit) critical_limit = limit, text_color = _G_Patterns_.PRIMARY_FG, critical_color = _G_Patterns_.CRITICAL_FG, + font_spec = M.normal_font_spec, }, } end @@ -231,6 +251,7 @@ M.initTextRow = function(x, y, w, label) y = y, text_color = _G_Patterns_.INACTIVE_TEXT_FG, text = label, + font_spec = M.normal_font_spec, }, value = _G_Widget_.Text{ x = x + w, @@ -238,6 +259,7 @@ M.initTextRow = function(x, y, w, label) x_align = 'right', text_color = _G_Patterns_.PRIMARY_FG, text = "", + font_spec = M.normal_font_spec, } } end @@ -265,6 +287,7 @@ M.initTextRowCrit = function(x, y, w, label, append_end) y = y, text = label, text_color = _G_Patterns_.INACTIVE_TEXT_FG, + font_spec = M.normal_font_spec, }, value = _G_Widget_.CriticalText{ x = x + w, @@ -274,6 +297,7 @@ M.initTextRowCrit = function(x, y, w, label, append_end) critical_color = _G_Patterns_.CRITICAL_FG, append_end = append_end, text = '', + font_spec = M.normal_font_spec, } } end @@ -298,6 +322,7 @@ M.initTextRows = function(x, y, w, spacing, labels) y = y, spacing = spacing, text_color = _G_Patterns_.INACTIVE_TEXT_FG, + font_spec = M.normal_font_spec, table.unpack(labels), }, values = _G_Widget_.TextColumn{ @@ -306,6 +331,7 @@ M.initTextRows = function(x, y, w, spacing, labels) spacing = spacing, x_align = 'right', text_color = _G_Patterns_.PRIMARY_FG, + font_spec = M.normal_font_spec, num_rows = #labels, } } @@ -337,6 +363,8 @@ M.initTable = function(x, y, w, h, n, labels) header_color = _G_Patterns_.PRIMARY_FG, line_pattern = _G_Patterns_.BORDER_FG, separator_pattern = _G_Patterns_.BORDER_FG, + body_font_spec = M.make_font_spec(_G_Patterns_.FONT, 11, false), + header_font_spec = M.make_font_spec(_G_Patterns_.FONT, 11, false), table.unpack(labels), } end diff --git a/drawing/FileSystem.lua b/drawing/FileSystem.lua index 70f206b..d574986 100644 --- a/drawing/FileSystem.lua +++ b/drawing/FileSystem.lua @@ -62,6 +62,7 @@ local labels = _G_Widget_.TextColumn{ y = _BAR_Y_, spacing = _SPACING_, text_color = _G_Patterns_.INACTIVE_TEXT_FG, + font_spec = Common.normal_font_spec, 'root', 'boot', 'home', @@ -88,7 +89,7 @@ local update = function(cr) end end -local draw_static = function(cr) +M.draw_static = function(cr) Common.drawHeader(cr, header) Common.text_row_draw_static(smart, cr) @@ -98,7 +99,7 @@ local draw_static = function(cr) CompoundBar.draw_static(bars, cr) end -local draw_dynamic = function(cr, trigger) +M.draw_dynamic = function(cr, trigger) if trigger == 0 then update(cr) end Common.text_row_draw_dynamic(smart, cr) @@ -106,7 +107,4 @@ local draw_dynamic = function(cr, trigger) CompoundBar.draw_dynamic(bars, cr) end -M.draw_static = draw_static -M.draw_dynamic = draw_dynamic - return M diff --git a/drawing/Graphics.lua b/drawing/Graphics.lua index 5f57c25..6a2d804 100644 --- a/drawing/Graphics.lua +++ b/drawing/Graphics.lua @@ -135,6 +135,7 @@ local nvidia_off = function(cr) Common.text_rows_set.set(clock_speed, cr, 1, NA) Common.text_rows_set.set(clock_speed, cr, 2, NA) + -- TODO refactor this Text.set(gpu_util.value, cr, NA) Text.set(mem_util.value, cr, NA) Text.set(vid_util.value, cr, NA) diff --git a/drawing/Memory.lua b/drawing/Memory.lua index 4ce634a..f5bbca9 100644 --- a/drawing/Memory.lua +++ b/drawing/Memory.lua @@ -93,25 +93,27 @@ local swap = Common.initTextRowCrit( ) local cache = { - labels = _G_Widget_.TextColumn{ - x = _TEXT_LEFT_X_, - y = _LINE_1_Y_ + _TEXT_SPACING_, - spacing = _TEXT_SPACING_, - text_color = _G_Patterns_.INACTIVE_TEXT_FG, - 'Page Cache', - 'Buffers', - 'Kernel Slab' - }, - percents = _G_Widget_.TextColumn{ - x = _RIGHT_X_, - y = _LINE_1_Y_ + _TEXT_SPACING_, - x_align = 'right', - append_end = ' %', - text_color = _G_Patterns_.SECONDARY_FG, - '', - '', - '' - }, + labels = _G_Widget_.TextColumn{ + x = _TEXT_LEFT_X_, + y = _LINE_1_Y_ + _TEXT_SPACING_, + spacing = _TEXT_SPACING_, + text_color = _G_Patterns_.INACTIVE_TEXT_FG, + font_spec = Common.normal_font_spec, + 'Page Cache', + 'Buffers', + 'Kernel Slab' + }, + percents = _G_Widget_.TextColumn{ + x = _RIGHT_X_, + y = _LINE_1_Y_ + _TEXT_SPACING_, + x_align = 'right', + append_end = ' %', + text_color = _G_Patterns_.SECONDARY_FG, + font_spec = Common.normal_font_spec, + '', + '', + '' + }, } local _PLOT_Y_ = _PLOT_SECTION_BREAK_ + header.bottom_y + DIAL_RADIUS * 2 diff --git a/schema/Patterns.lua b/schema/Patterns.lua index 1a0f0e6..5a50cbb 100644 --- a/schema/Patterns.lua +++ b/schema/Patterns.lua @@ -3,6 +3,7 @@ local M = {} local Color = require 'Color' local Util = require 'Util' +M.FONT = 'Neuropolitical' -- text colors M.HEADER_FG = Color.init{hex_rgba = 0xffffff}