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

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

Closed
git-girl opened this issue Sep 14, 2023 · 28 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@git-girl
Copy link

hey firstly thanks for more catppuccin 🌻

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
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

best regards 👋

@roman-c-e
Copy link

roman-c-e commented Sep 15, 2023

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
Copy link
Author

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
Copy link

What is the status on this?

@irigyano
Copy link

irigyano commented Nov 4, 2023

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
Copy link

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
Copy link

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

@Will-Hendrix
Copy link

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
Copy link

lpnh commented Dec 7, 2023

For me what worked was this

@Will-Hendrix
Copy link

For me what worked was this

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

@migueltc13
Copy link

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
Copy link

jdrupal-dev commented Dec 10, 2023

@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
Copy link

migueltc13 commented Dec 10, 2023

@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
Copy link

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
Copy link

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

@jdrupal-dev
Copy link

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

@jdrupal-dev
Copy link

I just tested on tmux 3.2a, same result.

@jdrupal-dev
Copy link

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

@indesperate
Copy link

indesperate commented Dec 19, 2023

@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
Copy link

@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
Copy link

skela commented Jan 9, 2024

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
Copy link

skela commented Jan 9, 2024

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
Copy link

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

@skela
Copy link

skela commented Jan 9, 2024

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

My commit is here:
skela@aace5ca

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

@migueltc13
Copy link

migueltc13 commented Jan 9, 2024

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

@skela
Copy link

skela commented Jan 9, 2024

sure, will do

@skela
Copy link

skela commented Jan 9, 2024

@migueltc13 - migueltc13#1

@migueltc13
Copy link

Merged, thank you @skela!

@sgoudham
Copy link
Contributor

sgoudham commented Mar 7, 2024

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!

@sgoudham sgoudham changed the title can't figure out how to overwrite background / set a transparent background Add documentation/examples on how to overwrite background and enable transparency Mar 7, 2024
@sgoudham sgoudham added the enhancement New feature or request label Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests