RE: PBR running hot - wrzomar - 01-22-2020
I've written a simple C++ program to use it with conky.
Here is code:
Code: #include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
using namespace std;
int main(int argc, char **argv)
{
ifstream tempFile;
string zone;
if(argc == 2){
zone = argv[1];
}
else{
zone = "0";
}
tempFile.open("/sys/class/thermal/thermal_zone"+ zone +"/temp");
if(!tempFile){
cout << "--.--- \u00B0C" << endl;
}
else{
int temp;
tempFile >> temp;
tempFile.close();
cout << fixed << setprecision(3) << (temp / 1000.0) << "\u00B0C" << endl;
}
return 0;
}
Just save it e.g. 'main.cpp', then build it with:
Quote:g++ -o pbp_temp_conky main.cpp
If you don't have g++ installed, first run:
Quote:sudo apt install g++
Then you can run it without arguments or with 0, 1 or 2.
To use it with conky, first you will need to install it with:
Quote:sudo apt install conky
or
Quote:sudo apt install conky-all
Copy 'pbp_temp_conky' somewhere within your $PATH, e.g.
Quote:sudo cp pbp_temp_conky /usr/local/bin/
Create conky autostart desktop file '~/.config/autostart/conky.desktop' with:
Code: [Desktop Entry]
Type=Application
Exec=conky -b
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_US]=Conky
Name=Conky
Comment[en_US]=Auto run conky
Comment=Auto run conky.
And copy conky config file from /etc/conky/conky.conf to your home folder and rename it to .conkyrc and customize it to your liking.
Here is mine .conkyrc:
Code: -- vim: ts=4 sw=4 noet ai cindent syntax=lua
--[[
Conky, a system monitor, based on torsmo
Any original torsmo code is licensed under the BSD license
All code written since the fork of torsmo is licensed under the GPL
Please see COPYING for details
Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
Copyright (c) 2005-2012 Brenden Matthews, Philip Kovacs, et. al. (see AUTHORS)
All rights reserved.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
]]
conky.config = {
alignment = 'top_right',
background = false,
border_width = 1,
cpu_avg_samples = 2,
default_color = 'white',
default_outline_color = 'white',
default_shade_color = 'white',
draw_borders = false,
draw_graph_borders = true,
draw_outline = false,
draw_shades = false,
use_xft = true,
font = 'DejaVu Sans Mono:size=12',
gap_x = 5,
gap_y = 60,
minimum_height = 5,
minimum_width = 5,
net_avg_samples = 2,
no_buffers = true,
out_to_console = false,
out_to_stderr = false,
extra_newline = false,
own_window = true,
own_window_class = 'Conky',
own_window_type = 'normal',
own_window_transparent = true,
own_window_argb_visual = true,
own_window_hints = "undecorated,sticky,skip_taskbar,skip_pager, below",
stippled_borders = 0,
update_interval = 1.0,
uppercase = false,
use_spacer = 'none',
show_graph_scale = false,
show_graph_range = false
}
conky.text = [[
${scroll 16 $nodename - $sysname $kernel on $machine | }
$hr
${color grey}Uptime:$color $uptime
${color grey}Load:$color $loadavg
${color grey}Frequency A53 (in MHz):$color ${freq 1}
#${color grey}Frequency A53 (in MHz):$color ${freq 2}
#${color grey}Frequency A53 (in MHz):$color ${freq 3}
#${color grey}Frequency A53 (in MHz):$color ${freq 4}
#${color grey}Frequency A53 (in GHz):$color ${freq_g 1}
${color grey}Frequency A72 (in MHz):$color ${freq 5}
#${color grey}Frequency A72 (in MHz):$color ${freq 6}
#${color grey}Frequency A72 (in GHz):$color ${freq_g 5}
${color grey}Temp: ${color}${exec pbp_temp_conky 0} ${exec pbp_temp_conky 1} ${exec pbp_temp_conky 2}
${color grey}RAM Usage:$color $mem/$memmax - $memperc% ${membar 4}
${color grey}Swap Usage:$color $swap/$swapmax - $swapperc% ${swapbar 4}
${color grey}CPU Usage:$color ${cpu cpu0}% ${cpubar cpu0 4}
${color grey}CPU1 Usage:$color ${cpu cpu1}% ${cpubar cpu1 4}
${color grey}CPU2 Usage:$color ${cpu cpu2}% ${cpubar cpu2 4}
${color grey}CPU3 Usage:$color ${cpu cpu3}% ${cpubar cpu3 4}
${color grey}CPU4 Usage:$color ${cpu cpu4}% ${cpubar cpu4 4}
${color grey}CPU5 Usage:$color ${cpu cpu5}% ${cpubar cpu5 4}
${color grey}CPU6 Usage:$color ${cpu cpu6}% ${cpubar cpu6 4}
#${color grey}CPU Usage:$color $cpu% ${cpubar 4}
${color grey}Processes:$color $processes ${color grey}Running:$color $running_processes
$hr
${color grey}File systems:
/ $color${fs_used /}/${fs_size /} ${fs_bar 6 /}
${color grey}Networking:
Eth: Up:$color ${upspeed eth0} ${color grey} - Down:$color ${downspeed eth0}
${color grey}WiFi:Up:$color ${upspeed wlan0} ${color grey} - Down:$color ${downspeed wlan0}
${color grey}Camera:$color ${if_existing /dev/video0}ON${else}OFF${endif} ${color grey}Bat: $color ${exec cat /sys/class/power_supply/rk-bat/capacity}% ${exec cat /sys/class/power_supply/rk-bat/status}
$hr
${color grey}Name PID CPU% MEM%
${color lightgrey} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
${color lightgrey} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}
]]
Lines with # are comments. I've commented out ${freq 2} to ${freq 4}, because on PBP they're always the same as ${freq 1}, same is with 5 and 6.
At last start conky with Alt+F2, enter:
Quote:conky -b
or re-login.
|