Merge pull request #38 from 89iuv/feature/add-user-and-host

Feature/add user and host
This commit is contained in:
Valentin Uveges 2023-04-03 07:58:42 +03:00 committed by GitHub
commit 4e48b09a76
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 68 additions and 0 deletions

View file

@ -52,6 +52,8 @@ All flavours support certain levels of customization that match our [Catppuccin
Style Guide][style-guide]. To add these customizations, add any of the following Style Guide][style-guide]. To add these customizations, add any of the following
options to your Tmux configuration. options to your Tmux configuration.
In order to have the correct icons displayed please use your favorite nerd fonts patched font.
##### Enable window tabs ##### Enable window tabs
By default, the theme places the `window-status` in the `status-right`. With By default, the theme places the `window-status` in the `status-right`. With
@ -73,6 +75,33 @@ set -g @catppuccin_left_separator "█"
set -g @catppuccin_right_separator "█" set -g @catppuccin_right_separator "█"
``` ```
##### Enable DateTime
By default, the `date_time` componenet is set to off.
It can be enabled by specifing any tmux date and time format.
```sh
set -g @catppuccin_date_time "%Y-%m-%d %H:%M"
```
##### Enable User
By default, the `user` componenet is set to off.
It can be enabled by toggoling it on.
```sh
set -g @catppuccin_user "on"
```
##### Enable Host
By default, the `host` componenet is set to off.
It can be enabled by toggoling it on.
```sh
set -g @catppuccin_host "on"
```
[style-guide]: https://github.com/catppuccin/catppuccin/blob/main/docs/style-guide.md [style-guide]: https://github.com/catppuccin/catppuccin/blob/main/docs/style-guide.md
## 💝 Thanks to ## 💝 Thanks to

View file

@ -73,22 +73,49 @@ main() {
left_separator="$(get_tmux_option "@catppuccin_left_separator" "")" left_separator="$(get_tmux_option "@catppuccin_left_separator" "")"
readonly left_separator readonly left_separator
local user
user="$(get_tmux_option "@catppuccin_user" "off")"
readonly user
local host
host="$(get_tmux_option "@catppuccin_host" "off")"
readonly host
local date_time
date_time="$(get_tmux_option "@catppuccin_date_time" "off")"
readonly date_time
# These variables are the defaults so that the setw and set calls are easier to parse. # These variables are the defaults so that the setw and set calls are easier to parse.
local show_directory local show_directory
readonly show_directory="#[fg=$thm_pink,bg=$thm_bg,nobold,nounderscore,noitalics]$right_separator#[fg=$thm_bg,bg=$thm_pink,nobold,nounderscore,noitalics] #[fg=$thm_fg,bg=$thm_gray] #{b:pane_current_path} #{?client_prefix,#[fg=$thm_red]" readonly show_directory="#[fg=$thm_pink,bg=$thm_bg,nobold,nounderscore,noitalics]$right_separator#[fg=$thm_bg,bg=$thm_pink,nobold,nounderscore,noitalics] #[fg=$thm_fg,bg=$thm_gray] #{b:pane_current_path} #{?client_prefix,#[fg=$thm_red]"
local show_window local show_window
readonly show_window="#[fg=$thm_pink,bg=$thm_bg,nobold,nounderscore,noitalics]$right_separator#[fg=$thm_bg,bg=$thm_pink,nobold,nounderscore,noitalics] #[fg=$thm_fg,bg=$thm_gray] #W #{?client_prefix,#[fg=$thm_red]" readonly show_window="#[fg=$thm_pink,bg=$thm_bg,nobold,nounderscore,noitalics]$right_separator#[fg=$thm_bg,bg=$thm_pink,nobold,nounderscore,noitalics] #[fg=$thm_fg,bg=$thm_gray] #W #{?client_prefix,#[fg=$thm_red]"
local show_session local show_session
readonly show_session="#[fg=$thm_green]}#[bg=$thm_gray]$right_separator#{?client_prefix,#[bg=$thm_red],#[bg=$thm_green]}#[fg=$thm_bg] #[fg=$thm_fg,bg=$thm_gray] #S " readonly show_session="#[fg=$thm_green]}#[bg=$thm_gray]$right_separator#{?client_prefix,#[bg=$thm_red],#[bg=$thm_green]}#[fg=$thm_bg] #[fg=$thm_fg,bg=$thm_gray] #S "
local show_directory_in_window_status local show_directory_in_window_status
readonly show_directory_in_window_status="#[fg=$thm_bg,bg=$thm_blue] #I #[fg=$thm_fg,bg=$thm_gray] #{b:pane_current_path} " readonly show_directory_in_window_status="#[fg=$thm_bg,bg=$thm_blue] #I #[fg=$thm_fg,bg=$thm_gray] #{b:pane_current_path} "
local show_directory_in_window_status_current local show_directory_in_window_status_current
readonly show_directory_in_window_status_current="#[fg=$thm_bg,bg=$thm_orange] #I #[fg=$thm_fg,bg=$thm_bg] #{b:pane_current_path} " readonly show_directory_in_window_status_current="#[fg=$thm_bg,bg=$thm_orange] #I #[fg=$thm_fg,bg=$thm_bg] #{b:pane_current_path} "
local show_window_in_window_status local show_window_in_window_status
readonly show_window_in_window_status="#[fg=$thm_fg,bg=$thm_bg] #W #[fg=$thm_bg,bg=$thm_blue] #I#[fg=$thm_blue,bg=$thm_bg]$left_separator#[fg=$thm_fg,bg=$thm_bg,nobold,nounderscore,noitalics] " readonly show_window_in_window_status="#[fg=$thm_fg,bg=$thm_bg] #W #[fg=$thm_bg,bg=$thm_blue] #I#[fg=$thm_blue,bg=$thm_bg]$left_separator#[fg=$thm_fg,bg=$thm_bg,nobold,nounderscore,noitalics] "
local show_window_in_window_status_current local show_window_in_window_status_current
readonly show_window_in_window_status_current="#[fg=$thm_fg,bg=$thm_gray] #W #[fg=$thm_bg,bg=$thm_orange] #I#[fg=$thm_orange,bg=$thm_bg]$left_separator#[fg=$thm_fg,bg=$thm_bg,nobold,nounderscore,noitalics] " readonly show_window_in_window_status_current="#[fg=$thm_fg,bg=$thm_gray] #W #[fg=$thm_bg,bg=$thm_orange] #I#[fg=$thm_orange,bg=$thm_bg]$left_separator#[fg=$thm_fg,bg=$thm_bg,nobold,nounderscore,noitalics] "
local show_user
readonly show_user="#[fg=$thm_blue,bg=$thm_gray]$right_separator#[fg=$thm_bg,bg=$thm_blue] #[fg=$thm_fg,bg=$thm_gray] #(whoami) "
local show_host
readonly show_host="#[fg=$thm_blue,bg=$thm_gray]$right_separator#[fg=$thm_bg,bg=$thm_blue]󰒋 #[fg=$thm_fg,bg=$thm_gray] #H "
local show_date_time
readonly show_date_time="#[fg=$thm_blue,bg=$thm_gray]$right_separator#[fg=$thm_bg,bg=$thm_blue] #[fg=$thm_fg,bg=$thm_gray] $date_time "
# Right column 1 by default shows the Window name. # Right column 1 by default shows the Window name.
local right_column1=$show_window local right_column1=$show_window
@ -107,6 +134,18 @@ main() {
window_status_current_format=$show_window_in_window_status_current window_status_current_format=$show_window_in_window_status_current
fi fi
if [[ "${user}" == "on" ]]; then
right_column2=$right_column2$show_user
fi
if [[ "${host}" == "on" ]]; then
right_column2=$right_column2$show_host
fi
if [[ "${date_time}" != "off" ]]; then
right_column2=$right_column2$show_date_time
fi
set status-left "" set status-left ""
set status-right "${right_column1},${right_column2}" set status-right "${right_column1},${right_column2}"