-
Notifications
You must be signed in to change notification settings - Fork 0
/
cpu-panel.lua
118 lines (98 loc) · 3.51 KB
/
cpu-panel.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
--[[
# **********************************************************************
# Conky Panels / CPU
#
# A simple display panel to monitor CPU performance.
#
# Author: Vladislav Dmitrievich Turbanov
# Repository: https://github.com/vladipus/conky-panels
# License: BSD
#
# Some elements were based on this theme:
# http://www.teejeetech.in/2014/07/my-conky-themes-update-2.html
# **********************************************************************
This is needed to be detected in the "Conky Manager" app:
TEXT
]]
require(".common")
conky.config={
-- Positioning
alignment=ref_alignment,
gap_x=ref_pos_x,
gap_y=ref_pos_y,
}
-- Merge common options.
for k,v in pairs(common_config) do conky.config[k] = v end
-- The top CPU bar.
local bar_template = [[
${color &{brand}}CPU ${color &{main}} ${cpu cpu0}% ${cpubar cpu0 10,}
]]
conky.text = bar_template
-- The main CPU graph.
local graph_template = [[
${color &{main}}\
${cpugraph 100,400 &{brand} &{main}}\
${voffset -88}${goto 20}\
${color &{dimmed}}Overall
${voffset -21}${alignr 4}${font &{font}:size=24}\
${color &{brand}}${hwmon temp 1}°\
${font}${voffset 75}
]]
conky.text = conky.text .. graph_template
-- The temperatures of individual cores (not used).
local core_temperatures_template = [[
${color &{brand}}${exec cat /sys/devices/platform/coretemp.0/hwmon/hwmon0/temp2_label}${color &{main}} \
${hwmon temp 2}° \
${color &{brand}}${exec cat /sys/devices/platform/coretemp.0/hwmon/hwmon0/temp3_label}${color &{main}} \
${hwmon temp 3}° \
${color &{brand}}${exec cat /sys/devices/platform/coretemp.0/hwmon/hwmon0/temp4_label}${color &{main}} \
${hwmon temp 4}° \
${color &{brand}}${exec cat /sys/devices/platform/coretemp.0/hwmon/hwmon0/temp5_label}${color &{main}} \
${hwmon temp 5}°
]]
-- Individual Cores --
-- The graphs for individual cores.
local core_graphs_template = [[
${voffset -19}\
${color &{main}}\
${cpugraph cpu&{index1} 50,100 &{brand} &{main}}\
${cpugraph cpu&{index2} 50,100 &{brand} &{main}}\
${cpugraph cpu&{index3} 50,100 &{brand} &{main}}\
${cpugraph cpu&{index4} 50,100 &{brand} &{main}}\
${voffset -58}
${color &{dimmed}}\
${goto 20}Core &{index1}\
${goto 120}Core &{index2}\
${goto 220}Core &{index3}\
${goto 320}Core &{index4}\
${voffset 39}
]]
-- First four cores. Comment-out if not needed.
conky.text = conky.text .. (core_graphs_template % {index1='1', index2='2', index3='3', index4='4'})
-- Last four cores. Comment-out if not needed.
conky.text = conky.text .. (core_graphs_template % {index1='5', index2='6', index3='7', index4='8'})
-- The frequencies of individual cores (not used).
local core_frequencies_template = [[
${color &{brand}}\
${voffset -108}\
${goto 51}${freq_g 1}GHz ${goto 151}${freq_g 2}GHz ${goto 251}${freq_g 3}GHz ${goto 351}${freq_g 4}GHz
${voffset 13}\
${goto 51}${freq_g 5}GHz ${goto 151}${freq_g 6}GHz ${goto 251}${freq_g 7}GHz ${goto 351}${freq_g 8}GHz
]]
-- The top processes.
local top_template = [[
${color &{main}}${top name 1}${color &{brand}}${alignr 200}${top cpu 1}%
${color &{main}}${top name 3}${color &{brand}}${alignr 200}${top cpu 3}%
${voffset -38}\
${goto 220}${color &{main}}${top name 2}${color &{brand}}${alignr}${top cpu 2}%
${goto 220}${color &{main}}${top name 4}${color &{brand}}${alignr}${top cpu 4}%
]]
conky.text = conky.text .. top_template
-- Bottom Padding --
-- Decrease the value after 'voffset' to bring the border up.
conky.text = conky.text .. "${voffset -82}"
-- The resulting template should be in this variable.
conky.text =
(
conky.text
) % {font=font, brand=brand_color, main=main_color, dimmed=dimmed_color}