From fbf95890a5ba5a4f09e478b5753e644da2663ca3 Mon Sep 17 00:00:00 2001 From: Lixin Wei Date: Sat, 20 Apr 2024 13:45:15 +0800 Subject: [PATCH] Add cpu_mem & network module --- README.md | 42 ++++++++++++++++++++++++++++++++++++++++++ status/cpu_mem.sh | 14 ++++++++++++++ status/network.sh | 13 +++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 status/cpu_mem.sh create mode 100644 status/network.sh diff --git a/README.md b/README.md index 2944b4c8..830beaf2 100644 --- a/README.md +++ b/README.md @@ -386,6 +386,48 @@ Add the cpu module to the status modules list. set -g @catppuccin_status_modules_right "... cpu ..." ``` +### CPU MEM module + +#### Requirements +This module depends on [tmux-mem-cpu-load](https://github.com/thewtex/tmux-mem-cpu-load). + +#### Install +The preferred way to install tmux-cpu is using [TPM](https://github.com/tmux-plugins/tpm). + +#### Configure +Load tmux-cpu after you load catppuccin. +```sh +set -g @plugin 'catppuccin/tmux' +... +set -g @plugin 'thewtex/tmux-mem-cpu-load' +``` + +Add the cpu module to the status modules list. +```sh +set -g @catppuccin_status_modules_right "... cpu_mem ..." +``` + +### Network module + +#### Requirements +This module depends on [tmux-net-speed](https://github.com/tmux-plugins/tmux-net-speed). + +#### Install +The preferred way to install tmux-cpu is using [TPM](https://github.com/tmux-plugins/tpm). + +#### Configure +Load tmux-cpu after you load catppuccin. +```sh +set -g @plugin 'catppuccin/tmux' +... +set -g @plugin 'tmux-plugins/tmux-net-speed' +``` + +Add the cpu module to the status modules list. +```sh +set -g @catppuccin_status_modules_right "... network ..." +``` + ### Weather modules #### tmux-weather diff --git a/status/cpu_mem.sh b/status/cpu_mem.sh new file mode 100644 index 00000000..d8a5fdcb --- /dev/null +++ b/status/cpu_mem.sh @@ -0,0 +1,14 @@ +# Requires https://github.com/thewtex/tmux-mem-cpu-load + +show_cpu_mem() { + local index icon color text module + + index=$1 + icon="$(get_tmux_option "@catppuccin_cpu_mem_icon" "")" + color="$(get_tmux_option "@catppuccin_cpu_mem_color" "$thm_blue")" + text="$(get_tmux_option "@catppuccin_cpu_mem__text" "#($TMUX_PLUGIN_MANAGER_PATH/tmux-mem-cpu-load/tmux-mem-cpu-load --cpu-mode 2 --averages-count 0 --interval 2)")" + + module=$(build_status_module "$index" "$icon" "$color" "$text") + + echo "$module" +} diff --git a/status/network.sh b/status/network.sh new file mode 100644 index 00000000..3ec07eb4 --- /dev/null +++ b/status/network.sh @@ -0,0 +1,13 @@ +# Requires https://github.com/tmux-plugins/tmux-net-speed +show_network() { + local index icon color text module + + index=$1 + icon="$(get_tmux_option "@catppuccin_weather_icon" "")" + color="$(get_tmux_option "@catppuccin_weather_color" "$thm_green")" + text="$(get_tmux_option "@catppuccin_weather_text" "#{net_speed}")" + + module=$(build_status_module "$index" "$icon" "$color" "$text") + + echo "$module" +}