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

Extension to support user custom status modules #416

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

khsoh
Copy link
Contributor

@khsoh khsoh commented Oct 28, 2024

This feature improves the existing method of user custom modules by allowing the user to place all custom modules in a single directory.

Example: in the .tmux.conf file

# In ~/.tmux.conf, before loading the catppuccin plugin
set -gF @catppuccin_user_status_directory   "~/.config/tmux/custom"

# Apply your custom module in status-right
set -g status-right "#{E:@catpuccin_status_application}#{E:@catppuccin_status_cpu}#{E:@catppuccin_status_ram}"

Then create ~/.config/tmux/custom/ram.conf:

%hidden MODULE_NAME="ram"

set -ogq @ram_low_fg_color    "#{E:@thm_fg}"
set -ogq @ram_medium_fg_color "#{E:@thm_fg}"
set -ogq @ram_high_fg_color   "#{E:@thm_crust}"

set -ogq @ram_low_bg_color    "#{E:@catppuccin_status_module_text_bg}"
set -ogq @ram_medium_bg_color "#{E:@catppuccin_status_module_text_bg}"
set -ogq @ram_high_bg_color   "#{E:@thm_red}"

set -ogq  "@catppuccin_${MODULE_NAME}_icon"           "#{l:#{ram_icon}} "
set -ogqF "@catppuccin_${MODULE_NAME}_color"          "#{E:@thm_blue}"
set -ogq  "@catppuccin_status_${MODULE_NAME}_text_fg" "#{l:#{ram_fg_color}}"
set -ogq  "@catppuccin_status_${MODULE_NAME}_text_bg" "#{l:#{ram_bg_color}}"
set -ogq  "@catppuccin_${MODULE_NAME}_text"           " #{l:#{ram_percentage}}"

source -F "#{@catppuccin_tmux_directory}/utils/status_module.conf"

@kjnsn
Copy link
Collaborator

kjnsn commented Oct 28, 2024

Thanks so much for working on this!

I'd like to understand better what makes this a better user experience. For example, I have a "custom" status line module in my config that is two lines:

set -g status-right "#[bg=#{@thm_flamingo},fg=#{@thm_crust}]#[reverse]#[noreverse]󱀙  "
set -ag status-right "#[fg=#{@thm_fg},bg=terminal] #(memory_pressure | awk '/percentage/{print $5}') "

This feature improves the existing method of user custom modules by allowing the user to place all custom modules in a single directory.

Can you elaborate on this more? What about the plugin currently makes this more difficult?

I would like to keep things as simple as possible, and even avoid having separate config files at all.

@khsoh
Copy link
Contributor Author

khsoh commented Oct 28, 2024

I wrote this mainly for the tmux-cpu plugin. So, this is a simple way to extend and add other configurations like cpu-temp, gpu, etc, in the status bar.

Its fine if this pull-request is not accepted in the interest of keeping this module simple.

Thank you for your consideration.

@kjnsn
Copy link
Collaborator

kjnsn commented Oct 28, 2024

I wrote this mainly for the tmux-cpu plugin. So, this is a simple way to extend and add other configurations like cpu-temp, gpu, etc, in the status bar.

How does it contrast with the existing method of using custom modules at https://github.com/catppuccin/tmux/blob/main/docs/tutorials/02-custom-status.md?

@khsoh
Copy link
Contributor Author

khsoh commented Oct 28, 2024

My intent was to keep the main .tmux.conf more focused on the "main" configuration and keep other status-related configuration in separate configuration files.

With the existing method of handling custom modules, it seems that I have to put all of the status-related configuration into the main configuration file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants