catppuccin / tmux

💽 Soothing pastel theme for Tmux
MIT License
1.92k stars 611 forks source link

Add documentation/examples on how to overwrite background and enable transparency #84

Closed git-girl closed 7 months ago

git-girl commented 1 year ago

hey firstly thanks for more catppuccin :sunflower:

i was trying to setup the plugin and wanted to have it have a transparent background. without the plugin in the tmux.conf and with the set-option -g status-style bg=default it works fine. but once i add the plugin the status bar has a black background.

i also tried putting the set-option status-style before and after the plugin load, and the different versions of the option (allthough the one in the config is the correct one for v3.3a that i'm on). i also tried settting the alacritty TERM var to xterm-256color as described in the tmux faq

did i miss an option i have to set for this?

this is my tmux.conf ``` conf set -g @plugin 'tmux-plugins/tpm' # actually pretty minimal https://github.com/tmux-plugins/tmux-sensible set -g @plugin 'tmux-plugins/tmux-sensible' set -g @plugin 'sainnhe/tmux-fzf' # yank on y set -g @plugin 'tmux-plugins/tmux-yank' set -g @plugin 'catppuccin/tmux' set -g mouse on set -g base-index 1 set -g pane-base-index 1 set-window-option -g pane-base-index 1 set-option -g renumber-windows on # from https://github.com/aserowy/tmux.nvim is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?\.?(view|n?vim?x?)(-wrapped)?(diff)?$'" bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' { if -F '#{pane_at_left}' '' 'select-pane -L' } bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' { if -F '#{pane_at_bottom}' '' 'select-pane -D' } bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' { if -F '#{pane_at_top}' '' 'select-pane -U' } bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' { if -F '#{pane_at_right}' '' 'select-pane -R' } bind-key -T copy-mode-vi 'C-h' if -F '#{pane_at_left}' '' 'select-pane -L' bind-key -T copy-mode-vi 'C-j' if -F '#{pane_at_bottom}' '' 'select-pane -D' bind-key -T copy-mode-vi 'C-k' if -F '#{pane_at_top}' '' 'select-pane -U' bind-key -T copy-mode-vi 'C-l' if -F '#{pane_at_right}' '' 'select-pane -R' # end https://github.com/aserowy/tmux.nvim set -g @catppuccin_flavour 'mocha' set -g @catppuccin_window_right_separator "█ " set -g @catppuccin_window_number_position "right" set -g @catppuccin_window_middle_separator " | " set -g @catppuccin_status_left_separator "█" set -g @catppuccin_status_right_separator "█" set -g @catppuccin_window_default_fill "all" set -g @catppuccin_window_current_fill "all" set -g @catppuccin_status_modules_right "application session user host" # Vi Mode on Prefix v bind 'v' copy-mode bind-key -T copy-mode-vi v send-keys -X begin-selection bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel # set-option -sa terminal-overrides ",xterm*:Tc" # Open panes in pwd bind '"' split-window -v -c "#{pane_current_path}" bind % split-window -h -c "#{pane_current_path}" # Transparent bar and at top # TODO: this isn't working atm # this is beacuse of the catppuccin theme somehow set-option -g status-style bg=default # set-option -g status-right-style "bg=yellow, fg=black" set-option -g status-position top # Prefix # WARN: this conflicts with my shell comletion binding unbind C-b set -g prefix C-space bind C-Space send-prefix run '~/.tmux/plugins/tpm/tpm' ```
screen shot of tmux in alacritty ![2023-09-14-183914_1920x1048_scrot](https://github.com/catppuccin/tmux/assets/103335462/e41fe69c-d25b-456a-89f6-30934cb88784)

best regards :wave:

roman-c-e commented 1 year ago

I have/had a similar issue this added to my tmux.conf after setting the theme worked for setting another background color

set status-bg "#000000"

i found the line in the catppuccin.tmux and changed the value, but I did not check about transparency, maybe there is a line in there as well

git-girl commented 1 year ago

I have/had a similar issue this added to my tmux.conf after setting the theme worked for setting another background color

set status-bg "#000000"

i found the line in the catppuccin.tmux and changed the value, but I did not check about transparency, maybe there is a line in there as well

thanks @roman-c-e but unfortunately this didn't work for me :/

jdrupal-dev commented 1 year ago

What is the status on this?

irigyano commented 1 year ago

I have/had a similar issue this added to my tmux.conf after setting the theme worked for setting another background color set status-bg "#000000" i found the line in the catppuccin.tmux and changed the value, but I did not check about transparency, maybe there is a line in there as well

thanks @roman-c-e but unfortunately this didn't work for me :/

Hello, I found the solution for tmux 3.2a, according to this stackoverflow answer:

status-fg and status-bg are now applied before status-style rather than instead of; this means that if either is set to default the status-style colour will be used. To fix, replace status-bg default with status-style bg=default.

by putting these two lines after run '~/.tmux/plugins/tpm/tpm' in tmux.conf

set -g status-bg default set -g status-style bg=default

What we do here is first overwriting status-bg provided by catppuccin plugin, then status-style setting should be working now,

hope this helps!

jdrupal-dev commented 1 year ago

Thanks. I can get it to work by manually editing the catppuccin plugin. I think it's because I use https://github.com/gpakosz/.tmux and they have a custom way of loading tpm.

jdrupal-dev commented 1 year ago

How can I make the background of the left and right section transparent? image

Will-Hendrix commented 1 year ago

I tried all of the suggested lines in the mentioned stackoverflow answer, but none of them removed the bar. I'm just looking to have it match the purple background; but even when I change the rgb value thm_bg of catppuccin-mocha.tmuxtheme, it only vaguely gets close rather than using the exact rgb value image

lpnh commented 11 months ago

For me what worked was this

Will-Hendrix commented 11 months ago

For me what worked was this

making the edit there didn't fix it for me image showing change made

migueltc13 commented 11 months ago

How can I make the background of the left and right section transparent? image

Hello I got it:

Screenshot from 2023-12-10 02-23-05

Here's the code catppuccin-tmux

jdrupal-dev commented 11 months ago

@migueltc13 I tried installing your fork, which made things a bit better, but I still have issues.

image

These are my settings:

# catppuccin configs
set -g @catppuccin_window_left_separator ""
set -g @catppuccin_window_right_separator " "
set -g @catppuccin_window_middle_separator " █"
set -g @catppuccin_window_number_position "right"

set -g @catppuccin_window_default_fill "number"
set -g @catppuccin_window_default_text "#W"

set -g @catppuccin_window_current_fill "number"
set -g @catppuccin_window_current_text "#W"

set -g @catppuccin_status_modules "session user date_time"
set -g @catppuccin_status_left_separator  " "
set -g @catppuccin_status_right_separator ""
set -g @catppuccin_status_right_separator_inverse "no"
set -g @catppuccin_status_fill "icon"
set -g @catppuccin_status_connect_separator "no"

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

set -g @catppuccin_directory_text "#{pane_current_path}"

set -g status-bg default
set -g status-style bg=default
migueltc13 commented 11 months ago

@jdrupal-dev you need to add this lines before tpm plugin call:

set -g status-bg default
set -g status-style bg=default

This will fix most of background issues on the right side (I hope), although I see the selected window got a blue background you will need to search for this color in the catppuccin.tmux and replace with "default".

Here's my current config:

# Options
...

# Set transparent bg for status bar
set -g status-style bg=default # Im using a recent version of tmux (´you may need to use set -g status-bg default´)
# set -g pane-active-border-style 'fg=magenta,bg=default'
# set -g pane-border-style 'fg=brightblack,bg=default'

# Plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'migueltc13/catppuccin-tmux'

# catppuccin config
set -g @catppuccin_window_left_separator ""
set -g @catppuccin_window_right_separator " "
set -g @catppuccin_window_middle_separator " █"
set -g @catppuccin_window_number_position "right"
set -g @catppuccin_window_default_fill "number"
set -g @catppuccin_window_default_text "#W"
set -g @catppuccin_window_current_fill "number"
set -g @catppuccin_window_current_text "#W#{?window_zoomed_flag,(),}"
set -g @catppuccin_status_modules_right "directory date_time"
set -g @catppuccin_status_modules_left "session"
set -g @catppuccin_status_left_separator  " "
set -g @catppuccin_status_right_separator " "
set -g @catppuccin_status_right_separator_inverse "no"
set -g @catppuccin_status_fill "icon"
set -g @catppuccin_status_connect_separator "no"
set -g @catppuccin_directory_text "#{pane_current_path}"
set -g @catppuccin_date_time_text "%H:%M"

# bootstrap tpm
if "test ! -d ~/.tmux/plugins/tpm" \
   "run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'

I tried using your config and had no issues: Screenshot from 2023-12-10 15-21-45

jdrupal-dev commented 11 months ago

I just tried rewriting my entire config. This is all I have.

source-file ~/.config/tmux/tmux.reset.conf
set-option -g default-terminal 'screen-254color'
set-option -g terminal-overrides ',xterm-256color:RGB'

set -g prefix ^A
set -g base-index 1              # start indexing windows at 1 instead of 0
set -g detach-on-destroy off     # don't exit from tmux when closing a session
set -g escape-time 0             # zero-out escape time delay
set -g history-limit 1000000     # increase history size (from 2,000)
set -g renumber-windows on       # renumber all windows when any window is closed
set -g set-clipboard on          # use system clipboard
set -g status-position top       # macOS / darwin style
set -g default-terminal "${TERM}"
setw -g mode-keys vi
set -g pane-active-border-style 'fg=magenta,bg=default'
set -g pane-border-style 'fg=brightblack,bg=default'

set -g status-bg default
set -g status-style bg=default

# bind-key -r B run-shell "~/.config/tmux/scripts/sessionizer.sh ~/.config"

set -g @fzf-url-fzf-options '-p 60%,30% --prompt="   " --border-label=" Open URL "'
set -g @fzf-url-history-limit '2000'

set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'fcsonline/tmux-thumbs'
set -g @plugin 'sainnhe/tmux-fzf'
set -g @plugin 'wfxr/tmux-fzf-url'
# set -g @plugin 'omerxx/catppuccin-tmux' # My fork that holds the meetings script bc I'm lazy af
set -g @plugin 'migueltc13/catppuccin-tmux'
set -g @plugin 'omerxx/tmux-sessionx'

set -g @sessionx-bind 'o'
set -g @sessionx-x-path '~/.config'
set -g @continuum-restore 'on'
set -g @resurrect-strategy-nvim 'session'
set -g @catppuccin_flavour 'macchiato'
set -g @catppuccin_window_left_separator ""
set -g @catppuccin_window_right_separator " "
set -g @catppuccin_window_middle_separator " █"
set -g @catppuccin_window_number_position "right"
set -g @catppuccin_window_default_fill "number"
set -g @catppuccin_window_default_text "#W"
set -g @catppuccin_window_current_fill "number"
set -g @catppuccin_window_current_text "#W#{?window_zoomed_flag,(),}"
set -g @catppuccin_status_modules_right "directory meetings date_time"
set -g @catppuccin_status_modules_left "session"
set -g @catppuccin_status_left_separator  " "
set -g @catppuccin_status_right_separator " "
set -g @catppuccin_status_right_separator_inverse "no"
set -g @catppuccin_status_fill "icon"
set -g @catppuccin_status_connect_separator "no"
set -g @catppuccin_directory_text "#{pane_current_path}"
set -g @catppuccin_meetings_text "#($HOME/.config/tmux/scripts/cal.sh)"
set -g @catppuccin_date_time_text "%H:%M"

# bootstrap tpm
if "test ! -d ~/.tmux/plugins/tpm" \
   "run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"

run '~/.tmux/plugins/tpm/tpm'
image
migueltc13 commented 11 months ago

This works on mine machine with no issues, whats your tmux version? I'm running tmux 3.2a

jdrupal-dev commented 11 months ago

I'm running tmux 3.3a, will try to downgrade.

jdrupal-dev commented 11 months ago

I just tested on tmux 3.2a, same result.

jdrupal-dev commented 11 months ago

@migueltc13 I reinstalled tmux and ran tmux kill-server, and now the transparent background is working! Thank you for the fix.

indesperate commented 11 months ago

@migueltc13 Thanks a lot for the fix, it works pretty fine, btw, I also change the "$thm_grep" to "$thm_bg" in "window_default_format.sh" to fix the color unconsistence when working with mulit-windows.

migueltc13 commented 10 months ago

@migueltc13 Thanks a lot for the fix, it works pretty fine, btw, I also change the "$thm_grep" to "$thm_bg" in "window_default_format.sh" to fix the color unconsistence when working with mulit-windows.

Thank you!

skela commented 10 months ago

did you guys ever get it to work with tmux version 3.3a? haven't been able to find a workaround at all. the closest I've got to is using @migueltc13 's fork, and it only seems to work for the right most and non-current window tabs - the left most session indicator and the current window tab, have a blue background colour behind it. Same thing happens in both kitty and wezterm.

2024-01-09-214431_hyprshot

2024-01-09-214505_hyprshot

skela commented 10 months ago

ah figured it out, this line here did the trick for tmux 3.3a: 2024-01-09-231338_hyprshot

setw window-status-current-style fg=default,bg=default

migueltc13 commented 10 months ago

@skela feel free to make a small pr, we appreciate it!

skela commented 10 months ago

@migueltc13 sure would love to, but a PR where, to this repo? or your repo? :D

My commit is here: https://github.com/skela/catppuccin-tmux/commit/aace5cad58ec97107b5b71d4fe177c623e8cae9c

I forked this repo, and grabbed yer changes since i think those are needed too for this to work.

migueltc13 commented 10 months ago

Feel free to make it in my repo and I'll accept it asap @skela

skela commented 10 months ago

sure, will do

skela commented 10 months ago

@migueltc13 - https://github.com/migueltc13/catppuccin-tmux/pull/1

migueltc13 commented 10 months ago

Merged, thank you @skela!

sgoudham commented 8 months ago

Reading through the thread, unsure how much is relevant to Catppuccin.

It seems obvious that it's somewhat difficult to overwrite the background and/or set a transparent background. I'll repurpose this issue as a tracker to add documentation/examples on how to do this.

We'd greatly appreciate a PR to the README for this!