From 696203bf783e49c76a1fe7d0e176033e4252fa3c Mon Sep 17 00:00:00 2001 From: Jared G Date: Wed, 17 Jan 2024 17:59:26 -0600 Subject: [PATCH 1/4] Added raspberry pi temperature monitor --- functions/_tide_item_pi_temp.fish | 6 ++++++ functions/tide/configure/configs/classic.fish | 4 +++- functions/tide/configure/configs/classic_16color.fish | 2 ++ functions/tide/configure/configs/lean.fish | 4 +++- functions/tide/configure/configs/lean_16color.fish | 2 ++ functions/tide/configure/configs/rainbow.fish | 4 +++- functions/tide/configure/configs/rainbow_16color.fish | 2 ++ functions/tide/configure/icons.fish | 1 + 8 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 functions/_tide_item_pi_temp.fish diff --git a/functions/_tide_item_pi_temp.fish b/functions/_tide_item_pi_temp.fish new file mode 100644 index 0000000..2e6b016 --- /dev/null +++ b/functions/_tide_item_pi_temp.fish @@ -0,0 +1,6 @@ +function _tide_item_pi_temp + if type -q vcgencmd + vcgencmd measure_temp | string match -qr "(?[\d.]+)" + _tide_print_item pi_temp $t' ' $tide_pi_temp_icon + end +end diff --git a/functions/tide/configure/configs/classic.fish b/functions/tide/configure/configs/classic.fish index 8973cbc..cfe5e11 100644 --- a/functions/tide/configure/configs/classic.fish +++ b/functions/tide/configure/configs/classic.fish @@ -63,6 +63,8 @@ tide_os_bg_color 444444 tide_os_color EEEEEE tide_php_bg_color 444444 tide_php_color 617CBE +tide_pi_temp_bg_color 444444 +tide_pi_temp_color $_tide_color_green tide_private_mode_bg_color 444444 tide_private_mode_color FFFFFF tide_prompt_add_newline_before true @@ -81,7 +83,7 @@ tide_pwd_markers .bzr .citc .git .hg .node-version .python-version .ruby-version tide_python_bg_color 444444 tide_python_color 00AFAF tide_right_prompt_frame_enabled true -tide_right_prompt_items status cmd_duration context jobs direnv node python rustc java php pulumi ruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir zig +tide_right_prompt_items status cmd_duration context jobs direnv node python rustc java php pulumi ruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir zig pi_temp tide_right_prompt_prefix  tide_right_prompt_separator_diff_color  tide_right_prompt_separator_same_color  diff --git a/functions/tide/configure/configs/classic_16color.fish b/functions/tide/configure/configs/classic_16color.fish index 670170f..da89d55 100644 --- a/functions/tide/configure/configs/classic_16color.fish +++ b/functions/tide/configure/configs/classic_16color.fish @@ -49,6 +49,8 @@ tide_os_bg_color black tide_os_color brwhite tide_php_bg_color black tide_php_color blue +tide_pi_temp_bg_color black +tide_pi_temp_color green tide_private_mode_bg_color black tide_private_mode_color brwhite tide_prompt_color_frame_and_connection brblack diff --git a/functions/tide/configure/configs/lean.fish b/functions/tide/configure/configs/lean.fish index a958a17..17f2f94 100644 --- a/functions/tide/configure/configs/lean.fish +++ b/functions/tide/configure/configs/lean.fish @@ -63,6 +63,8 @@ tide_os_bg_color normal tide_os_color normal tide_php_bg_color normal tide_php_color 617CBE +tide_pi_temp_bg_color normal +tide_pi_temp_color $_tide_color_green tide_private_mode_bg_color normal tide_private_mode_color FFFFFF tide_prompt_add_newline_before true @@ -81,7 +83,7 @@ tide_pwd_markers .bzr .citc .git .hg .node-version .python-version .ruby-version tide_python_bg_color normal tide_python_color 00AFAF tide_right_prompt_frame_enabled false -tide_right_prompt_items status cmd_duration context jobs direnv node python rustc java php pulumi ruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir zig +tide_right_prompt_items status cmd_duration context jobs direnv node python rustc java php pulumi ruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir zig pi_temp tide_right_prompt_prefix ' ' tide_right_prompt_separator_diff_color ' ' tide_right_prompt_separator_same_color ' ' diff --git a/functions/tide/configure/configs/lean_16color.fish b/functions/tide/configure/configs/lean_16color.fish index 16c2511..4f16e5a 100644 --- a/functions/tide/configure/configs/lean_16color.fish +++ b/functions/tide/configure/configs/lean_16color.fish @@ -49,6 +49,8 @@ tide_os_bg_color normal tide_os_color brwhite tide_php_bg_color normal tide_php_color blue +tide_pi_temp_bg_color normal +tide_pi_temp_color green tide_private_mode_bg_color normal tide_private_mode_color brwhite tide_prompt_color_frame_and_connection brblack diff --git a/functions/tide/configure/configs/rainbow.fish b/functions/tide/configure/configs/rainbow.fish index 60c1592..6549723 100644 --- a/functions/tide/configure/configs/rainbow.fish +++ b/functions/tide/configure/configs/rainbow.fish @@ -63,6 +63,8 @@ tide_os_bg_color $os_branding_bg_color tide_os_color $os_branding_color tide_php_bg_color 617CBE tide_php_color 000000 +tide_pi_temp_bg_color 2E3436 +tide_pi_temp_color green tide_private_mode_bg_color F1F3F4 tide_private_mode_color 000000 tide_prompt_add_newline_before true @@ -81,7 +83,7 @@ tide_pwd_markers .bzr .citc .git .hg .node-version .python-version .ruby-version tide_python_bg_color 444444 tide_python_color 00AFAF tide_right_prompt_frame_enabled true -tide_right_prompt_items status cmd_duration context jobs direnv node python rustc java php pulumi ruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir zig +tide_right_prompt_items status cmd_duration context jobs direnv node python rustc java php pulumi ruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir zig pi_temp tide_right_prompt_prefix  tide_right_prompt_separator_diff_color  tide_right_prompt_separator_same_color  diff --git a/functions/tide/configure/configs/rainbow_16color.fish b/functions/tide/configure/configs/rainbow_16color.fish index a040f58..84f70a3 100644 --- a/functions/tide/configure/configs/rainbow_16color.fish +++ b/functions/tide/configure/configs/rainbow_16color.fish @@ -49,6 +49,8 @@ tide_os_bg_color white tide_os_color black tide_php_bg_color blue tide_php_color black +tide_pi_temp_bg_color black +tide_pi_temp_color green tide_private_mode_bg_color brwhite tide_private_mode_color black tide_prompt_color_frame_and_connection brblack diff --git a/functions/tide/configure/icons.fish b/functions/tide/configure/icons.fish index 70611cd..183f967 100644 --- a/functions/tide/configure/icons.fish +++ b/functions/tide/configure/icons.fish @@ -19,6 +19,7 @@ tide_nix_shell_icon  tide_node_icon  # Actual nodejs glyph is harder to see tide_os_icon $os_branding_icon tide_php_icon  +tide_pi_temp_icon 󰔄 tide_private_mode_icon 󰗹 tide_prompt_icon_connection ' ' tide_pulumi_icon  From 815bd7c94ef2db061af8b79d6e500f9e66b11ddc Mon Sep 17 00:00:00 2001 From: Jared G Date: Wed, 17 Jan 2024 20:30:27 -0600 Subject: [PATCH 2/4] Color coded temperature monitor --- functions/_tide_item_pi_temp.fish | 9 +++++++++ functions/tide/configure/configs/classic.fish | 4 +++- functions/tide/configure/configs/classic_16color.fish | 4 +++- functions/tide/configure/configs/lean.fish | 4 +++- functions/tide/configure/configs/lean_16color.fish | 4 +++- functions/tide/configure/configs/rainbow.fish | 4 +++- functions/tide/configure/configs/rainbow_16color.fish | 4 +++- 7 files changed, 27 insertions(+), 6 deletions(-) diff --git a/functions/_tide_item_pi_temp.fish b/functions/_tide_item_pi_temp.fish index 2e6b016..3a47f5c 100644 --- a/functions/_tide_item_pi_temp.fish +++ b/functions/_tide_item_pi_temp.fish @@ -1,6 +1,15 @@ function _tide_item_pi_temp if type -q vcgencmd vcgencmd measure_temp | string match -qr "(?[\d.]+)" + if test $t -ge 80 + set tide_pi_temp_color $tide_pi_temp_hi_color + else + if test $t -ge 70 + set tide_pi_temp_color $tide_pi_temp_mid_color + else + set tide_pi_temp_color $tide_pi_temp_lo_color + end + end _tide_print_item pi_temp $t' ' $tide_pi_temp_icon end end diff --git a/functions/tide/configure/configs/classic.fish b/functions/tide/configure/configs/classic.fish index cfe5e11..31279b0 100644 --- a/functions/tide/configure/configs/classic.fish +++ b/functions/tide/configure/configs/classic.fish @@ -64,7 +64,9 @@ tide_os_color EEEEEE tide_php_bg_color 444444 tide_php_color 617CBE tide_pi_temp_bg_color 444444 -tide_pi_temp_color $_tide_color_green +tide_pi_temp_lo_color $_tide_color_dark_green +tide_pi_temp_mid_color $_tide_color_gold +tide_pi_temp_hi_color D70000 tide_private_mode_bg_color 444444 tide_private_mode_color FFFFFF tide_prompt_add_newline_before true diff --git a/functions/tide/configure/configs/classic_16color.fish b/functions/tide/configure/configs/classic_16color.fish index da89d55..9ef99a0 100644 --- a/functions/tide/configure/configs/classic_16color.fish +++ b/functions/tide/configure/configs/classic_16color.fish @@ -50,7 +50,9 @@ tide_os_color brwhite tide_php_bg_color black tide_php_color blue tide_pi_temp_bg_color black -tide_pi_temp_color green +tide_pi_temp_lo_color green +tide_pi_temp_mid_color yellow +tide_pi_temp_hi_color red tide_private_mode_bg_color black tide_private_mode_color brwhite tide_prompt_color_frame_and_connection brblack diff --git a/functions/tide/configure/configs/lean.fish b/functions/tide/configure/configs/lean.fish index 17f2f94..903d7c3 100644 --- a/functions/tide/configure/configs/lean.fish +++ b/functions/tide/configure/configs/lean.fish @@ -64,7 +64,9 @@ tide_os_color normal tide_php_bg_color normal tide_php_color 617CBE tide_pi_temp_bg_color normal -tide_pi_temp_color $_tide_color_green +tide_pi_temp_lo_color $_tide_color_dark_green +tide_pi_temp_mid_color $_tide_color_gold +tide_pi_temp_hi_color D70000 tide_private_mode_bg_color normal tide_private_mode_color FFFFFF tide_prompt_add_newline_before true diff --git a/functions/tide/configure/configs/lean_16color.fish b/functions/tide/configure/configs/lean_16color.fish index 4f16e5a..85c88a0 100644 --- a/functions/tide/configure/configs/lean_16color.fish +++ b/functions/tide/configure/configs/lean_16color.fish @@ -50,7 +50,9 @@ tide_os_color brwhite tide_php_bg_color normal tide_php_color blue tide_pi_temp_bg_color normal -tide_pi_temp_color green +tide_pi_temp_lo_color green +tide_pi_temp_mid_color yellow +tide_pi_temp_hi_color red tide_private_mode_bg_color normal tide_private_mode_color brwhite tide_prompt_color_frame_and_connection brblack diff --git a/functions/tide/configure/configs/rainbow.fish b/functions/tide/configure/configs/rainbow.fish index 6549723..a6ebc14 100644 --- a/functions/tide/configure/configs/rainbow.fish +++ b/functions/tide/configure/configs/rainbow.fish @@ -64,7 +64,9 @@ tide_os_color $os_branding_color tide_php_bg_color 617CBE tide_php_color 000000 tide_pi_temp_bg_color 2E3436 -tide_pi_temp_color green +tide_pi_temp_lo_color 4E9A06 +tide_pi_temp_mid_color $_tide_color_gold +tide_pi_temp_hi_color D70000 tide_private_mode_bg_color F1F3F4 tide_private_mode_color 000000 tide_prompt_add_newline_before true diff --git a/functions/tide/configure/configs/rainbow_16color.fish b/functions/tide/configure/configs/rainbow_16color.fish index 84f70a3..3fd9c7f 100644 --- a/functions/tide/configure/configs/rainbow_16color.fish +++ b/functions/tide/configure/configs/rainbow_16color.fish @@ -50,7 +50,9 @@ tide_os_color black tide_php_bg_color blue tide_php_color black tide_pi_temp_bg_color black -tide_pi_temp_color green +tide_pi_temp_lo_color green +tide_pi_temp_mid_color yellow +tide_pi_temp_hi_color red tide_private_mode_bg_color brwhite tide_private_mode_color black tide_prompt_color_frame_and_connection brblack From e8666bfac870fb352ea502f56c4c5e835cac43dc Mon Sep 17 00:00:00 2001 From: Jared G Date: Thu, 18 Jan 2024 10:04:35 -0600 Subject: [PATCH 3/4] Fixed indents --- functions/_tide_item_pi_temp.fish | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/functions/_tide_item_pi_temp.fish b/functions/_tide_item_pi_temp.fish index 3a47f5c..9b9059e 100644 --- a/functions/_tide_item_pi_temp.fish +++ b/functions/_tide_item_pi_temp.fish @@ -1,15 +1,15 @@ function _tide_item_pi_temp - if type -q vcgencmd - vcgencmd measure_temp | string match -qr "(?[\d.]+)" - if test $t -ge 80 - set tide_pi_temp_color $tide_pi_temp_hi_color - else - if test $t -ge 70 - set tide_pi_temp_color $tide_pi_temp_mid_color - else - set tide_pi_temp_color $tide_pi_temp_lo_color - end + if type -q vcgencmd + vcgencmd measure_temp | string match -qr "(?[\d.]+)" + if test $t -ge 80 + set tide_pi_temp_color $tide_pi_temp_hi_color + else + if test $t -ge 70 + set tide_pi_temp_color $tide_pi_temp_mid_color + else + set tide_pi_temp_color $tide_pi_temp_lo_color + end + end + _tide_print_item pi_temp $t' ' $tide_pi_temp_icon end - _tide_print_item pi_temp $t' ' $tide_pi_temp_icon - end end From 8cac63f68793a5a667ed96ce1f1fa538ad64f6df Mon Sep 17 00:00:00 2001 From: Jared G Date: Sat, 20 Jan 2024 12:31:06 -0600 Subject: [PATCH 4/4] Added missing flags to set --- functions/_tide_item_pi_temp.fish | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/_tide_item_pi_temp.fish b/functions/_tide_item_pi_temp.fish index 9b9059e..e0008ba 100644 --- a/functions/_tide_item_pi_temp.fish +++ b/functions/_tide_item_pi_temp.fish @@ -2,12 +2,12 @@ function _tide_item_pi_temp if type -q vcgencmd vcgencmd measure_temp | string match -qr "(?[\d.]+)" if test $t -ge 80 - set tide_pi_temp_color $tide_pi_temp_hi_color + set -fx tide_pi_temp_color $tide_pi_temp_hi_color else if test $t -ge 70 - set tide_pi_temp_color $tide_pi_temp_mid_color + set -fx tide_pi_temp_color $tide_pi_temp_mid_color else - set tide_pi_temp_color $tide_pi_temp_lo_color + set -fx tide_pi_temp_color $tide_pi_temp_lo_color end end _tide_print_item pi_temp $t' ' $tide_pi_temp_icon