Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
neofetch
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
neofetch
Commits
3ef6aeea
Commit
3ef6aeea
authored
Oct 23, 2016
by
Dylan Araps
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Linux: Add CPU temperature
parent
9838c7cc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
6 deletions
+45
-6
README.md
README.md
+3
-0
config
config/config
+11
-0
neofetch
neofetch
+23
-6
neofetch.1
neofetch.1
+8
-0
No files found.
README.md
View file @
3ef6aeea
...
...
@@ -434,6 +434,9 @@ alias neofetch2="neofetch \
--cpu_cores type Whether or not to display the number of CPU cores
Takes: logical, physical, off
Note: 'physical' doesn't work on BSD.
--cpu_speed on/off Hide/Show cpu speed.
--cpu_temp on/off Hide/Show cpu temperature.
NOTE This only works on linux.
--distro_shorthand on/off Shorten the output of distro (tiny, on, off)
NOTE: This is only possible on Linux, macOS, and Solaris
--kernel_shorthand on/off Shorten the output of kernel
...
...
config/config
View file @
3ef6aeea
...
...
@@ -106,6 +106,11 @@ cpu_shorthand="off"
# --cpu_display bar, infobar, barinfo, off
cpu_display
=
"off"
# CPU Speed
# Hide/Show CPU speed.
# --cpu_speed on, off
cpu_speed
=
"on"
# CPU Cores
# Display CPU cores in output
# Logical: All virtual cores
...
...
@@ -114,6 +119,12 @@ cpu_display="off"
# Note: 'physical' doesn't work on BSD.
cpu_cores
=
"logical"
# CPU Temperature
# Hide/Show CPU temperature.
# --cpu_temp on, off
# Note: Only works on Linux.
cpu_temp
=
"on"
# GPU
...
...
neofetch
View file @
3ef6aeea
...
...
@@ -686,10 +686,11 @@ getcpu() {
"Linux" | "Windows")
# Get cpu name
cpu="$(awk -F '
:
| @
' '
/model name/ {printf
$2
; exit
}
' /proc/cpuinfo)"
cpu_dir=
"/sys/devices/system/cpu/cpu0/cpufreq"
speed_dir=
"/sys/devices/system/cpu/cpu0/cpufreq"
temp_dir=
"/sys/class/hwmon/hwmon0/temp1_input"
# Get cpu speed
if [ -d
"
$
cpu
_dir
"
]; then
if [ -d
"
$
speed
_dir
"
]; then
case
"
$speed_type
"
in
current) speed_type=
"scaling_cur_freq"
;;
min) speed_type=
"scaling_min_freq"
;;
...
...
@@ -701,8 +702,8 @@ getcpu() {
esac
# Fallback to cpuinfo_max_freq if
$speed_type
fails
read -t 1 -r speed <
"
${
cpu
_dir
}
/
${
speed_type
}
"
|| \
read -t 1 -r speed <
"
${
cpu
_dir
}
/cpuinfo_max_freq"
read -t 1 -r speed <
"
${
speed
_dir
}
/
${
speed_type
}
"
|| \
read -t 1 -r speed <
"
${
speed
_dir
}
/cpuinfo_max_freq"
speed=
"
$((
speed
/
100000
))
"
else
...
...
@@ -710,6 +711,13 @@ getcpu() {
speed=
"
$((
speed
/
100
))
"
fi
# Get cpu temp
if [
"
$cpu_temp
"
==
"on"
] && [ -f
"
$temp_dir
"
]; then
temp=
"
$(
<
"
$temp_dir
"
)
"
temp=
"
$((
temp
*
100
/
10000
))
"
temp=
"[
${
temp
/
${
temp
:
-1
}}
.
${
temp
:
-1
}
°C]"
fi
# Show/hide hyperthreaded cores
case
"
$cpu_cores
"
in
"logical"
|
"on"
) cores=
"
$(
grep
-c
^processor /proc/cpuinfo
)
"
;;
...
...
@@ -723,7 +731,7 @@ getcpu() {
speed=
"
${
speed
:0:1
}
.
${
speed
:1
}
"
fi
cpu=
"
$cpu
@
${
speed
}
GHz"
cpu=
"
$cpu
@
${
speed
}
GHz
$temp
"
;;
"Mac OS X"
)
...
...
@@ -914,6 +922,10 @@ getcpu() {
[
"
$cpu_cores
"
!=
"off"
] && [
"
$cores
"
] && \
cpu=
"
${
cpu
/@/(
${
cores
}
) @
}
"
# Remove speed from output
[
"
$cpu_speed
"
==
"off"
] && \
cpu=
"
${
cpu
/@ *GHz
}
"
# Make the output of cpu shorter
case
"
$cpu_shorthand
"
in
"name"
) cpu=
"
${
cpu
/@*
}
"
;;
...
...
@@ -2991,7 +3003,10 @@ usage() { cat << EOF
Possible values: name, speed, tiny, on, off
--cpu_cores type Whether or not to display the number of CPU cores
Takes: logical, physical, off
Note: 'physical' doesn't work on BSD.
NOTE: 'physical' doesn't work on BSD.
--cpu_speed on/off Hide/Show cpu speed.
--cpu_temp on/off Hide/Show cpu temperature.
NOTE This only works on linux.
--distro_shorthand on/off Shorten the output of distro (tiny, on, off)
NOTE: This is only possible on Linux, macOS, and Solaris
--kernel_shorthand on/off Shorten the output of kernel
...
...
@@ -3119,6 +3134,8 @@ getargs() {
# Info
--os_arch
)
os_arch
=
"
$2
"
;;
--cpu_cores
)
cpu_cores
=
"
$2
"
;;
--cpu_speed
)
cpu_speed
=
"
$2
"
;;
--cpu_temp
)
cpu_temp
=
"
$2
"
;;
--speed_type
)
speed_type
=
"
$2
"
;;
--distro_shorthand
)
distro_shorthand
=
"
$2
"
;;
--kernel_shorthand
)
kernel_shorthand
=
"
$2
"
;;
...
...
neofetch.1
View file @
3ef6aeea
...
...
@@ -40,6 +40,14 @@ Whether or not to display the number of CPU cores
.br
Note: 'physical' doesn't work on BSD.
.TP
.B \--cpu_speed 'on/off'
Hide/Show cpu speed.
.TP
.B \--cpu_temp 'on/off'
Hide/Show cpu temperature.
.br
NOTE This only works on linux.
.TP
.B \--distro_shorthand 'on/off'
Shorten the output of distro (tiny, on, off)
.br
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment