From a4a50cfd69018ae6a43ca4efe2441fde7d70dc6f Mon Sep 17 00:00:00 2001 From: Einherjar Date: Wed, 25 Oct 2023 15:15:14 -0300 Subject: [PATCH 1/5] feat(cpu): add cpu module CPU module Requirements This module depends on [`tmux-cpu`](https://github.com/tmux-plugins/tmux-cpu). Install The prefered way to install tmux-cpu is using [TPM](https://github.com/tmux-plugins/tpm). Configure Load tmux-cpu after you load catppuccin. set -g @plugin 'catppuccin/tmux' ... set -g @plugin 'tmux-plugins/tmux-cpu' Add the cpu module to the status modules list. set -g @catppuccin_status_modules" "... cpu ..." --- README.md | 22 ++++++++++++++++++++++ status/cpu.sh | 14 ++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 status/cpu.sh diff --git a/README.md b/README.md index 4260bd1..5e0fb5b 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ 4. [Status](#status) 5. [Customizing modules](#customizing-modules) 6. [Battery module](#battery-module) + 7. [CPU module](#CPU-module) 5. [Create a custom module](#create-a-custom-module) 6. [Configuration Examples](#configuration-examples) 1. [Config 1](#config-1) @@ -277,6 +278,27 @@ Add the battery module to the status modules list. set -g @catppuccin_status_modules_right "... battery ..." ``` +### CPU module + +#### Requirements +This module depends on [tmux-cpu](https://github.com/tmux-plugins/tmux-cpu/tree/master). + +#### Install +The prefered 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-cpu' +``` + +Add the cpu module to the status modules list. +```sh +set -g @catppuccin_status_modules_right "... cpu ..." +``` + ## Create a custom module It is possible to add a new custom module or overrite any of the existing modules. diff --git a/status/cpu.sh b/status/cpu.sh new file mode 100644 index 0000000..0d43359 --- /dev/null +++ b/status/cpu.sh @@ -0,0 +1,14 @@ +show_cpu() { + tmux set-option -g @cpu_low_bg_color "$thm_yellow" # background color when cpu is low + tmux set-option -g @cpu_medium_bg_color "$thm_orange" # background color when cpu is medium + tmux set-option -g @cpu_high_bg_color "$thm_red" # background color when cpu is high + + local index=$1 + local icon=$(get_tmux_option "@catppuccin_cpu_icon" "") + local color="$(get_tmux_option "@catppuccin_cpu_color" "#{cpu_bg_color}")" + local text="$(get_tmux_option "@catppuccin_cpu_text" "#{cpu_percentage}")" + + local module=$( build_status_module "$index" "$icon" "$color" "$text" ) + + echo "$module" +} From fc23dfe931bfcc5b8f0d5f34c6a00d0dc63353cd Mon Sep 17 00:00:00 2001 From: qadzek <84473512+qadzek@users.noreply.github.com> Date: Wed, 3 Jan 2024 14:04:40 +0100 Subject: [PATCH 2/5] docs: demonstrate how to use a command or script The module template currently only shows how to display a static text. This PR clarifies how to use a command or script to display a dynamic text. --- custom/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/custom/README.md b/custom/README.md index 232df4a..6f7dbd6 100644 --- a/custom/README.md +++ b/custom/README.md @@ -30,3 +30,7 @@ show_() { # save this module in a file with the name . echo "$module" } ``` + +To use the output of a command, use e.g. `local text="$(get_tmux_option "@catppuccin_test_text" "#(date +%T)")"`. + +To use the output of a script, use e.g. `local text="$(get_tmux_option "@catppuccin_test_text" "#($HOME/my_script.sh)")"`. From ae7bd3ed7752ae3cdd447ebc8b69f4455ced87ac Mon Sep 17 00:00:00 2001 From: Alex Lewis Date: Wed, 3 Jan 2024 15:54:47 +0000 Subject: [PATCH 3/5] feat: Configure pane (active) border styles --- README.md | 11 +++++++++++ catppuccin.tmux | 6 ++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 75e0639..2d7c34c 100644 --- a/README.md +++ b/README.md @@ -174,6 +174,17 @@ set -g @catppuccin_window_format_directory_text "#{b:pane_current_path}" ``` Use this to overide the way the directory is displayed. +### Pane + +#### Set the pane border style: + +set -g @catppuccin_pane_border_style "fg=blue" # Use a value compatible with the standard tmux 'pane-border-style' + +#### Set the pane active border style: + +set -g @catppuccin_pane_active_border_style "fg=red" # Use a value compatible with the standard tmux 'pane-border-active-style' + + ### Status #### Set the status module left separator: diff --git a/catppuccin.tmux b/catppuccin.tmux index 11d4030..7244779 100755 --- a/catppuccin.tmux +++ b/catppuccin.tmux @@ -284,8 +284,10 @@ main() { set message-command-style "fg=${thm_cyan},bg=${thm_gray},align=centre" # panes - set pane-border-style "fg=${thm_gray}" - set pane-active-border-style "fg=${thm_blue}" + local pane_border_style=$(get_tmux_option "@catppuccin_pane_border_style" "fg=${thm_gray}") + local pane_active_border_style=$(get_tmux_option "@catppuccin_pane_active_border_style" "fg=${thm_blue}") + set pane-border-style "${pane_border_style}" + set pane-active-border-style "${pane_active_border_style}" # windows setw window-status-activity-style "fg=${thm_fg},bg=${thm_bg},none" From b306dc54509cca4f340dfe3a119564aa1cc39f29 Mon Sep 17 00:00:00 2001 From: Peter Kracik Date: Wed, 10 Jan 2024 16:54:58 +0100 Subject: [PATCH 4/5] custom plugin dir --- catppuccin.tmux | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/catppuccin.tmux b/catppuccin.tmux index 11d4030..e85e079 100755 --- a/catppuccin.tmux +++ b/catppuccin.tmux @@ -197,7 +197,8 @@ build_status_module() { load_modules() { local modules_list=$1 - local modules_custom_path=$PLUGIN_DIR/custom + local custom_path="$(get_tmux_option "@catppuccin_custom_plugin_dir" "${PLUGIN_DIR}/custom")" + local modules_custom_path=$custom_path local modules_status_path=$PLUGIN_DIR/status local modules_window_path=$PLUGIN_DIR/window From 5172c764e243c054be3e2f7c8a2bdfb9ee88123f Mon Sep 17 00:00:00 2001 From: Peter Kracik Date: Wed, 10 Jan 2024 17:02:06 +0100 Subject: [PATCH 5/5] added readme --- custom/README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/custom/README.md b/custom/README.md index 232df4a..2a39982 100644 --- a/custom/README.md +++ b/custom/README.md @@ -30,3 +30,10 @@ show_() { # save this module in a file with the name . echo "$module" } ``` + +## Configure custom modules path + +You can configure a custom path for your modules by setting the `@catppuccin_custom_plugin_dir` option. +```sh +set -g @catppuccin_custom_plugin_dir "" +```