Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: Generic system temperature support #307

Merged
merged 4 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,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 @@ -298,9 +298,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