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

There are breaking changes in upstream tmux #352

Open
budimanjojo opened this issue Oct 14, 2024 · 2 comments
Open

There are breaking changes in upstream tmux #352

budimanjojo opened this issue Oct 14, 2024 · 2 comments

Comments

@budimanjojo
Copy link

There are breaking changes in upstream since https://github.com/catppuccin/tmux/releases/tag/v0.4.0

One of the change requires changes in here too.
The change in question: The status-left and status-right options are no longer controlled by this plugin.

This means user needs to configure set -g status-left and set -g status-right after loading the plugin.
An example on the change (taken from https://github.com/catppuccin/tmux?tab=readme-ov-file#config-1 before and after the release)
BEFORE:

set -g @catppuccin_window_right_separator "█ "
set -g @catppuccin_window_number_position "right"
set -g @catppuccin_window_middle_separator " | "

set -g @catppuccin_window_default_fill "none"

set -g @catppuccin_window_current_fill "all"

set -g @catppuccin_status_modules_right "application session user host date_time"
set -g @catppuccin_status_left_separator "█"
set -g @catppuccin_status_right_separator "█"

set -g @catppuccin_date_time_text "%Y-%m-%d %H:%M:%S"

AFTER:

# Disable catppuccin styling windows.
set -g @catppuccin_window_status_style "none"
set -g @catppuccin_status_left_separator "█"
set -g @catppuccin_status_right_separator "█"

set -g @catppuccin_date_time_text "%Y-%m-%d %H:%M:%S"

# Run catppuccin plugin manually or through tpm
# ...

# Style the windows. See https://man7.org/linux/man-pages/man1/tmux.1.html#STYLES for more details.
set -gF window-status-style "bg=#{@thm_surface_1},fg=#{@thm_fg}"
set -gF window-status-current-style "bg=#{@thm_peach},fg=#{@thm_crust}"

set -g window-status-format " #T | #I "
set -g window-status-current-format " #T | #I "

set -g status-left ""
set -g  status-right "#{E:@catppuccin_status_application}"
set -ag status-right "#{E:@catppuccin_status_session}"
set -ag status-right "#{E:@catppuccin_status_user}"
set -ag status-right "#{E:@catppuccin_status_host}"
set -ag status-right "#{E:@catppuccin_status_date_time}"

As you can see, there are section of config that needs to be run after the plugin is being loaded.
We can simply let the user do this manually by adding those lines in config.programs.tmux.extraConfig but I prefer having something like config.programs.tmux.catppuccin.extraConfigLate.

{
  options.programs.tmux.catppuccin = ctp.mkCatppuccinOpt { name = "tmux"; } // {
    extraConfig = mkOption {
      type = types.lines;
      description = "Additional configuration for the catppuccin plugin.";
      default = "";
      example = ''
        set -g @catppuccin_status_modules_right "application session user host date_time"
      '';
    };
    extraConfigLate = mkOption {
      type = types.lines;
      description = "Additional configuration for the catppuccin plugin that needs to be loaded after the plugin.";
      default = "";
      example = ''
        set -g status-left ""
     '';
  };

  config.programs.tmux = lib.mkIf enable {
    extraConfig = ''
      ${cfg.extraConfigLate}
    '';
    plugins = [
      {
        inherit plugin;
        extraConfig = concatStrings [
          ''
          set -g @catppuccin_flavor '${cfg.flavor}'
          ''
          cfg.extraConfig
        };
      ];
    }
  ];
}
@vdbe
Copy link
Contributor

vdbe commented Oct 14, 2024

You can use programs.tmux.extraConfig for this programs.tmux.catppuccin.extraConfig was added as a way to set options before the plugin was loaded, which was otherwise impossible due to how home-manager creates tmux.conf.

@budimanjojo
Copy link
Author

Yes I did mention that user can just use programs.tmux.extraConfig but I prefer having separation between the main config and theme config in the nix 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

No branches or pull requests

2 participants