Skip to content

Commit

Permalink
Merge pull request #307 from locnnil/sys-temp-support
Browse files Browse the repository at this point in the history
add: Generic system temperature support
  • Loading branch information
ethancedwards8 authored Oct 21, 2024
2 parents 80c1516 + 8efdc95 commit ea1a45d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Configuration and options can be found at [draculatheme.com/tmux](https://dracul
set -g @dracula-show-battery-status true
```
- If forecast information is available, a ☀, ☁, ☂, or ❄ unicode character corresponding with the forecast is displayed alongside the temperature
- System temperature on Raspberry PI
- Read system temperature
- Info if the Panes are synchronized
- Spotify playback (needs the tool spotify-tui installed). max-len can be configured.
- Music Player Daemon status (needs the tool mpc installed)
Expand Down
6 changes: 3 additions & 3 deletions scripts/dracula.sh
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,9 @@ main()
continue
fi

if [ $plugin = "rpi-temp" ]; then
IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-rpi-temp-colors" "green dark_gray")
script="#($current_dir/rpi_temp.sh)"
if [ $plugin = "sys-temp" ]; then
IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-sys-temp-colors" "green dark_gray")
script="#($current_dir/sys_temp.sh)"
fi

if $show_powerline; then
Expand Down
7 changes: 6 additions & 1 deletion scripts/rpi_temp.sh → scripts/sys_temp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
export LC_ALL=en_US.UTF-8

get_temp() {
echo "$(vcgencmd measure_temp | sed 's/temp=//')"
if grep -q "Raspberry" /proc/device-tree/model 2>/dev/null; then
# It's a Raspberry pi
echo "$(vcgencmd measure_temp | sed 's/temp=//')"
else
echo "$(sensors | grep 'Tctl' | awk '{print substr($2, 2)}')"
fi
}

main() {
Expand Down

0 comments on commit ea1a45d

Please sign in to comment.