Add CPU usage module (thanks, @speedie!)
This commit is contained in:
parent
1b59e123c0
commit
81a74f3a95
@ -17,4 +17,5 @@
|
|||||||
#module_weather "Weather: " " | "
|
#module_weather "Weather: " " | "
|
||||||
#module_du "Disk Usage: " " | "
|
#module_du "Disk Usage: " " | "
|
||||||
#module_ip "IP: " " | "
|
#module_ip "IP: " " | "
|
||||||
|
#module_cpu "CPU: " " | "
|
||||||
module_date "Date: " ""
|
module_date "Date: " ""
|
||||||
|
@ -45,3 +45,8 @@ module_du() {
|
|||||||
module_ip() {
|
module_ip() {
|
||||||
export bar="${bar}${1}$(ip -f inet a | awk '/inet / { print $2 }' | tail -n 1 | sed 's/\/.*//')${2}"
|
export bar="${bar}${1}$(ip -f inet a | awk '/inet / { print $2 }' | tail -n 1 | sed 's/\/.*//')${2}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module_cpu() {
|
||||||
|
# https://github.com/speediegamer/xshbar-plugins/blob/main/cpustatus.plugin
|
||||||
|
export bar="${bar}${1}$(top -bn1 | grep 'Cpu(s)' | sed 's/.*, *\([0-9.]*\)%* id.*/\1/' | awk '{print 100 - $1"%"}')${2}"
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user