Skip to content

Commit

Permalink
#44 fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
dollplayer2501 committed Jan 9, 2024
1 parent 42a07b2 commit f24f5c1
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 36 deletions.
4 changes: 3 additions & 1 deletion angle_minus_five_degrees.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function conky_main()
FONT_SIZE = 64,
FONT_FACE = global_const.FONT_FACE_2_1,
FONT_WEIGHT = CAIRO_FONT_WEIGHT_NORMAL,
MARGIN = 40,
MARGIN = 60,
}

TODAY_WIDTH['WIDTH'] = getting_text_width(cr_draw,
Expand Down Expand Up @@ -396,6 +396,8 @@ function conky_main()
global_config.filesystem.device, global_conky_parse, global_const.USAGE_LIMIT,
-- display global ip address
cfg.display_global_ip_address,
-- display swap
cfg.display_swap,
-- position
cfg.position_x, cfg.position_y, cfg.position_align,
-- large font
Expand Down
5 changes: 5 additions & 0 deletions config-sample.lua
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,10 @@ function get_config()
-- Device files subject to file writing/reading speeds
device = '/dev/sda2',
},

--
-- Swap
--
display_swap = true,
}
end
2 changes: 2 additions & 0 deletions config/text_detail.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ function get_config_text_detail(_const, _config)
return {
-- display global ip address
display_global_ip_address = _config.display_global_ip_address,
-- display swap
display_swap = _config.display_swap,

-- position
position_x = _const.CENTER_POSITION.THEME.X,
Expand Down
33 changes: 20 additions & 13 deletions includes/conky_parse.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,26 @@ function get_conky_parse()
diskio_read = conky_parse('${diskio_read '.. config.filesystem.device .. '}'),

top = {
name1 = conky_parse("${top name 1}"),
name2 = conky_parse("${top name 2}"),
name3 = conky_parse("${top name 3}"),
name4 = conky_parse("${top name 4}"),
name5 = conky_parse("${top name 5}"),
name6 = conky_parse("${top name 6}"),

cpu1 = conky_parse("${top cpu 1}"),
cpu2 = conky_parse("${top cpu 2}"),
cpu3 = conky_parse("${top cpu 3}"),
cpu4 = conky_parse("${top cpu 4}"),
cpu5 = conky_parse("${top cpu 5}"),
cpu6 = conky_parse("${top cpu 6}"),
name1 = conky_parse('${top name 1}'),
name2 = conky_parse('${top name 2}'),
name3 = conky_parse('${top name 3}'),
name4 = conky_parse('${top name 4}'),
name5 = conky_parse('${top name 5}'),
name6 = conky_parse('${top name 6}'),

cpu1 = conky_parse('${top cpu 1}'),
cpu2 = conky_parse('${top cpu 2}'),
cpu3 = conky_parse('${top cpu 3}'),
cpu4 = conky_parse('${top cpu 4}'),
cpu5 = conky_parse('${top cpu 5}'),
cpu6 = conky_parse('${top cpu 6}'),
},

swap = {
swap = conky_parse('${swap}'),
swapfree = conky_parse('${swapfree}'),
swapmax = conky_parse('${swapmax}'),
swapperc = conky_parse('${swapperc}'),
},

conky_version = triming(conky_parse('${conky_version}')),
Expand Down
105 changes: 83 additions & 22 deletions modules/text_detail.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ function drawing_text_detail(_context, _conky_parse_updates,
_const_disk_device, _conky_parse, _usage_limit,
-- display global ip address
_display_global_ip_address,
-- display swap
_display_swap,
-- position
_position_x, _position_y, _position_align,
-- large font
Expand Down Expand Up @@ -304,68 +306,126 @@ function drawing_text_detail(_context, _conky_parse_updates,


--
-- Memory Usage
-- Memory and Swap Usage
--

idx = idx + 1
_drawing_text_with_properties_align_right(_context, _position_align,
_position_x + _adjust_x_normal,
_position_y + _adjust_y_normal + (_gap_y_normal * idx),
_font_size_normal, {
tmp_array = {
{
_text = string.format('%s',
'Memory is'
),
_font_face = _font_face_normal,
_font_weight = CAIRO_FONT_WEIGHT_NORMAL,
_font_color = _color_detail.body_normal
}, {
_text = string.format(' %s',
_conky_parse.mem
),
_font_face = _font_face_large,
_font_weight = CAIRO_FONT_WEIGHT_NORMAL,
_font_color = _usage_limit.MEMORY < tonumber(_conky_parse.memperc)
and _color_detail.body_strike or _color_detail.body_normal
}, {
_text = string.format('%s',
'/'
),
_font_face = _font_face_normal,
_font_weight = CAIRO_FONT_WEIGHT_NORMAL,
_font_color = _color_detail.body_normal
}, {
_text = string.format('%s',
_conky_parse.memmax
),
_font_face = _font_face_large,
_font_weight = CAIRO_FONT_WEIGHT_NORMAL,
_font_color = _usage_limit.MEMORY < tonumber(_conky_parse.memperc)
and _color_detail.body_strike or _color_detail.body_normal
}, {
_text = string.format('%s',
','
),
_font_face = _font_face_normal,
_font_weight = CAIRO_FONT_WEIGHT_NORMAL,
_font_color = _color_detail.body_normal
}, {
_text = string.format(' %s%%',
_conky_parse.memperc
),
_font_face = _font_face_large,
_font_weight = CAIRO_FONT_WEIGHT_NORMAL,
_font_color = _usage_limit.MEMORY < tonumber(_conky_parse.memperc)
and _color_detail.body_strike or _color_detail.body_normal
}, {
_text = string.format(' %s',
'used'
),
_font_face = _font_face_normal,
_font_weight = CAIRO_FONT_WEIGHT_NORMAL,
_font_color = _color_detail.body_normal
}
}

if true == _display_swap then

tmp_array = appendding_array_table(tmp_array, {
{
_text = string.format('%s',
'Memory is'
', Swap is'
),
_font_face = _font_face_normal,
_font_weight = CAIRO_FONT_WEIGHT_NORMAL,
_font_color = _color_detail.body_normal
}, {
_text = string.format(' %s',
_conky_parse.mem
_conky_parse.swap.swap
),
_font_face = _font_face_large,
_font_weight = CAIRO_FONT_WEIGHT_NORMAL,
_font_color = _usage_limit.MEMORY < tonumber(_conky_parse.memperc)
and _color_detail.body_strike or _color_detail.body_normal
_font_color = _color_detail.body_normal
}, {
_text = string.format('%s',
'/'
','
),
_font_face = _font_face_normal,
_font_weight = CAIRO_FONT_WEIGHT_NORMAL,
_font_color = _color_detail.body_normal
}, {
_text = string.format('%s',
_conky_parse.memmax
_text = string.format(' %s%%',
_conky_parse.swap.swapperc
),
_font_face = _font_face_large,
_font_weight = CAIRO_FONT_WEIGHT_NORMAL,
_font_color = _usage_limit.MEMORY < tonumber(_conky_parse.memperc)
and _color_detail.body_strike or _color_detail.body_normal
_font_color = _color_detail.body_normal
}, {
_text = string.format('%s',
','
_text = string.format(' %s',
'used,'
),
_font_face = _font_face_normal,
_font_weight = CAIRO_FONT_WEIGHT_NORMAL,
_font_color = _color_detail.body_normal
}, {
_text = string.format(' %s%%',
_conky_parse.memperc
_text = string.format(' %s',
_conky_parse.swap.swapfree
),
_font_face = _font_face_large,
_font_weight = CAIRO_FONT_WEIGHT_NORMAL,
_font_color = _usage_limit.MEMORY < tonumber(_conky_parse.memperc)
and _color_detail.body_strike or _color_detail.body_normal
_font_color = _color_detail.body_normal
}, {
_text = string.format(' %s',
'used'
'free'
),
_font_face = _font_face_normal,
_font_weight = CAIRO_FONT_WEIGHT_NORMAL,
_font_color = _color_detail.body_normal
}
})
end

idx = idx + 1
_drawing_text_with_properties_align_right(_context, _position_align,
_position_x + _adjust_x_normal,
_position_y + _adjust_y_normal + (_gap_y_normal * idx),
_font_size_normal, tmp_array)


--
Expand Down Expand Up @@ -494,6 +554,7 @@ function drawing_text_detail(_context, _conky_parse_updates,
_position_y + _adjust_y_normal + (_gap_y_normal * idx),
_font_size_normal, tmp_array)


--
-- Disk info, Strage, Disk I/O
--
Expand Down

0 comments on commit f24f5c1

Please sign in to comment.