forked from matryer/xbar-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request matryer#1505 from plaa/cpu-thermal-throttle
Add CPU thermal throttling plugin
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
# <bitbar.title>CPU thermal throttling</bitbar.title> | ||
# <bitbar.version>v1.0</bitbar.version> | ||
# <bitbar.author>Sampo Juustila</bitbar.author> | ||
# <bitbar.author.github>plaa</bitbar.author.github> | ||
# <bitbar.desc>Displays the current CPU thermal throttling speed (using `pmset -g therm`).</bitbar.desc> | ||
|
||
OUTPUT="$(pmset -g therm)" | ||
SCHEDLIMIT="$(echo "$OUTPUT" | grep CPU_Scheduler_Limit | cut -d= -f2)" | ||
SPEEDLIMIT="$(echo "$OUTPUT" | grep CPU_Speed_Limit | cut -d= -f2)" | ||
AVAILCPU="$(echo "$OUTPUT" | grep CPU_Available_CPUs | cut -d= -f2)" | ||
TOTAL=$(($SCHEDLIMIT * $SPEEDLIMIT / 100)) | ||
|
||
if [ "$TOTAL" -ge 80 ]; then | ||
SYMBOL="🌡" | ||
else | ||
SYMBOL="🔥" | ||
fi | ||
|
||
cat <<EOF | ||
$SYMBOL$TOTAL% | ||
--- | ||
CPU_Speed_Limit $SPEEDLIMIT% | ||
CPU_Scheduler_Limit $SCHEDLIMIT% | ||
CPU_Available_CPUs $AVAILCPU | ||
EOF |