Merge branch 'main' of github.com:catppuccin/tmux

This commit is contained in:
RingOfStorms (Josh) 2024-09-28 21:45:05 -05:00
commit 9ad5166310
51 changed files with 1729 additions and 579 deletions

46
.github/ISSUE_TEMPLATE/bug.yml vendored Normal file
View file

@ -0,0 +1,46 @@
name: Bug Report
description: Report your bugs with the theme here!
labels: [bug]
body:
- type: checkboxes
attributes:
label: Is there an existing issue outlining your problem?
description: Please search to see if an issue already exists for your problem.
options:
- label: I have searched the existing issues and they do not solve my problem.
required: true
- type: textarea
attributes:
label: Describe your problem.
description: Also tell us, what do you expect to see?
placeholder: The battery charging icon is missing...
validations:
required: true
- type: textarea
attributes:
label: Paste your configuration.
description: Provide us with the contents of your `.tmux.conf` file.
placeholder: |
```sh
set -g @plugin 'catppuccin/tmux'
set -g @plugin 'tmux-plugins/tpm'
# ...
run ~/.config/tmux/tpm/tpm
```
validations:
required: true
- type: textarea
attributes:
label: Attach screenshots.
description: If applicable, attach screenshots which clearly highlight the issue.
- type: input
attributes:
label: What tmux version are you seeing the issue on?
description: "You can find your version by running `tmux -V`"
placeholder: tmux 3.3a
validations:
required: true
- type: textarea
attributes:
label: Any additional comments?
description: Add any information that hasn't been covered in the previous sections!

11
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View file

@ -0,0 +1,11 @@
blank_issues_enabled: false
contact_links:
- name: Ask A Question
url: https://github.com/catppuccin/tmux/discussions/new?category=q-a
about: Need help tweaking your Catppuccin tmux configuration? Ask questions in GitHub Discussions!
- name: Show & Tell
url: https://github.com/catppuccin/tmux/discussions/new?category=show-tell
about: Want to showcase your customised Catppuccin tmux configuration? Show it off in GitHub Discussions!
- name: Community Discord
url: https://discord.com/servers/catppuccin-907385605422448742
about: Chat to other community members!

18
.github/ISSUE_TEMPLATE/enhancement.yml vendored Normal file
View file

@ -0,0 +1,18 @@
name: Enhancement Issue
description: Request improvements to the theme here!
labels: [enhancement]
body:
- type: checkboxes
attributes:
label: Is there an existing issue outlining your improvement?
description: Please search to see if your improvement has already been raised as an issue.
options:
- label: I have searched the existing issues and my improvement has not been raised yet.
required: true
- type: textarea
attributes:
label: What would you like to see added and/or changed?
description: Make sure to mention why you think this is an improvement!
placeholder: I'd like to have an extra configuration option for...
validations:
required: true

18
.github/ISSUE_TEMPLATE/meta.yml vendored Normal file
View file

@ -0,0 +1,18 @@
name: Meta Issue
description: Raise any issue regarding the repository here!
labels: [meta]
body:
- type: checkboxes
attributes:
label: Is there an existing issue outlining your problem?
description: Please search to see if an issue already exists for your problem.
options:
- label: I have searched the existing issues and they do not solve my problem.
required: true
- type: textarea
attributes:
label: Describe your issue.
description: Bugs should be raised under a [Bug Report](https://github.com/catppuccin/tmux/issues/new?assignees=&labels=bug&template=bug.yml).
placeholder: The README is missing crucial information such as...
validations:
required: true

13
.github/release-please-config.json vendored Normal file
View file

@ -0,0 +1,13 @@
{
"last-release-sha": "408c02ccf44d0a59a7a63ce2b65c5c29982c5c0e",
"packages": {
".": {
"release-type": "simple",
"changelog-path": "CHANGELOG.md",
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": false,
"draft": false
}
},
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
}

3
.github/release-please-manifest.json vendored Normal file
View file

@ -0,0 +1,3 @@
{
".": "0.2.0"
}

71
.github/scripts/test.bash vendored Executable file
View file

@ -0,0 +1,71 @@
#!/usr/bin/env bash
#
# Usage:
# ./test.bash catpuccin-tmux/catpuccin-tmux.tmux
# ./test.bash catpuccin-tmux/catpuccin-tmux.tmux ./config-example1
#
SOCKET_NAME="${SOCKET_NAME:-test}"
tmux() {
command tmux -L "$SOCKET_NAME" "$@"
}
start_tmux_server() {
echo "Starting tmux server" >&2
tmux new -s dummy -d
}
kill_tmux_server() {
echo "Stopping tmux server" >&2
tmux kill-server
}
check() {
local out exit_code
exit_code="$1"
out="$2"
if [ "$exit_code" -ne 0 ] || [ -n "$out" ]; then
echo "Failed with exit code $exit_code and output:"
echo "$out"
exit 1
fi
}
main() {
local config_file plugin output exit_code
plugin="$1"
config_file="$2"
echo "Using socket '$SOCKET_NAME'" >&2
# Make sure its a new/clean server
kill_tmux_server 2>/dev/null
start_tmux_server
if [ -z "$config_file" ]; then
echo "No config file provided" >&2
else
echo "sourcing config file '$config_file'" >&2
tmux source-file "$config_file"
fi
if [ -z "$plugin" ]; then
echo "ERROR: No path to the plugin provided" >&2
exit 1
else
echo "Running plugin: $plugin" >&2
output="$(tmux run-shell "$plugin" 2>&1)"
exit_code="$?"
check "$exit_code" "$output"
fi
kill_tmux_server
}
main "$@"

45
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,45 @@
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
name: release-please
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
config-file: .github/release-please-config.json
manifest-file: .github/release-please-manifest.json
- uses: actions/checkout@v4
- name: tag major and minor versions
if: ${{ steps.release.outputs.release_created }}
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git remote add gh-token "https://${{ secrets.GITHUB_TOKEN }}@github.com/googleapis/release-please-action.git"
git tag -d latest || true
git tag -d v${{ steps.release.outputs.major }} || true
git tag -d v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true
git push origin :latest || true
git push origin :v${{ steps.release.outputs.major }} || true
git push origin :v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true
git tag -a latest -m "Release v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}"
git tag -a v${{ steps.release.outputs.major }} -m "Release v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}"
git tag -a v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} -m "Release v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}"
git push origin latest
git push origin v${{ steps.release.outputs.major }}
git push origin v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}

32
.github/workflows/shellcheck.yml vendored Normal file
View file

@ -0,0 +1,32 @@
---
name: Shellcheck
permissions:
contents: read
on:
pull_request:
paths-ignore:
- "*.md"
- "assets/**"
push:
paths-ignore:
- "*.md"
- "assets/**"
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
additional_files: "catppuccin.tmux"
env:
SHELLCHECK_OPTS: "-a"

51
.github/workflows/test.yml vendored Normal file
View file

@ -0,0 +1,51 @@
---
name: Tests
permissions:
contents: read
on:
pull_request:
paths-ignore:
- "*.md"
- "assets/**"
push:
paths-ignore:
- "*.md"
- "assets/**"
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
ubuntu:
name: Test
runs-on: ubuntu-latest
steps:
- name: Install tmux
run: sudo apt-get update && sudo apt-get install -y tmux=3.2a-4ubuntu0.2
- uses: actions/checkout@v4
- name: Config and Plugin
shell: bash
run: |
bash --version
tmux -V
./.github/scripts/test.bash ./catppuccin.tmux
old-bash:
name: "Old Bash"
runs-on: ubuntu-latest
container:
image: bash:3.2.57-alpine3.19 # Bash version used by macos
steps:
- uses: actions/checkout@v4
- name: Check Syntax is Valid
shell: bash
run: |
apk update
apk add tmux
bash --version
tmux -V
./.github/scripts/test.bash ./catppuccin.tmux

2
.gitignore vendored
View file

@ -1 +1,3 @@
custom custom
!custom/README.md
!custom/example.sh

6
.shellcheckrc Normal file
View file

@ -0,0 +1,6 @@
shell=bash
# TODO: Find a way to declare color variables
disable=SC2154
external-sources=true

32
CHANGELOG.md Normal file
View file

@ -0,0 +1,32 @@
# Changelog
## [0.2.0](https://github.com/catppuccin/tmux/compare/v0.1.0...v0.2.0) (2024-08-23)
### Features
* error/warning messages on first load ([#278](https://github.com/catppuccin/tmux/issues/278)) ([a2dda02](https://github.com/catppuccin/tmux/commit/a2dda02b43194aec5deddf2890c28c76b4c11ed4))
* warn users of whitespace in module lists ([#266](https://github.com/catppuccin/tmux/issues/266)) ([362a306](https://github.com/catppuccin/tmux/commit/362a306db71794f04d0995fc058bcaa094d1af70))
### Bug Fixes
* add missing batch options `catppuccin_pane{,_active}_border_style` ([3ffbc37](https://github.com/catppuccin/tmux/commit/3ffbc3700b4c1c3e2c4d015c5a51ccef555dabaf))
* add missing batch options catppuccin_pane{,_active}_border_style ([3ffbc37](https://github.com/catppuccin/tmux/commit/3ffbc3700b4c1c3e2c4d015c5a51ccef555dabaf))
* escaping in options ([#298](https://github.com/catppuccin/tmux/issues/298)) ([9b57c20](https://github.com/catppuccin/tmux/commit/9b57c2002081fff8af16b878f1369d46788c0409))
* **pomodoro_plus:** option names ([#273](https://github.com/catppuccin/tmux/issues/273)) ([51dde6e](https://github.com/catppuccin/tmux/commit/51dde6e8d4d3d8da97d915b01594a08aa4ac0cca))
* warning `[@catppuccin](https://github.com/catppuccin)_flavour` ([#296](https://github.com/catppuccin/tmux/issues/296)) ([a71f3c0](https://github.com/catppuccin/tmux/commit/a71f3c039bed8a7c49fc390a50befec5db2c4af9))
* warning `[@catppuccin](https://github.com/catppuccin)_window_status` ([9ee1695](https://github.com/catppuccin/tmux/commit/9ee1695d757c16e2f236858b8d3f88be9fb666fa))
### Performance Improvements
* batch tmux show ([#288](https://github.com/catppuccin/tmux/issues/288)) ([99013fa](https://github.com/catppuccin/tmux/commit/99013fafe6a98416079b3b84751f2eb540e17c79)), closes [#281](https://github.com/catppuccin/tmux/issues/281)
* batch tmux show-options ([3c6f6f2](https://github.com/catppuccin/tmux/commit/3c6f6f282b3bb17554dc2b4b80760b6507acfd65))
## [0.1.0](https://github.com/catppuccin/tmux/compare/v0.0.1...v0.1.0) (2024-08-04)
### Features
* releases ([#260](https://github.com/catppuccin/tmux/issues/260)) ([5fbacdf](https://github.com/catppuccin/tmux/commit/5fbacdf3559cf4496eef02aead087b3bb715e570))

43
CONTRIBUTING.md Normal file
View file

@ -0,0 +1,43 @@
# Contributing
## Adding a module
Follow the instructions from [custom](/custom), place the module in the appropriate
directory and document the module in `README.md`.
## Commit messages
This repository uses [Conventional Commits](https://conventionalcommits.org).
Commit headers should be lowercase. Most commits should include a body that briefly
describes the motivation and content of the commit.
### Commit types
- `fix`: A bug fix that doesn't modify the public API
- `feat`: A code change that modifies the public API
- `refactor`: A code change that doesn't change behavior
- `style`: A style fix or change
- `docs`: Any change to documentation
- `ci`: Any change to CI files
- `revert`: A revert commit. The message should describe the reasoning and the
commit should include the `Refs:` footer with the short hashes of the commits
being reverted.
- `chore`: catch-all type
### Commit scopes
Available commit scopes are module names, `status`, `pane`, and
`window`. If none of these apply, omit the scope.
### Breaking changes
All breaking changes should be documented in the commit footer in the format
described by Conventional Commits. Use the `<type>!` syntax in order to distinguish
breaking commits in the log, but include the footer to provide a better description
for the changelog generator.
```
feat(bar)!: foo the bars
BREAKING CHANGE: bars are now foo'ed
```

363
README.md
View file

@ -18,35 +18,36 @@
## Content ## Content
1. [Themes](#themes) 1. [Themes](#themes)
2. [Installation](#installation) 1. [Installation](#installation)
3. [Overview](#overview) 1. [Overview](#overview)
4. [Configuration options](#configuration-options) 1. [Configuration options](#configuration-options)
1. [Window](#window) 1. [Window](#window)
2. [Window default](#window-default) 1. [Window default](#window-default)
3. [Window current](#window-current) 1. [Window current](#window-current)
4. [Status](#status) 1. [Status](#status)
4. [Pane](#pane) 1. [Pane](#pane)
5. [Customizing modules](#customizing-modules) 1. [Customizing modules](#customizing-modules)
6. [Battery module](#battery-module) 1. [Battery module](#battery-module)
7. [CPU module](#CPU-module) 1. [CPU module](#CPU-module)
8. [Weather module](#weather-module) 1. [Weather modules](#weather-modules)
5. [Create a custom module](#create-a-custom-module) 1. [Load module](#load-module)
6. [Configuration Examples](#configuration-examples) 1. [Create a custom module](#create-a-custom-module)
1. [Configuration Examples](#configuration-examples)
1. [Config 1](#config-1) 1. [Config 1](#config-1)
2. [Config 2](#config-2) 1. [Config 2](#config-2)
3. [Config 3](#config-3) 1. [Config 3](#config-3)
## Themes ## Themes
- 🌻 [Latte](./catppuccin-latte.tmuxtheme) - 🌻 [Latte](./themes/catppuccin_latte.tmuxtheme)
- 🪴 [Frappé](./catppuccin-frappe.tmuxtheme) - 🪴 [Frappé](./themes/catppuccin_frappe.tmuxtheme)
- 🌺 [Macchiato](./catppuccin-macchiato.tmuxtheme) - 🌺 [Macchiato](./themes/catppuccin_macchiato.tmuxtheme)
- 🌿 [Mocha](./catppuccin-mocha.tmuxtheme) - 🌿 [Mocha](./themes/catppuccin_mocha.tmuxtheme)
## Installation ## Installation
In order to have the icons displayed correctly please use / update your favorite [patched font](https://www.nerdfonts.com/font-downloads). In order to have the icons displayed correctly please use/update your favorite [patched font](https://www.nerdfonts.com/font-downloads).
If you do not have a patched font installed, you can override or remove any icon. Check the documentation bellow on the options available. If you do not have a patched font installed, you can override or remove any icon. Check the documentation below on the options available.
### TPM ### TPM
@ -54,35 +55,53 @@ If you do not have a patched font installed, you can override or remove any icon
2. Add the Catppuccin plugin: 2. Add the Catppuccin plugin:
```bash ```bash
set -g @plugin 'catppuccin/tmux' set -g @plugin 'catppuccin/tmux#latest' # See https://github.com/catppuccin/tmux/tags for additional tags
# set -g @plugin 'catppuccin/tmux' # main branch
# ...alongside # ...alongside
set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tpm'
``` ```
3. (Optional) Set your preferred flavour, it defaults to `"mocha"`: 3. (Optional) Set your preferred flavor, it defaults to `"mocha"`:
```bash ```bash
set -g @catppuccin_flavour 'latte' # or frappe, macchiato, mocha set -g @catppuccin_flavor 'mocha' # latte,frappe, macchiato or mocha
``` ```
### Manual ### Manual
1. Copy your desired theme's configuration contents into your Tmux config (usually stored at `~/.tmux.conf`) 1. Clone this repository to your desired location (e.g.
2. Reload Tmux by either restarting the session or reloading it with `tmux source-file ~/.tmux.conf` `~/.config/tmux/plugins/catppuccin`)
2. Add the following line to your `tmux.conf` file:
`run ~/.config/tmux/plugins/catppuccin/catppuccin.tmux`
3. (Optional) Set your preferred flavor and/or add configuration options as
listed in [Configuration Options](#configuration-options).
4. Reload Tmux by either restarting the session or reloading it with `tmux source-file ~/.tmux.conf`
## Overview ## Overview
![Default](./assets/overview.png) ![Default](./assets/overview.png)
This is a diagram on how the theme is split between it's components. This is a diagram of how the theme is split between its components.
## Configuration options ## Configuration options
All flavours support certain levels of customization that match our [Catppuccin All flavors 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, you may add any of the
options to your Tmux configuration. following options to your Tmux configuration.
If you want to set a text-based customization to an emtpy string, use `null` to
do so. For instance:
```sh
set -g @catppuccin_icon_window_last "null"
```
### Window ### Window
### Set the window separator
```sh
set -g @catppuccin_window_separator ""
```
#### Set the window left separator: #### Set the window left separator:
```sh ```sh
set -g @catppuccin_window_left_separator "█" set -g @catppuccin_window_left_separator "█"
@ -108,19 +127,12 @@ Values:
#### Enable window status: #### Enable window status:
```sh ```sh
set -g @catppuccin_window_status_enable "yes" set -g @catppuccin_window_status "no"
``` ```
Values: Values:
- yes - this will enable the window status part
- no - this will disable the window status part - no - this will disable the window status part
- icon - this will replace the windows status text with icons
#### Enable window status icons instead of text: - text - this will keep the windows status in text format
```sh
set -g @catppuccin_window_status_icon_enable "yes"
```
Values:
- yes - this will replace the windows status text with icons
- no - this will keep the windows status in text format
#### Override windows status icons #### Override windows status icons
```sh ```sh
@ -129,7 +141,7 @@ set -g @catppuccin_icon_window_current "󰖯"
set -g @catppuccin_icon_window_zoom "󰁌" set -g @catppuccin_icon_window_zoom "󰁌"
set -g @catppuccin_icon_window_mark "󰃀" set -g @catppuccin_icon_window_mark "󰃀"
set -g @catppuccin_icon_window_silent "󰂛" set -g @catppuccin_icon_window_silent "󰂛"
set -g @catppuccin_icon_window_activity "󰖲" set -g @catppuccin_icon_window_activity "󱅫"
set -g @catppuccin_icon_window_bell "󰂞" set -g @catppuccin_icon_window_bell "󰂞"
``` ```
@ -146,12 +158,12 @@ Values:
#### Override the window default colors: #### Override the window default colors:
```sh ```sh
set -g @catppuccin_window_default_text "color" # text color set -g @catppuccin_window_default_color "#{thm_blue}" # text color
set -g @catppuccin_window_default_background "color" set -g @catppuccin_window_default_background "#{thm_gray}"
``` ```
Values: Values:
- color - a hexadecimal color value - color - a theme color (`#{thm_<color>}`) or hexadecimal color value
#### Override the window default text: #### Override the window default text:
```sh ```sh
@ -171,68 +183,103 @@ Values:
#### Override the window current colors: #### Override the window current colors:
```sh ```sh
set -g @catppuccin_window_current_color "color" # text color set -g @catppuccin_window_current_color "#{thm_orange}" # text color
set -g @catppuccin_window_current_background "color" set -g @catppuccin_window_current_background "#{thm_bg}"
``` ```
Note that color and background fields are swapped when `@catppuccin_window_current_fill` is set to "all".
Values: Values:
- color - a hexadecimal color value - color - a theme color (`#{thm_<color>}`) or a hexadecimal color value
#### Override the window current text: #### Override the window current text:
```sh ```sh
set -g @catppuccin_window_current_text "#{b:pane_current_path}" # use "#W" for application instead of directory set -g @catppuccin_window_current_text "#{b:pane_current_path}" # use "#W" for application instead of directory
``` ```
#### Set the current directory format #### Override the window current separators
```sh ```sh
set -g @catppuccin_window_current_format_directory_text "#{b:pane_current_path}" set -g @catppuccin_window_current_left_separator ""
set -g @catppuccin_window_current_middle_separator "█"
set -g @catppuccin_window_current_right_separator ""
``` ```
Use this to overide the way the current directory is displayed.
#### Set the directory format
```sh
set -g @catppuccin_window_format_directory_text "#{b:pane_current_path}"
```
Use this to overide the way the directory is displayed.
### Pane ### Pane
#### Set the pane border style: #### Set the pane border style:
set -g @catppuccin_pane_border_style "fg=blue" # Use a value compatible with the standard tmux 'pane-border-style' ```sh
set -g @catppuccin_pane_border_style "fg=#{thm_gray}" # Use a value compatible with the standard tmux 'pane-border-style'
```
#### Set the pane active border style: #### Set the pane active border style:
set -g @catppuccin_pane_active_border_style "fg=red" # Use a value compatible with the standard tmux 'pane-border-active-style' ```sh
set -g @catppuccin_pane_active_border_style "fg=#{thm_orange}" # Use a value compatible with the standard tmux 'pane-border-active-style'
```
### Menu
#### Set the menu style:
```sh
set -g @catppuccin_menu_style "default" # Use a value compatible with the standard tmux `menu-style`
```
#### Set the menu selected style:
```sh
set -g @catppuccin_menu_selected_style "fg=#{thm_gray},bg=#{thm_yellow}" # Use a value compatible with the standard tmux `menu-selected-style`
```
### Set the menu border style:
```sh
set -g @catppuccin_menu_border_style "default" # Use a value compatible with the standard tmux `menu-border-style`
```
### Status ### Status
#### Set the default status bar visibility
```sh
set -g @catppuccin_status_default "on"
```
#### Override the default status background color
```sh
set -g @catppuccin_status_background "theme"
```
This will overwrite the status bar background:
- "theme" will use the color from the selected theme
- "default" will make the status bar transparent
- use hex color codes for other colors or a theme color (`#{thm_<color>}`)
Note: you need to restart tmux for this to take effect:
```sh
tmux kill-server & tmux
```
#### Set the status module left separator: #### Set the status module left separator:
```sh ```sh
set -g @catppuccin_status_left_separator "" set -g @catppuccin_status_left_separator ""
``` ```
#### Set the status module middle separator:
```sh
set -g @catppuccin_status_middle_separator "null"
```
#### Set the status module right separator: #### Set the status module right separator:
```sh ```sh
set -g @catppuccin_status_right_separator "█" set -g @catppuccin_status_right_separator "█"
``` ```
#### Set the status module right separator inverse:
```sh
set -g @catppuccin_status_right_separator_inverse "no"
```
Values:
- yes - the colors will be inverted for the right separator
- no - the colors will not be inverted for the right separator
#### Set the status connect separator: #### Set the status connect separator:
```sh ```sh
set -g @catppuccin_status_connect_separator "yes" set -g @catppuccin_status_connect_separator "yes"
``` ```
Values: Values:
- yes - the background color of the separator will not blend in with the brackground color of tmux - yes - the background color of the separator will not blend in with the background color of tmux
- no - the background color of the separator will blend in with the brackground color of tmux - no - the background color of the separator will blend in with the background color of tmux
#### Set the status module color fill: #### Set the status module color fill:
@ -243,28 +290,37 @@ Values:
- icon - only the icon of the module will have color - icon - only the icon of the module will have color
- all - the entire module will have the same color - all - the entire module will have the same color
#### Set the status module justify value:
```sh
set -g @catppuccin_status_justify "left"
```
Values:
- left
- centre - puts the window list in the relative centre of the available free space
- right
- absolute-centre - uses the centre of the entire horizontal space
### Pane ### Pane
```sh ```sh
tmux_orange="#fab387" set -g @catppuccin_pane_status_enabled "no"
set -g @catppuccin_pane_status_enabled "yes" set -g @catppuccin_pane_border_status "off" # See `pane-border-status`
set -g @catppuccin_pane_border_status "top" set -g @catppuccin_pane_left_separator "█"
set -g @catppuccin_pane_left_separator "" set -g @catppuccin_pane_right_separator "█"
set -g @catppuccin_pane_right_separator "" set -g @catppuccin_pane_middle_separator "█"
set -g @catppuccin_pane_middle_separator "█ "
set -g @catppuccin_pane_number_position "left" set -g @catppuccin_pane_number_position "left"
set -g @catppuccin_pane_default_fill "number" set -g @catppuccin_pane_default_fill "number"
set -g @catppuccin_pane_default_text "#{b:pane_current_path}" set -g @catppuccin_pane_default_text "#{b:pane_current_path}"
set -g @catppuccin_pane_border_style "fg=$tmux_orange" set -g @catppuccin_pane_border_style "fg=#{thm_orange}"
set -g @catppuccin_pane_active_border_style "fg=$tmux_orange" set -g @catppuccin_pane_active_border_style "fg=#{thm_orange}"
set -g @catppuccin_pane_color "$tmux_orange" set -g @catppuccin_pane_color "#{thm_orange}"
set -g @catppuccin_pane_background_color "$tmux_orange" set -g @catppuccin_pane_background_color "#{thm_orange}"
``` ```
#### Set the module list #### Set the module list
```sh ```sh
set -g @catppuccin_status_modules_right "application session" set -g @catppuccin_status_modules_right "application session"
set -g @catppuccin_status_modules_left "" set -g @catppuccin_status_modules_left "null"
``` ```
Provide a list of modules and the order in which you want them to appear in the status. Provide a list of modules and the order in which you want them to appear in the status.
@ -275,6 +331,7 @@ Available modules:
- user - display the username - user - display the username
- host - display the hostname - host - display the hostname
- date_time - display the date and time - date_time - display the date and time
- uptime - display the uptime
- [battery](#battery-module) - display the battery - [battery](#battery-module) - display the battery
### Customizing modules ### Customizing modules
@ -296,23 +353,13 @@ set -g @catppuccin_[module_name]_color "color"
set -g @catppuccin_[module_name]_text "text" set -g @catppuccin_[module_name]_text "text"
``` ```
#### Removing a specific module option
```sh
set -g @catppuccin_[module_name]_[option] "null"
```
This is for the situation where you want to remove the icon from a module.
Ex:
```sh
set -g @catppuccin_date_time_icon "null"
```
### Battery module ### Battery module
#### Requirements #### Requirements
This module depends on [tmux-battery](https://github.com/tmux-plugins/tmux-battery/tree/master). This module depends on [tmux-battery](https://github.com/tmux-plugins/tmux-battery/tree/master).
#### Install #### Install
The prefered way to install tmux-battery is using [TPM](https://github.com/tmux-plugins/tpm). The preferred way to install tmux-battery is using [TPM](https://github.com/tmux-plugins/tpm).
#### Configure #### Configure
Load tmux-battery after you load catppuccin. Load tmux-battery after you load catppuccin.
@ -333,7 +380,7 @@ set -g @catppuccin_status_modules_right "... battery ..."
This module depends on [tmux-cpu](https://github.com/tmux-plugins/tmux-cpu/tree/master). This module depends on [tmux-cpu](https://github.com/tmux-plugins/tmux-cpu/tree/master).
#### Install #### Install
The prefered way to install tmux-cpu is using [TPM](https://github.com/tmux-plugins/tpm). The preferred way to install tmux-cpu is using [TPM](https://github.com/tmux-plugins/tpm).
#### Configure #### Configure
Load tmux-cpu after you load catppuccin. Load tmux-cpu after you load catppuccin.
@ -348,15 +395,17 @@ Add the cpu module to the status modules list.
set -g @catppuccin_status_modules_right "... cpu ..." set -g @catppuccin_status_modules_right "... cpu ..."
``` ```
### Weather module ### Weather modules
#### Requirements #### tmux-weather
##### Requirements
This module depends on [tmux-weather](https://github.com/xamut/tmux-weather). This module depends on [tmux-weather](https://github.com/xamut/tmux-weather).
#### Install ##### Install
The prefered way to install tmux-cpu is using [TPM](https://github.com/tmux-plugins/tpm). The preferred way to install tmux-weather is using [TPM](https://github.com/tmux-plugins/tpm).
#### Configure ##### Configure
Load tmux-weather after you load catppuccin. Load tmux-weather after you load catppuccin.
```sh ```sh
set -g @plugin 'catppuccin/tmux' set -g @plugin 'catppuccin/tmux'
@ -369,11 +418,121 @@ Add the weather module to the status modules list.
set -g @catppuccin_status_modules_right "... weather ..." set -g @catppuccin_status_modules_right "... weather ..."
``` ```
#### tmux-clima
##### Requirements
This module depends on [tmux-clima](https://github.com/vascomfnunes/tmux-clima).
##### Install
The preferred way to install tmux-clima is using [TPM](https://github.com/tmux-plugins/tpm).
##### Configure
Load tmux-clima after you load catppuccin.
```sh
set -g @plugin 'catppuccin/tmux'
...
set -g @plugin 'vascomfnunes/tmux-clima'
```
Add the weather module to the status modules list.
```sh
set -g @catppuccin_status_modules_right "... clima ..."
```
### Load module
#### Requirements
This module depends on [tmux-loadavg](https://github.com/jamesoff/tmux-loadavg).
#### Install
The preferred way to install tmux-loadavg is using [TPM](https://github.com/tmux-plugins/tpm).
#### Configure
Load tmux-loadavg after you load catppuccin.
```sh
set -g @plugin 'catppuccin/tmux'
...
set -g @plugin 'jamesoff/tmux-loadavg'
```
Add the load module to the status modules list.
```sh
set -g @catppuccin_status_modules_right "... load ..."
```
### Gitmux module
#### Requirements
This module depends on [gitmux](https://github.com/arl/gitmux).
#### Install
To install gitmux, follow the instructions in the [gitmux documentation](https://github.com/arl/gitmux/blob/main/README.md#installing).
#### Configure
Add the gitmux module to the status modules list.
```sh
set -g @catppuccin_status_modules_right "... gitmux ..."
```
To customize the gitmux module, you can follow the instrucctions in the [gitmux documentation](https://github.com/arl/gitmux/blob/main/README.md#customizing) and add this line in your tmux configuration:
```sh
set -g @catppuccin_gitmux_text "#(gitmux -cfg $HOME/.gitmux.conf \"#{pane_current_path}\")"
```
### Pomodoro module
#### Requirements
This module depends on [tmux-pomodoro-plus](https://github.com/olimorris/tmux-pomodoro-plus/tree/main).
#### Install
The preferred way to install tmux-pomodoro-plus is using [TPM](https://github.com/tmux-plugins/tpm).
#### Configure
Load tmux-pomodoro-plus after you load catppuccin.
```sh
set -g @plugin 'catppuccin/tmux'
...
set -g @plugin 'olimorris/tmux-pomodoro-plus'
```
Add the pomodoro module to the status modules list.
```sh
set -g @catppuccin_status_modules_right "... pomodoro_plus ..."
```
### Kube module
#### Requirements
This module depends on [kube-tmux](https://github.com/jonmosco/kube-tmux).
#### Install
The preferred way to install kube-tmux is using [TPM](https://github.com/tmux-plugins/tpm).
#### Configure
```sh
set -g @plugin 'catppuccin/tmux'
...
set -g @plugin 'jonmosco/kube-tmux'
```
Add the tmux module to the status modules list.
```sh
set -g @catppuccin_status_modules_right "... kube ..."
```
Optionally override the kube-tmux colors
```sh
set -g @catppuccin_kube_context_color "#{thm_red}"
set -g @catppuccin_kube_namespace_color "#{thm_cyan}"
```
## Create a custom module ## Create a custom module
It is possible to add a new custom module or overrite any of the existing modules. It is possible to add a new custom module or overwrite any of the existing modules.
Look into custom/README.md for more details. For further details, see the documentation in [custom/README.md](custom/README.md)
Any file added to the custom folder will be preserved when updating catppuccin. Any file added to the custom folder will be preserved when updating catppuccin.
@ -385,7 +544,7 @@ When switching between configurations run:
```sh ```sh
tmux kill-server tmux kill-server
``` ```
In order to kill the tmux server and clear all global variables. To kill the tmux server and clear all global variables.
### Config 1 ### Config 1
@ -424,9 +583,8 @@ set -g @catppuccin_window_current_text "#{pane_current_path}"
set -g @catppuccin_status_modules_right "application session date_time" set -g @catppuccin_status_modules_right "application session date_time"
set -g @catppuccin_status_left_separator "" set -g @catppuccin_status_left_separator ""
set -g @catppuccin_status_right_separator " " set -g @catppuccin_status_right_separator " "
set -g @catppuccin_status_right_separator_inverse "yes"
set -g @catppuccin_status_fill "all" set -g @catppuccin_status_fill "all"
set -g @catppuccin_status_connect_separator "no" set -g @catppuccin_status_connect_separator "yes"
``` ```
### Config 3 ### Config 3
@ -447,7 +605,6 @@ set -g @catppuccin_window_current_text "#W"
set -g @catppuccin_status_modules_right "directory user host session" set -g @catppuccin_status_modules_right "directory user host session"
set -g @catppuccin_status_left_separator " " set -g @catppuccin_status_left_separator " "
set -g @catppuccin_status_right_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_fill "icon"
set -g @catppuccin_status_connect_separator "no" set -g @catppuccin_status_connect_separator "no"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Before After
Before After

49
builder/module_builder.sh Normal file
View file

@ -0,0 +1,49 @@
#!/bin/sh
build_status_module() {
local index="$1"
local icon="$2"
local color="$3"
local text="$4"
if [ "$status_fill" = "icon" ]; then
local bg
local show_icon="#[fg=$thm_bg,bg=$color,nobold,nounderscore,noitalics]$icon "
local show_text="#[fg=$thm_fg,bg=$thm_gray] $text"
if [ "$status_connect_separator" = "yes" ]; then
bg="$thm_gray"
else
bg="default"
fi
local show_left_separator="#[fg=$color,bg=$bg,nobold,nounderscore,noitalics]$status_left_separator"
local show_middle_separator="#[fg=$color,bg=$thm_gray,nobold,nounderscore,noitalics]$status_middle_separator"
local show_right_separator="#[fg=$thm_gray,bg=$bg,nobold,nounderscore,noitalics]$status_right_separator"
fi
if [ "$status_fill" = "all" ]; then
local show_icon="#[fg=$thm_bg,bg=$color,nobold,nounderscore,noitalics]$icon "
local show_text="#[fg=$thm_bg,bg=$color]$text"
if [ "$status_connect_separator" = "yes" ]; then
local show_left_separator="#[fg=$color,nobold,nounderscore,noitalics]$status_left_separator"
local show_right_separator="#[fg=$color,bg=$color,nobold,nounderscore,noitalics]$status_right_separator"
else
local show_left_separator="#[fg=$color,bg=default,nobold,nounderscore,noitalics]$status_left_separator"
local show_right_separator="#[fg=$color,bg=default,nobold,nounderscore,noitalics]$status_right_separator"
fi
fi
if [ $((index)) -eq 0 ]; then
local show_left_separator="#[fg=$color,bg=default,nobold,nounderscore,noitalics]$status_left_separator"
fi
if [ -z "$icon" ] ; then
show_icon=""
fi
echo "$show_left_separator$show_icon$show_middle_separator$show_text$show_right_separator"
}

64
builder/pane_builder.sh Normal file
View file

@ -0,0 +1,64 @@
#!/bin/sh
build_pane_format() {
local number=$1
local color=$2
local background=$3
local text=$4
local fill=$5
if [ "$pane_status_enable" = "yes" ]
then
if [ "$fill" = "none" ]
then
local show_left_separator="#[fg=$thm_gray,bg=default,nobold,nounderscore,noitalics]$pane_left_separator"
local show_number="#[fg=$thm_fg,bg=$thm_gray]$number"
local show_middle_separator="#[fg=$thm_fg,bg=$thm_gray,nobold,nounderscore,noitalics]$pane_middle_separator"
local show_text="#[fg=$thm_fg,bg=$thm_gray]$text"
local show_right_separator="#[fg=$thm_gray,bg=default]$pane_right_separator"
fi
if [ "$fill" = "all" ]
then
local show_left_separator="#[fg=$color,bg=default,nobold,nounderscore,noitalics]$pane_left_separator"
local show_number="#[fg=$background,bg=$color]$number"
local show_middle_separator="#[fg=$background,bg=$color,nobold,nounderscore,noitalics]$pane_middle_separator"
local show_text="#[fg=$background,bg=$color]$text"
local show_right_separator="#[fg=$color,bg=default]$pane_right_separator"
fi
if [ "$fill" = "number" ]
then
local show_number="#[fg=$background,bg=$color]$number"
local show_middle_separator="#[fg=$color,bg=$background,nobold,nounderscore,noitalics]$pane_middle_separator"
local show_text="#[fg=$thm_fg,bg=$background]$text"
if [ "$pane_number_position" = "right" ]
then
local show_left_separator="#[fg=$background,bg=default,nobold,nounderscore,noitalics]$pane_left_separator"
local show_right_separator="#[fg=$color,bg=default]$pane_right_separator"
fi
if [ "$pane_number_position" = "left" ]
then
local show_right_separator="#[fg=$background,bg=default,nobold,nounderscore,noitalics]$pane_right_separator"
local show_left_separator="#[fg=$color,bg=default]$pane_left_separator"
fi
fi
local final_pane_format
if [ "$pane_number_position" = "right" ]
then
final_pane_format="$show_left_separator$show_text$show_middle_separator$show_number$show_right_separator"
fi
if [ "$pane_number_position" = "left" ]
then
final_pane_format="$show_left_separator$show_number$show_middle_separator$show_text$show_right_separator"
fi
echo "$final_pane_format"
fi
}

188
builder/window_builder.sh Normal file
View file

@ -0,0 +1,188 @@
#!/bin/sh
show_window_status=
build_window_format() {
local number="$1"
local color="$2"
local background="$3"
local text="$4"
local fill="$5"
local window_type="$6"
# NOTE: For backwards compatibility remove before 1.0.0 and update default for
# `@catppuccin_window_status`
if [ "$window_status" = "no" ]; then
window_status_enable="$(get_tmux_option "@catppuccin_window_status_enable" "")"
if [ -n "$window_status_enable" ]; then
tmux_echo "catppuccin warning: \\\"@catppuccin_window_status_enable\\\" and \\\"@catppuccin_window_status_icon_enable\\\" has been replaced by\n\t \
\\\"@catppuccin_window_status\\\" with the options \\\"no\\\", \\\"icon\\\" and \\\"text\\\"" 104
if [ "$window_status_enable" = "yes" ]; then
window_status_icon_enable="$(get_tmux_option "@catppuccin_window_status_icon_enable" "yes")"
if [ "$window_status_icon_enable" = "yes" ]; then
window_status="icon"
else
window_status="text"
fi
else
window_status="no"
fi
fi
fi
if [ ! "$window_status" = "no" ]; then
local icon
icon="$(build_window_icon)"
text="$text$icon"
fi
if [ "$window_type" = "current" ]; then
add_tmux_batch_option "@catppuccin_window_current_left_separator"
add_tmux_batch_option "@catppuccin_window_current_middle_separator"
add_tmux_batch_option "@catppuccin_window_current_right_separator"
run_tmux_batch_commands
window_left_separator=$(get_tmux_batch_option "@catppuccin_window_current_left_separator" "$window_left_separator")
window_middle_separator=$(get_tmux_batch_option "@catppuccin_window_current_middle_separator" "$window_middle_separator")
window_right_separator=$(get_tmux_batch_option "@catppuccin_window_current_right_separator" "$window_right_separator")
fi
if [ "$fill" = "none" ]; then
local show_number="#[fg=$thm_fg,bg=$thm_gray]$number"
local show_middle_separator="#[fg=$thm_fg,bg=$thm_gray,nobold,nounderscore,noitalics]$window_middle_separator"
local show_text="#[fg=$thm_fg,bg=$thm_gray]$text"
if [ "$status_connect_separator" = "yes" ]; then
local show_left_separator="#[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator"
local show_right_separator="#[fg=$thm_gray,bg=$thm_bg]$window_right_separator"
else
local show_left_separator="#[fg=$thm_gray,bg=default,nobold,nounderscore,noitalics]$window_left_separator"
local show_right_separator="#[fg=$thm_gray,bg=default]$window_right_separator"
fi
fi
if [ "$fill" = "all" ]; then
local show_number="#[fg=$background,bg=$color]$number"
local show_middle_separator="#[fg=$background,bg=$color,nobold,nounderscore,noitalics]$window_middle_separator"
local show_text="#[fg=$background,bg=$color]$text"
if [ "$status_connect_separator" = "yes" ]; then
local show_left_separator="#[fg=$color,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator"
local show_right_separator="#[fg=$color,bg=$thm_bg]$window_right_separator"
else
local show_left_separator="#[fg=$color,bg=default,nobold,nounderscore,noitalics]$window_left_separator"
local show_right_separator="#[fg=$color,bg=default]$window_right_separator"
fi
fi
if [ "$fill" = "number" ]; then
local show_number="#[fg=$background,bg=$color]$number"
local show_middle_separator="#[fg=$color,bg=$background,nobold,nounderscore,noitalics]$window_middle_separator"
local show_text="#[fg=$thm_fg,bg=$background]$text"
if [ "$window_number_position" = "right" ]; then
if [ "$status_connect_separator" = "yes" ]; then
local show_left_separator="#[fg=$background,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator"
local show_right_separator="#[fg=$color,bg=$thm_bg]$window_right_separator"
else
local show_left_separator="#[fg=$background,bg=default,nobold,nounderscore,noitalics]$window_left_separator"
local show_right_separator="#[fg=$color,bg=default]$window_right_separator"
fi
fi
if [ "$window_number_position" = "left" ]; then
if [ "$status_connect_separator" = "yes" ]; then
local show_right_separator="#[fg=$background,bg=$thm_bg,nobold,nounderscore,noitalics]$window_right_separator"
local show_left_separator="#[fg=$color,bg=$thm_bg]$window_left_separator"
else
local show_right_separator="#[fg=$background,bg=default,nobold,nounderscore,noitalics]$window_right_separator"
local show_left_separator="#[fg=$color,bg=default]$window_left_separator"
fi
fi
fi
local final_window_format
if [ "$window_number_position" = "right" ]; then
final_window_format="$show_left_separator$show_text$show_middle_separator$show_number$show_right_separator"
fi
if [ "$window_number_position" = "left" ]; then
final_window_format="$show_left_separator$show_number$show_middle_separator$show_text$show_right_separator"
fi
echo "$final_window_format"
}
prepend_separator() {
local field="$1"
echo "${field:+ $field}"
}
build_window_icon() {
# Only update `show_window_status` if it's not empty
# this module is ran twice once for current and once for default
# meaning 2 calls to build_window_icon wich will/should both return the same
# result.
if [ -z "$show_window_status" ]; then
local custom_icon_window_last \
custom_icon_window_zoom custom_icon_window_mark custom_icon_window_mark \
custom_icon_window_silent custom_icon_window_activity custom_icon_window_bell
# shellcheck disable=SC2034
local tmux_batch_options_commands=()
# shellcheck disable=SC2034
local tmux_batch_options=()
add_tmux_batch_option "@catppuccin_icon_window_last"
add_tmux_batch_option "@catppuccin_icon_window_current"
add_tmux_batch_option "@catppuccin_icon_window_zoom"
add_tmux_batch_option "@catppuccin_icon_window_mark"
add_tmux_batch_option "@catppuccin_icon_window_silent"
add_tmux_batch_option "@catppuccin_icon_window_activity"
add_tmux_batch_option "@catppuccin_icon_window_bell"
run_tmux_batch_commands
custom_icon_window_last=$(get_tmux_batch_option "@catppuccin_icon_window_last" "󰖰")
custom_icon_window_current=$(get_tmux_batch_option "@catppuccin_icon_window_current" "󰖯")
custom_icon_window_zoom=$(get_tmux_batch_option "@catppuccin_icon_window_zoom" "󰁌")
custom_icon_window_mark=$(get_tmux_batch_option "@catppuccin_icon_window_mark" "󰃀")
custom_icon_window_silent=$(get_tmux_batch_option "@catppuccin_icon_window_silent" "󰂛")
custom_icon_window_activity=$(get_tmux_batch_option "@catppuccin_icon_window_activity" "󱅫")
custom_icon_window_bell=$(get_tmux_batch_option "@catppuccin_icon_window_bell" "󰂞")
if [ "$window_status" = "icon" ]; then
# icon order: #!~[*-]MZ
show_window_status=""
show_window_status+="#{?window_activity_flag,$(prepend_separator "${custom_icon_window_activity}"),}"
show_window_status+="#{?window_bell_flag,$(prepend_separator "${custom_icon_window_bell}"),}"
show_window_status+="#{?window_silence_flag,$(prepend_separator "${custom_icon_window_silent}"),}"
show_window_status+="#{?window_active,$(prepend_separator "${custom_icon_window_current}"),}"
show_window_status+="#{?window_last_flag,$(prepend_separator "${custom_icon_window_last}"),}"
show_window_status+="#{?window_marked_flag,$(prepend_separator "${custom_icon_window_mark}"),}"
show_window_status+="#{?window_zoomed_flag,$(prepend_separator "${custom_icon_window_zoom}"),}"
elif [ "$window_status" = "text" ]; then
show_window_status=" #F"
fi
fi
echo "$show_window_status"
}

View file

@ -1,387 +1,219 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Set path of script
PLUGIN_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PLUGIN_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
get_tmux_option() { # import
local option value default # shellcheck source=./builder/module_builder.sh
option="$1" source "${PLUGIN_DIR}/builder/module_builder.sh"
default="$2" # shellcheck source=./builder/window_builder.sh
value=$(tmux show-option -gqv "$option") source "${PLUGIN_DIR}/builder/window_builder.sh"
# shellcheck source=./builder/pane_builder.sh
if [ -n "$value" ] source "${PLUGIN_DIR}/builder/pane_builder.sh"
then # shellcheck source=./utils/tmux_utils.sh
if [ "$value" = "null" ] source "${PLUGIN_DIR}/utils/tmux_utils.sh"
then # shellcheck source=./utils/interpolate_utils.sh
echo "" source "${PLUGIN_DIR}/utils/interpolate_utils.sh"
# shellcheck source=./utils/module_utils.sh
else source "${PLUGIN_DIR}/utils/module_utils.sh"
echo "$value"
fi
else
echo "$default"
fi
}
set() {
local option=$1
local value=$2
tmux_commands+=(set-option -gq "$option" "$value" ";")
}
setw() {
local option=$1
local value=$2
tmux_commands+=(set-window-option -gq "$option" "$value" ";")
}
build_window_icon() {
local window_status_icon_enable=$(get_tmux_option "@catppuccin_window_status_icon_enable" "yes")
local custom_icon_window_last=$(get_tmux_option "@catppuccin_icon_window_last" "󰖰")
local custom_icon_window_current=$(get_tmux_option "@catppuccin_icon_window_current" "󰖯")
local custom_icon_window_zoom=$(get_tmux_option "@catppuccin_icon_window_zoom" "󰁌")
local custom_icon_window_mark=$(get_tmux_option "@catppuccin_icon_window_mark" "󰃀")
local custom_icon_window_silent=$(get_tmux_option "@catppuccin_icon_window_silent" "󰂛")
local custom_icon_window_activity=$(get_tmux_option "@catppuccin_icon_window_activity" "󰖲")
local custom_icon_window_bell=$(get_tmux_option "@catppuccin_icon_window_bell" "󰂞")
if [ "$window_status_icon_enable" = "yes" ]
then
# #!~[*-]MZ
local show_window_status="#{?window_activity_flag,${custom_icon_window_activity},}#{?window_bell_flag,${custom_icon_window_bell},}#{?window_silence_flag,${custom_icon_window_silent},}#{?window_active,${custom_icon_window_current},}#{?window_last_flag,${custom_icon_window_last},}#{?window_marked_flag,${custom_icon_window_mark},}#{?window_zoomed_flag,${custom_icon_window_zoom},}"
fi
if [ "$window_status_icon_enable" = "no" ]
then
local show_window_status="#F"
fi
echo "$show_window_status"
}
build_pane_format() {
local number=$1
local color=$2
local background=$3
local text=$4
local fill=$5
if [ "$pane_status_enable" = "yes" ]
then
if [ "$fill" = "none" ]
then
local show_left_separator="#[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$pane_left_separator"
local show_number="#[fg=$thm_fg,bg=$thm_gray]$number"
local show_middle_separator="#[fg=$thm_fg,bg=$thm_gray,nobold,nounderscore,noitalics]$pane_middle_separator"
local show_text="#[fg=$thm_fg,bg=$thm_gray]$text"
local show_right_separator="#[fg=$thm_gray,bg=$thm_bg]$pane_right_separator"
fi
if [ "$fill" = "all" ]
then
local show_left_separator="#[fg=$color,bg=$thm_bg,nobold,nounderscore,noitalics]$pane_left_separator"
local show_number="#[fg=$background,bg=$color]$number"
local show_middle_separator="#[fg=$background,bg=$color,nobold,nounderscore,noitalics]$pane_middle_separator"
local show_text="#[fg=$background,bg=$color]$text"
local show_right_separator="#[fg=$color,bg=$thm_bg]$pane_right_separator"
fi
if [ "$fill" = "number" ]
then
local show_number="#[fg=$background,bg=$color]$number"
local show_middle_separator="#[fg=$color,bg=$background,nobold,nounderscore,noitalics]$pane_middle_separator"
local show_text="#[fg=$thm_fg,bg=$background]$text"
if [ "$pane_number_position" = "right" ]
then
local show_left_separator="#[fg=$background,bg=$thm_bg,nobold,nounderscore,noitalics]$pane_left_separator"
local show_right_separator="#[fg=$color,bg=$thm_bg]$pane_right_separator"
fi
if [ "$pane_number_position" = "left" ]
then
local show_right_separator="#[fg=$background,bg=$thm_bg,nobold,nounderscore,noitalics]$pane_right_separator"
local show_left_separator="#[fg=$color,bg=$thm_bg]$pane_left_separator"
fi
fi
local final_pane_format
if [ "$pane_number_position" = "right" ]
then
final_pane_format="$show_left_separator$show_text$show_middle_separator$show_number$show_right_separator"
fi
if [ "$pane_number_position" = "left" ]
then
final_pane_format="$show_left_separator$show_number$show_middle_separator$show_text$show_right_separator"
fi
echo "$final_pane_format"
fi
}
build_window_format() {
local number=$1
local color=$2
local background=$3
local text=$4
local fill=$5
if [ "$window_status_enable" = "yes" ]
then
local icon="$( build_window_icon )"
text="$text $icon"
fi
if [ "$fill" = "none" ]
then
local show_left_separator="#[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator"
local show_number="#[fg=$thm_fg,bg=$thm_gray]$number"
local show_middle_separator="#[fg=$thm_fg,bg=$thm_gray,nobold,nounderscore,noitalics]$window_middle_separator"
local show_text="#[fg=$thm_fg,bg=$thm_gray]$text"
local show_right_separator="#[fg=$thm_gray,bg=$thm_bg]$window_right_separator"
fi
if [ "$fill" = "all" ]
then
local show_left_separator="#[fg=$color,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator"
local show_number="#[fg=$background,bg=$color]$number"
local show_middle_separator="#[fg=$background,bg=$color,nobold,nounderscore,noitalics]$window_middle_separator"
local show_text="#[fg=$background,bg=$color]$text"
local show_right_separator="#[fg=$color,bg=$thm_bg]$window_right_separator"
fi
if [ "$fill" = "number" ]
then
local show_number="#[fg=$background,bg=$color]$number"
local show_middle_separator="#[fg=$color,bg=$background,nobold,nounderscore,noitalics]$window_middle_separator"
local show_text="#[fg=$thm_fg,bg=$background]$text"
if [ "$window_number_position" = "right" ]
then
local show_left_separator="#[fg=$background,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator"
local show_right_separator="#[fg=$color,bg=$thm_bg]$window_right_separator"
fi
if [ "$window_number_position" = "left" ]
then
local show_right_separator="#[fg=$background,bg=$thm_bg,nobold,nounderscore,noitalics]$window_right_separator"
local show_left_separator="#[fg=$color,bg=$thm_bg]$window_left_separator"
fi
fi
local final_window_format
if [ "$window_number_position" = "right" ]
then
final_window_format="$show_left_separator$show_text$show_middle_separator$show_number$show_right_separator"
fi
if [ "$window_number_position" = "left" ]
then
final_window_format="$show_left_separator$show_number$show_middle_separator$show_text$show_right_separator"
fi
echo "$final_window_format"
}
build_status_module() {
local index=$1
local icon=$2
local color=$3
local text=$4
if [ "$status_fill" = "icon" ]
then
local show_left_separator="#[fg=$color,bg=$thm_gray,nobold,nounderscore,noitalics]$status_left_separator"
local show_icon="#[fg=$thm_bg,bg=$color,nobold,nounderscore,noitalics]$icon "
local show_text="#[fg=$thm_fg,bg=$thm_gray] $text"
local show_right_separator="#[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$status_right_separator"
if [ "$status_connect_separator" = "yes" ]
then
local show_left_separator="#[fg=$color,bg=$thm_gray,nobold,nounderscore,noitalics]$status_left_separator"
local show_right_separator="#[fg=$thm_gray,bg=$thm_gray,nobold,nounderscore,noitalics]$status_right_separator"
else
local show_left_separator="#[fg=$color,bg=$thm_bg,nobold,nounderscore,noitalics]$status_left_separator"
local show_right_separator="#[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$status_right_separator"
fi
fi
if [ "$status_fill" = "all" ]
then
local show_left_separator="#[fg=$color,bg=$thm_gray,nobold,nounderscore,noitalics]$status_left_separator"
local show_icon="#[fg=$thm_bg,bg=$color,nobold,nounderscore,noitalics]$icon "
local show_text="#[fg=$thm_bg,bg=$color]$text"
local show_right_separator="#[fg=$color,bg=$thm_gray,nobold,nounderscore,noitalics]$status_right_separator"
if [ "$status_connect_separator" = "yes" ]
then
local show_left_separator="#[fg=$color,nobold,nounderscore,noitalics]$status_left_separator"
local show_right_separator="#[fg=$color,bg=$color,nobold,nounderscore,noitalics]$status_right_separator"
else
local show_left_separator="#[fg=$color,bg=$thm_bg,nobold,nounderscore,noitalics]$status_left_separator"
local show_right_separator="#[fg=$color,bg=$thm_bg,nobold,nounderscore,noitalics]$status_right_separator"
fi
fi
if [ "$status_right_separator_inverse" = "yes" ]
then
if [ "$status_connect_separator" = "yes" ]
then
local show_right_separator="#[fg=$thm_gray,bg=$color,nobold,nounderscore,noitalics]$status_right_separator"
else
local show_right_separator="#[fg=$thm_bg,bg=$color,nobold,nounderscore,noitalics]$status_right_separator"
fi
fi
if [ $(($index)) -eq 0 ]
then
local show_left_separator="#[fg=$color,bg=$thm_bg,nobold,nounderscore,noitalics]$status_left_separator"
fi
echo "$show_left_separator$show_icon$show_text$show_right_separator"
}
load_modules() {
local modules_list=$1
local custom_path="$(get_tmux_option "@catppuccin_custom_plugin_dir" "${PLUGIN_DIR}/custom")"
local modules_custom_path=$custom_path
local modules_status_path=$PLUGIN_DIR/status
local modules_window_path=$PLUGIN_DIR/window
local modules_pane_path=$PLUGIN_DIR/pane
local -i module_index=0;
local module_name
local module_path
local loaded_modules
local IN=$modules_list
# https://stackoverflow.com/questions/918886/how-do-i-split-a-string-on-a-delimiter-in-bash#15988793
while [ "$IN" != "$iter" ] ;do
# extract the substring from start of string up to delimiter.
iter=${IN%% *}
# delete this first "element" AND next separator, from $IN.
IN="${IN#$iter }"
# Print (or doing anything with) the first "element".
module_name=$iter
for module_dir in "${modules_custom_path}" "${modules_status_path}" "${modules_window_path}" "${modules_pane_path}" ; do
module_path="$module_dir/$module_name.sh"
if [ -r "$module_path" ]; then
source "$module_path"
loaded_modules="$loaded_modules$( "show_$module_name" "$module_index" )"
module_index+=1
break
fi
done
done
echo "$loaded_modules"
}
main() { main() {
local theme
theme="$(get_tmux_option "@catppuccin_flavour" "mocha")"
# Aggregate all commands in one array # Aggregate all commands in one array
local tmux_commands=() local tmux_commands=()
# Aggregate all tmux option for tmux_batch_option
local tmux_batch_options_commands=()
local tmux_batch_options=()
# Batch options for loading the colorscheme and everyting before
add_tmux_batch_option "@catppuccin_custom_plugin_dir"
add_tmux_batch_option "@catppuccin_flavor"
run_tmux_batch_commands
# module directories
local custom_path modules_custom_path modules_status_path modules_window_path modules_pane_path
custom_path="$(get_tmux_batch_option "@catppuccin_custom_plugin_dir" "${PLUGIN_DIR}/custom")"
modules_custom_path=$custom_path
modules_status_path=$PLUGIN_DIR/status
modules_window_path=$PLUGIN_DIR/window
modules_pane_path=$PLUGIN_DIR/pane
# load local theme
local theme
local color_interpolation=()
local color_values=()
local temp
theme="$(get_tmux_batch_option "@catppuccin_flavor" "")"
# NOTE: For backwards compatibility remove before 1.0.0 and set default for
# `@catppuccin_flavor` from `""` to `"mocha"`
if [ -z "$theme" ]; then
theme="$(get_tmux_option "@catppuccin_flavour" "")"
if [ -n "$theme" ]; then
tmux_echo "catppuccin warning: \\\"@catppuccin_flavour\\\" has been deprecated use \\\"@catppuccin_flavor\\\"" 103
else
theme="mocha"
fi
fi
# NOTE: Pulling in the selected theme by the theme that's being set as local # NOTE: Pulling in the selected theme by the theme that's being set as local
# variables. # variables.
# shellcheck source=catppuccin-frappe.tmuxtheme
# https://github.com/dylanaraps/pure-sh-bible#parsing-a-keyval-file # https://github.com/dylanaraps/pure-sh-bible#parsing-a-keyval-file
# shellcheck source=./catppuccin-frappe.tmuxtheme
while IFS='=' read -r key val; do while IFS='=' read -r key val; do
# Skip over lines containing comments. # Skip over lines containing comments.
# (Lines starting with '#'). # (Lines starting with '#').
[ "${key##\#*}" ] || continue [ "${key##\#*}" ] || continue
# '$key' stores the key. # '$key' stores the key.
# '$val' stores the value. # '$val' stores the value.
eval "local $key"="$val" eval "local $key"="$val"
done < "${PLUGIN_DIR}/catppuccin-${theme}.tmuxtheme"
# TODO: Find a better way to strip the quotes from `$val`
temp="${val%\"}"
temp="${temp#\"}"
color_interpolation+=("\#{$key}")
color_values+=("${temp}")
done <"${PLUGIN_DIR}/themes/catppuccin_${theme}.tmuxtheme"
# Batch options for `./catppuccin.tmux`
add_tmux_batch_option "@catppuccin_status_default"
add_tmux_batch_option "@catppuccin_status_justify"
add_tmux_batch_option "@catppuccin_status_background"
add_tmux_batch_option "@catppuccin_menu_style"
add_tmux_batch_option "@catppuccin_menu_selected_style"
add_tmux_batch_option "@catppuccin_menu_border_style"
add_tmux_batch_option "@catppuccin_pane_status_enabled"
add_tmux_batch_option "@catppuccin_pane_border_status"
add_tmux_batch_option "@catppuccin_pane_border_style"
add_tmux_batch_option "@catppuccin_pane_active_border_style"
add_tmux_batch_option "@catppuccin_pane_left_separator"
add_tmux_batch_option "@catppuccin_pane_middle_separator"
add_tmux_batch_option "@catppuccin_pane_right_separator"
add_tmux_batch_option "@catppuccin_pane_number_position"
add_tmux_batch_option "@catppuccin_window_separator"
add_tmux_batch_option "@catppuccin_window_left_separator"
add_tmux_batch_option "@catppuccin_window_right_separator"
add_tmux_batch_option "@catppuccin_window_middle_separator"
add_tmux_batch_option "@catppuccin_window_number_position"
add_tmux_batch_option "@catppuccin_window_status"
add_tmux_batch_option "@catppuccin_status_left_separator"
add_tmux_batch_option "@catppuccin_status_middle_separator"
add_tmux_batch_option "@catppuccin_status_right_separator"
add_tmux_batch_option "@catppuccin_status_connect_separator"
add_tmux_batch_option "@catppuccin_status_fill"
add_tmux_batch_option "@catppuccin_status_modules_left"
add_tmux_batch_option "@catppuccin_status_modules_right"
run_tmux_batch_commands
# status general
local status_default status_justify status_background message_background
status_default=$(get_tmux_batch_option "@catppuccin_status_default" "on")
# shellcheck disable=SC2121
set status "$status_default"
status_justify=$(get_tmux_batch_option "@catppuccin_status_justify" "left")
set status-justify "$status_justify"
status_background=$(get_tmux_batch_option "@catppuccin_status_background" "theme")
if [ "${status_background}" = "theme" ]; then
set status-bg "${thm_bg}"
message_background="${thm_gray}"
else
if [ "${status_background}" = "default" ]; then
set status-style bg=default
message_background="default"
else
message_background="$(do_color_interpolation "$status_background")"
set status-bg "${message_background}"
fi
fi
# status
set status "on"
set status-bg "${thm_bg}"
set status-justify "left"
set status-left-length "100" set status-left-length "100"
set status-right-length "100" set status-right-length "100"
# messages # messages
set message-style "fg=${thm_cyan},bg=${thm_gray},align=centre" set message-style "fg=${thm_cyan},bg=${message_background},align=centre"
set message-command-style "fg=${thm_cyan},bg=${thm_gray},align=centre" set message-command-style "fg=${thm_cyan},bg=${message_background},align=centre"
# menu
local menu_style menu_selected_style menu_border_style
menu_style=$(get_interpolated_tmux_batch_option "@catppuccin_menu_style" "default")
menu_selected_style=$(get_interpolated_tmux_batch_option "@catppuccin_menu_selected_style" "fg=${thm_gray},bg=${thm_yellow}")
menu_border_style=$(get_interpolated_tmux_batch_option "@catppuccin_menu_border_style" "default")
set menu-style "$menu_style"
set menu-selected-style "$menu_selected_style"
set menu-border-style "$menu_border_style"
# panes # panes
local pane_status_enable=$(get_tmux_option "@catppuccin_pane_status_enabled" "no") # yes local pane_border_status pane_border_style \
local pane_border_status=$(get_tmux_option "@catppuccin_pane_border_status" "off") # bottom pane_active_border_style pane_left_separator pane_middle_separator \
local pane_border_style=$(get_tmux_option "@catppuccin_pane_border_style" "fg=${thm_gray}") pane_right_separator pane_number_position pane_format
local pane_active_border_style=$(get_tmux_option "@catppuccin_pane_active_border_style" "fg=${thm_orange}") pane_status_enable=$(get_tmux_batch_option "@catppuccin_pane_status_enabled" "no") # yes
local pane_left_separator=$(get_tmux_option "@catppuccin_pane_left_separator" "█") pane_border_status=$(get_tmux_batch_option "@catppuccin_pane_border_status" "off") # bottom
local pane_middle_separator=$(get_tmux_option "@catppuccin_pane_middle_separator" "█") pane_border_style=$(
local pane_right_separator=$(get_tmux_option "@catppuccin_pane_right_separator" "█") get_interpolated_tmux_batch_option "@catppuccin_pane_border_style" "fg=${thm_gray}"
local pane_number_position=$(get_tmux_option "@catppuccin_pane_number_position" "left") # right, left )
local pane_format=$( load_modules "pane_default_format") pane_active_border_style=$(
get_interpolated_tmux_batch_option "@catppuccin_pane_active_border_style" \
"#{?pane_in_mode,fg=${thm_yellow},#{?pane_synchronized,fg=${thm_magenta},fg=${thm_orange}}}"
)
pane_left_separator=$(get_tmux_batch_option "@catppuccin_pane_left_separator" "█")
pane_middle_separator=$(get_tmux_batch_option "@catppuccin_pane_middle_separator" "█")
pane_right_separator=$(get_tmux_batch_option "@catppuccin_pane_right_separator" "█")
pane_number_position=$(get_tmux_batch_option "@catppuccin_pane_number_position" "left") # right, left
pane_format=$(load_modules "pane_default_format" "$modules_custom_path" "$modules_pane_path")
setw pane-border-status "$pane_border_status" setw pane-border-status "$pane_border_status"
setw pane-active-border-style "$pane_active_border_style" setw pane-active-border-style "$pane_active_border_style"
setw pane-border-style "$pane_border_style" setw pane-border-style "$pane_border_style"
setw pane-border-format "$pane_format" setw pane-border-format "$(do_color_interpolation "$pane_format")"
# window
local window_status_separator window_left_separator window_right_separator \
window_middle_separator window_number_position window_status_enable \
window_format window_current_format
# windows window_status_separator=$(get_interpolated_tmux_batch_option "@catppuccin_window_separator" "")
setw window-status-activity-style "fg=${thm_fg},bg=${thm_bg},none" setw window-status-separator "$window_status_separator"
setw window-status-separator ""
setw window-status-style "fg=${thm_fg},bg=${thm_bg},none"
# --------=== Statusline window_left_separator=$(get_tmux_batch_option "@catppuccin_window_left_separator" "█")
window_right_separator=$(get_tmux_batch_option "@catppuccin_window_right_separator" "█")
window_middle_separator=$(get_tmux_batch_option "@catppuccin_window_middle_separator" "█ ")
window_number_position=$(get_tmux_batch_option "@catppuccin_window_number_position" "left") # right, left
local window_left_separator=$(get_tmux_option "@catppuccin_window_left_separator" "█") # NOTE: update default to `"no"` when removing the backwards compatibility for
local window_right_separator=$(get_tmux_option "@catppuccin_window_right_separator" "█") # `@catppuccin_window_status_enable` and
local window_middle_separator=$(get_tmux_option "@catppuccin_window_middle_separator" "█ ") # `@catppuccin_window_status_icon_enable` in ./builder/window_builder.sh
local window_number_position=$(get_tmux_option "@catppuccin_window_number_position" "left") # right, left window_status=$(get_tmux_batch_option "@catppuccin_window_status" "no") # no, icon, text
local window_status_enable=$(get_tmux_option "@catppuccin_window_status_enable" "no") # right, left
local window_format=$( load_modules "window_default_format") window_format=$(load_modules "window_default_format" "$modules_custom_path" "$modules_window_path")
local window_current_format=$( load_modules "window_current_format") setw window-status-format "$(do_color_interpolation "$window_format")"
setw window-status-format "$window_format" window_current_format=$(load_modules "window_current_format" "$modules_custom_path" "$modules_window_path")
setw window-status-current-format "$window_current_format" setw window-status-current-format "$(do_color_interpolation "$window_current_format")"
local status_left_separator=$(get_tmux_option "@catppuccin_status_left_separator" "") # status module
local status_right_separator=$(get_tmux_option "@catppuccin_status_right_separator" "█") local status_left_separator status_middle_separator status_right_separator status_connect_separator \
local status_right_separator_inverse=$(get_tmux_option "@catppuccin_status_right_separator_inverse" "no") status_fill status_modules_left status_modules_right
local status_connect_separator=$(get_tmux_option "@catppuccin_status_connect_separator" "yes") status_left_separator=$(get_tmux_batch_option "@catppuccin_status_left_separator" "")
local status_fill=$(get_tmux_option "@catppuccin_status_fill" "icon") status_right_separator=$(get_tmux_batch_option "@catppuccin_status_right_separator" "█")
status_middle_separator=$(get_tmux_batch_option "@catppuccin_status_middle_separator" "")
status_connect_separator=$(get_tmux_batch_option "@catppuccin_status_connect_separator" "yes")
status_fill=$(get_tmux_batch_option "@catppuccin_status_fill" "icon")
local status_modules_right=$(get_tmux_option "@catppuccin_status_modules_right" "application session") status_modules_left=$(get_tmux_batch_option "@catppuccin_status_modules_left" "")
local loaded_modules_right=$( load_modules "$status_modules_right") loaded_modules_left=$(load_modules "$status_modules_left" "$modules_custom_path" "$modules_status_path")
set status-left "$(do_color_interpolation "$loaded_modules_left")"
local status_modules_left=$(get_tmux_option "@catppuccin_status_modules_left" "") status_modules_right=$(get_tmux_batch_option "@catppuccin_status_modules_right" "application session")
local loaded_modules_left=$( load_modules "$status_modules_left") loaded_modules_right=$(load_modules "$status_modules_right" "$modules_custom_path" "$modules_status_path")
set status-right "$(do_color_interpolation "$loaded_modules_right")"
set status-left "$loaded_modules_left" # modes
set status-right "$loaded_modules_right"
# --------=== Modes
#
setw clock-mode-colour "${thm_blue}" setw clock-mode-colour "${thm_blue}"
setw mode-style "fg=${thm_pink} bg=${thm_black4} bold" setw mode-style "fg=${thm_pink} bg=${thm_black4} bold"

View file

@ -1,43 +1,72 @@
# User defined modules # User Defined Modules
## Description This folder is used to store user defined modules. You can use this folder to
add a new module or override any existing module. To override an existing
module, make sure that you use the same name for your module as the module you
want to override. You can also override the window module for the current and
default window.
This folder is used to store user defined modules. ## Creating A New Module
You can use this folder to add a new module or override any existing module.
To override an existing module, make sure you use the same name for your module as the module you want to override.
You can also override the window module for current and default window.
## Create a new module > [!NOTE]
> Changes will only be applied after reloading your Tmux configuration by executing `tmux source-file ~/.tmux.conf`.
Use the [Module template](#module-template) (or example.sh) as a starting point when creating a new module. You can create a custom module by following the steps outlined below. This can be something you create entirely by yourself or integrating an existing Tmux plugin.
Save the new module under this folder using the module name as the file name and .sh as the extension.
Update the status module list with your module.
```sh
set -g @catppuccin_status_modules "... <module_name> ..."
1. Create a new file in `~/.tmux/plugins/tmux/custom/<module_name>.sh` to store the custom module.
- The file **must** end in `.sh`
- The file **does not** need to be set as executable.
2. Copy the following template to this new file. Make sure to replace every instance of `<module_name>` by the name you chose as filename.
```bash
# If this module depends on an external Tmux plugin, say so in a comment.
# E.g.: Requires https://github.com/aaronpowell/tmux-weather
show_<module_name>() { # This function name must match the module name!
local index icon color text module
index=$1 # This variable is used internally by the module loader in order to know the position of this module
icon="$( get_tmux_option "@catppuccin_<module_name>_icon" "" )"
color="$( get_tmux_option "@catppuccin_<module_name>_color" "$thm_orange" )"
text="$( get_tmux_option "@catppuccin_<module_name>_text" "hello world" )"
module=$( build_status_module "$index" "$icon" "$color" "$text" )
echo "$module"
}
```
3. Add the custom module to the list of modules in `.tmux.conf`
```bash
set -g @catppuccin_status_modules_right "... <module_name> ..."
```
## Customization
Change the icon to one from [Nerd Fonts](https://www.nerdfonts.com/cheat-sheet).
Change the color to one of the [official colors](../catppuccin-macchiato.tmuxtheme), for instance `"$thm_cyan"`, or to a hexadecimal color like `"#00ff00"`.
The text to display can either be:
- A static text, e.g. `"hello world"`.
- The output of a command, e.g. `"#( date +%T )"`.
- The output of a script, e.g. `"#( $HOME/my_script.sh )"` . Any script will do, e.g. a Bash or Python script that prints some text, but ensure that it is executable: `chmod u+x my_script.sh`.
- An existing Tmux plugin, e.g. `" #{forecast} "` for the [Tmux Weather plugin](https://github.com/aaronpowell/tmux-weather).
Note that the icon and the color can be generated dynamically as well, for instance by having a Bash script `echo` a hexadecimal color.
To modify how often the modules are updated, add the following to `.tmux.conf`:
```tmux
set -g status-interval <number of seconds>
``` ```
## Module template To configure a custom path for your modules, set this option:
```sh
show_<module_name>() { # save this module in a file with the name <module_name>.sh
local index=$1 # this variable is used by the module loader in order to know the position of this module
local icon="$(get_tmux_option "@catppuccin_<module_name>_icon" "<Use an icon from [nerdfonts](https://www.nerdfonts.com/cheat-sheet)>")"
local color="$(get_tmux_option "@catppuccin_<module_name>_color" "<Use one of the default theme colors (ex: $thm_orange), or provide a color code (ex: #ef9f76)>")"
local text="$(get_tmux_option "@catppuccin_<module_name>_text" "<Provide the text that you want to be displayed>")"
local module=$( build_status_module "$index" "$icon" "$color" "$text" ) ```tmux
echo "$module"
}
```
## Configure custom modules path
You can configure a custom path for your modules by setting the `@catppuccin_custom_plugin_dir` option.
```sh
set -g @catppuccin_custom_plugin_dir "<path>" set -g @catppuccin_custom_plugin_dir "<path>"
``` ```
To use the output of a command, use e.g. `local text="$(get_tmux_option "@catppuccin_test_text" "#(date +%T)")"`.
To use the output of a script, use e.g. `local text="$(get_tmux_option "@catppuccin_test_text" "#($HOME/my_script.sh)")"`.

View file

@ -1,10 +1,16 @@
show_example() { # If this module depends on an external Tmux plugin, say so in a comment.
local index=$1 # E.g.: Requires https://github.com/aaronpowell/tmux-weather
local icon="$(get_tmux_option "@catppuccin_test_icon" "󰙨")"
local color="$(get_tmux_option "@catppuccin_test_color" "$thm_blue")"
local text="$(get_tmux_option "@catppuccin_test_text" "It works!")"
local module=$( build_status_module "$index" "$icon" "$color" "$text" ) show_test() { # This function name must match the module name!
local index icon color text module
index=$1 # This variable is used internally by the module loader in order to know the position of this module
icon="$( get_tmux_option "@catppuccin_test_icon" "" )"
color="$( get_tmux_option "@catppuccin_test_color" "$thm_orange" )"
text="$( get_tmux_option "@catppuccin_test_text" "hello world" )"
module=$( build_status_module "$index" "$icon" "$color" "$text" )
echo "$module" echo "$module"
} }

View file

@ -1,12 +1,24 @@
show_pane_default_format() { show_pane_default_format() {
local number="#{pane_index}" local number color background text fill
local color="$(get_tmux_option "@catppuccin_pane_color" "$thm_green")" # shellcheck disable=SC2034
local background="$(get_tmux_option "@catppuccin_pane_background_color" "$thm_gray")" local tmux_batch_options_commands=()
local text="$(get_tmux_option "@catppuccin_pane_default_text" "#{b:pane_current_path}")" # shellcheck disable=SC2034
local fill="$(get_tmux_option "@catppuccin_pane_default_fill" "number")" # number, all, none local tmux_batch_options=()
local active="#{pane_active}"
local default_pane_format=$( build_pane_format "$number" "$color" "$background" "$text" "$fill") add_tmux_batch_option "@catppuccin_pane_color"
add_tmux_batch_option "@catppuccin_pane_background_color"
add_tmux_batch_option "@catppuccin_pane_default_text"
add_tmux_batch_option "@catppuccin_pane_default_fill"
run_tmux_batch_commands
number="#{pane_index}"
color="$(get_tmux_batch_option "@catppuccin_pane_color" "$thm_green")"
background="$(get_tmux_batch_option "@catppuccin_pane_background_color" "$thm_gray")"
text="$(get_tmux_batch_option "@catppuccin_pane_default_text" "#{b:pane_current_path}")"
fill="$(get_tmux_batch_option "@catppuccin_pane_default_fill" "number")" # number, all, none
default_pane_format=$(build_pane_format "$number" "$color" "$background" "$text" "$fill")
echo "$default_pane_format" echo "$default_pane_format"
} }

6
renovate.json Normal file
View file

@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"local>catppuccin/renovate-config"
]
}

View file

@ -1,10 +1,15 @@
show_application() { show_application() {
local index=$1 local index icon color text module
local icon=$(get_tmux_option "@catppuccin_application_icon" "")
local color=$(get_tmux_option "@catppuccin_application_color" "$thm_pink")
local text=$(get_tmux_option "@catppuccin_application_text" "#W")
local module=$( build_status_module "$index" "$icon" "$color" "$text" ) tmux_batch_setup_status_module "application"
run_tmux_batch_commands
index=$1
icon=$(get_tmux_batch_option "@catppuccin_application_icon" "")
color=$(get_tmux_batch_option "@catppuccin_application_color" "$thm_pink")
text=$(get_tmux_batch_option "@catppuccin_application_text" "#{pane_current_command}")
module=$(build_status_module "$index" "$icon" "$color" "$text")
echo "$module" echo "$module"
} }

View file

@ -1,23 +1,30 @@
show_battery() { show_battery() {
tmux set-option -g @batt_icon_charge_tier8 '󰁹' local index icon color text module
tmux set-option -g @batt_icon_charge_tier7 '󰂁'
tmux set-option -g @batt_icon_charge_tier6 '󰁿'
tmux set-option -g @batt_icon_charge_tier5 '󰁾'
tmux set-option -g @batt_icon_charge_tier4 '󰁽'
tmux set-option -g @batt_icon_charge_tier3 '󰁼'
tmux set-option -g @batt_icon_charge_tier2 '󰁻'
tmux set-option -g @batt_icon_charge_tier1 '󰁺'
tmux set-option -g @batt_icon_status_charged '󰚥'
tmux set-option -g @batt_icon_status_charging '󰂄'
tmux set-option -g @batt_icon_status_discharging '󰂃'
tmux set-option -g @batt_icon_status_unknown '󰂑'
local index=$1 tmux_batch_setup_status_module "battery"
local icon=$(get_tmux_option "@catppuccin_battery_icon" "#{battery_icon}")
local color=$(get_tmux_option "@catppuccin_battery_color" "$thm_yellow")
local text=$(get_tmux_option "@catppuccin_battery_text" "#{battery_percentage}")
local module=$( build_status_module "$index" "$icon" "$color" "$text" ) tmux_batch_options_commands+=("set-option -gq @batt_icon_charge_tier8 󰁹 ;")
tmux_batch_options_commands+=("set-option -gq @batt_icon_charge_tier7 󰂁 ;")
tmux_batch_options_commands+=("set-option -gq @batt_icon_charge_tier6 󰁿 ;")
tmux_batch_options_commands+=("set-option -gq @batt_icon_charge_tier5 󰁾 ;")
tmux_batch_options_commands+=("set-option -gq @batt_icon_charge_tier4 󰁽 ;")
tmux_batch_options_commands+=("set-option -gq @batt_icon_charge_tier3 󰁼 ;")
tmux_batch_options_commands+=("set-option -gq @batt_icon_charge_tier2 󰁻 ;")
tmux_batch_options_commands+=("set-option -gq @batt_icon_charge_tier1 󰁺 ;")
tmux_batch_options_commands+=("set-option -gq @batt_icon_status_charged 󰚥 ;")
tmux_batch_options_commands+=("set-option -gq @batt_icon_status_charging 󰂄 ;")
tmux_batch_options_commands+=("set-option -gq @batt_icon_status_discharging 󰂃 ;")
tmux_batch_options_commands+=("set-option -gq @batt_icon_status_unknown 󰂑 ;")
tmux_batch_options_commands+=("set-option -gq @batt_icon_status_attached 󱈑 ;")
run_tmux_batch_commands
index=$1
icon=$(get_tmux_batch_option "@catppuccin_battery_icon" "#{battery_icon}")
color=$(get_tmux_batch_option "@catppuccin_battery_color" "$thm_yellow")
text=$(get_tmux_batch_option "@catppuccin_battery_text" "#{battery_percentage}")
module=$(build_status_module "$index" "$icon" "$color" "$text")
echo "$module" echo "$module"
} }

16
status/clima.sh Normal file
View file

@ -0,0 +1,16 @@
# Requires https://github.com/vascomfnunes/tmux-clima
show_clima() {
local index icon color text module
tmux_batch_setup_status_module "clima"
run_tmux_batch_commands
index=$1
icon="$(get_tmux_batch_option "@catppuccin_clima_icon" "")"
color="$(get_tmux_batch_option "@catppuccin_clima_color" "$thm_yellow")"
text="$(get_tmux_batch_option "@catppuccin_clima_text" "#{clima}")"
module=$(build_status_module "$index" "$icon" "$color" "$text")
echo "$module"
}

View file

@ -1,14 +1,20 @@
show_cpu() { show_cpu() {
tmux set-option -g @cpu_low_bg_color "$thm_yellow" # background color when cpu is low local index icon color text module
tmux set-option -g @cpu_medium_bg_color "$thm_orange" # background color when cpu is medium
tmux set-option -g @cpu_high_bg_color "$thm_red" # background color when cpu is high
local index=$1
local icon=$(get_tmux_option "@catppuccin_cpu_icon" "")
local color="$(get_tmux_option "@catppuccin_cpu_color" "#{cpu_bg_color}")"
local text="$(get_tmux_option "@catppuccin_cpu_text" "#{cpu_percentage}")"
local module=$( build_status_module "$index" "$icon" "$color" "$text" ) tmux_batch_setup_status_module "cpu"
tmux_batch_options_commands+=("set-option -gq @cpu_low_bg_color $thm_yellow ;") # background color when cpu is low
tmux_batch_options_commands+=("set-option -gq @cpu_medium_bg_color $thm_orange ;") # background color when cpu is medium
tmux_batch_options_commands+=("set-option -gq @cpu_high_bg_color $thm_red ;") # background color when cpu is high
run_tmux_batch_commands
index=$1
icon=$(get_tmux_batch_option "@catppuccin_cpu_icon" "")
color="$(get_tmux_batch_option "@catppuccin_cpu_color" "#{cpu_bg_color}")"
text="$(get_tmux_batch_option "@catppuccin_cpu_text" "#{cpu_percentage}")"
module=$(build_status_module "$index" "$icon" "$color" "$text")
echo "$module" echo "$module"
} }

View file

@ -1,11 +1,15 @@
show_date_time() { show_date_time() {
local index=$1 local index icon color text module
local icon="$(get_tmux_option "@catppuccin_date_time_icon" "󰃰")"
local color="$(get_tmux_option "@catppuccin_date_time_color" "$thm_blue")"
local text="$(get_tmux_option "@catppuccin_date_time_text" "%Y-%m-%d %H:%M")"
local module=$( build_status_module "$index" "$icon" "$color" "$text" ) tmux_batch_setup_status_module "date_time"
run_tmux_batch_commands
index=$1
icon="$(get_tmux_batch_option "@catppuccin_date_time_icon" "󰃰")"
color="$(get_tmux_batch_option "@catppuccin_date_time_color" "$thm_blue")"
text="$(get_tmux_batch_option "@catppuccin_date_time_text" "%Y-%m-%d %H:%M")"
module=$(build_status_module "$index" "$icon" "$color" "$text")
echo "$module" echo "$module"
} }

View file

@ -1,10 +1,15 @@
show_directory() { show_directory() {
local index=$1 local index icon color text module
local icon=$(get_tmux_option "@catppuccin_directory_icon" "")
local color=$(get_tmux_option "@catppuccin_directory_color" "$thm_pink")
local text=$(get_tmux_option "@catppuccin_directory_text" "#{b:pane_current_path}")
local module=$( build_status_module "$index" "$icon" "$color" "$text" ) tmux_batch_setup_status_module "directory"
run_tmux_batch_commands
index=$1
icon=$(get_tmux_batch_option "@catppuccin_directory_icon" "")
color=$(get_tmux_batch_option "@catppuccin_directory_color" "$thm_pink")
text=$(get_tmux_batch_option "@catppuccin_directory_text" "#{b:pane_current_path}")
module=$(build_status_module "$index" "$icon" "$color" "$text")
echo "$module" echo "$module"
} }

17
status/gitmux.sh Normal file
View file

@ -0,0 +1,17 @@
# Requires https://github.com/arl/gitmux
show_gitmux() {
local index icon color text module
tmux_batch_setup_status_module "gitmux"
run_tmux_batch_commands
index=$1
icon="$(get_tmux_batch_option "@catppuccin_gitmux_icon" "󰊢")"
color="$(get_tmux_batch_option "@catppuccin_gitmux_color" "$thm_green")"
text="$(get_tmux_batch_option "@catppuccin_gitmux_text" "#(gitmux \"#{pane_current_path}\")")"
module=$( build_status_module "$index" "$icon" "$color" "$text" )
echo "$module"
}

View file

@ -1,10 +1,15 @@
show_host() { show_host() {
local index=$1 local index icon color text module
local icon=$(get_tmux_option "@catppuccin_host_icon" "󰒋")
local color=$(get_tmux_option "@catppuccin_host_color" "$thm_magenta")
local text=$(get_tmux_option "@catppuccin_host_text" "#H")
local module=$( build_status_module "$index" "$icon" "$color" "$text" ) tmux_batch_setup_status_module "host"
run_tmux_batch_commands
index=$1
icon=$(get_tmux_batch_option "@catppuccin_host_icon" "󰒋")
color=$(get_tmux_batch_option "@catppuccin_host_color" "$thm_magenta")
text=$(get_tmux_batch_option "@catppuccin_host_text" "#H")
module=$(build_status_module "$index" "$icon" "$color" "$text")
echo "$module" echo "$module"
} }

24
status/kube.sh Normal file
View file

@ -0,0 +1,24 @@
# Requires https://github.com/jonmosco/kube-tmux
show_kube() {
local index icon color text context_color namespace_color symbol_enabled module
tmux_batch_setup_status_module "kube"
add_tmux_batch_option "@catppuccin_kube_context_color"
add_tmux_batch_option "@catppuccin_kube_namespace_color"
run_tmux_batch_commands
index=$1
icon=$(get_tmux_batch_option "@catppuccin_kube_icon" "󱃾")
color=$(get_tmux_batch_option "@catppuccin_kube_color" "$thm_blue")
context_color=$(get_tmux_batch_option "@catppuccin_kube_context_color" "#{thm_red}")
namespace_color=$(get_tmux_batch_option "@catppuccin_kube_namespace_color" "#{thm_cyan}")
symbol_enabled=${KUBE_TMUX_SYMBOL_ENABLE:-false}
text=$(get_tmux_batch_option "@catppuccin_kube_text" "#(KUBE_TMUX_SYMBOL_ENABLE=$symbol_enabled \${TMUX_PLUGIN_MANAGER_PATH}kube-tmux/kube.tmux 250 '$context_color' '$namespace_color')")
module=$(build_status_module "$index" "$icon" "$color" "$text")
echo "$module"
}

15
status/load.sh Normal file
View file

@ -0,0 +1,15 @@
show_load() {
local index icon color text module
tmux_batch_setup_status_module "load"
run_tmux_batch_commands
index=$1
icon="$(get_tmux_batch_option "@catppuccin_load_icon" "󰊚")"
color="$(get_tmux_batch_option "@catppuccin_load_color" "$thm_blue")"
text="$(get_tmux_batch_option "@catppuccin_load_text" "#{load_full}")"
module=$(build_status_module "$index" "$icon" "$color" "$text")
echo "$module"
}

17
status/pomodoro_plus.sh Normal file
View file

@ -0,0 +1,17 @@
# Requires https://github.com/olimorris/tmux-pomodoro-plus
show_pomodoro_plus() {
local index icon color text module
tmux_batch_setup_status_module "pomodoro_plus"
run_tmux_batch_commands
index=$1
icon="$( get_tmux_batch_option "@catppuccin_pomodoro_plus_icon" "" )"
color="$( get_tmux_batch_option "@catppuccin_pomodoro_plus_color" "$thm_orange" )"
text="$( get_tmux_batch_option "@catppuccin_pomodoro_plus_text" "#{pomodoro_status}" )"
module=$( build_status_module "$index" "$icon" "$color" "$text" )
echo "$module"
}

View file

@ -1,10 +1,15 @@
show_session() { show_session() {
local index=$1 local index icon color text module
local icon=$(get_tmux_option "@catppuccin_session_icon" "")
local color=$(get_tmux_option "@catppuccin_session_color" "#{?client_prefix,$thm_red,$thm_green}")
local text=$(get_tmux_option "@catppuccin_session_text" "#S")
local module=$( build_status_module "$index" "$icon" "$color" "$text" ) tmux_batch_setup_status_module "session"
run_tmux_batch_commands
index=$1
icon=$(get_tmux_batch_option "@catppuccin_session_icon" "")
color=$(get_tmux_batch_option "@catppuccin_session_color" "#{?client_prefix,$thm_red,$thm_green}")
text=$(get_tmux_batch_option "@catppuccin_session_text" "#S")
module=$(build_status_module "$index" "$icon" "$color" "$text")
echo "$module" echo "$module"
} }

15
status/uptime.sh Normal file
View file

@ -0,0 +1,15 @@
show_uptime() {
local index icon color text module
tmux_batch_setup_status_module "uptime"
run_tmux_batch_commands
index=$1
icon="$(get_tmux_batch_option "@catppuccin_uptime_icon" "󰔟")"
color="$(get_tmux_batch_option "@catppuccin_uptime_color" "$thm_green")"
text="$(get_tmux_batch_option "@catppuccin_uptime_text" "#(uptime | sed 's/^[^,]*up *//; s/, *[[:digit:]]* user.*//; s/ day.*, */d /; s/:/h /; s/ min//; s/$/m/')")"
module=$(build_status_module "$index" "$icon" "$color" "$text")
echo "$module"
}

View file

@ -1,10 +1,15 @@
show_user() { show_user() {
local index=$1 local index icon color text module
local icon=$(get_tmux_option "@catppuccin_user_icon" "")
local color=$(get_tmux_option "@catppuccin_user_color" "$thm_cyan")
local text=$(get_tmux_option "@catppuccin_user_text" "#(whoami)")
local module=$( build_status_module "$index" "$icon" "$color" "$text" ) tmux_batch_setup_status_module "user"
run_tmux_batch_commands
index=$1
icon=$(get_tmux_batch_option "@catppuccin_user_icon" "")
color=$(get_tmux_batch_option "@catppuccin_user_color" "$thm_cyan")
text=$(get_tmux_batch_option "@catppuccin_user_text" "#(whoami)")
module=$(build_status_module "$index" "$icon" "$color" "$text")
echo "$module" echo "$module"
} }

View file

@ -1,11 +1,17 @@
# Requires https://github.com/xamut/tmux-weather. # Requires https://github.com/xamut/tmux-weather.
show_weather() {
local index=$1
local icon="$(get_tmux_option "@catppuccin_weather_icon" "")"
local color="$(get_tmux_option "@catppuccin_weather_color" "$thm_yellow")"
local text="$(get_tmux_option "@catppuccin_weather_text" "#{weather}")"
local module=$( build_status_module "$index" "$icon" "$color" "$text" ) show_weather() {
local index icon color text module
tmux_batch_setup_status_module "weather"
run_tmux_batch_commands
index=$1
icon="$(get_tmux_batch_option "@catppuccin_weather_icon" "")"
color="$(get_tmux_batch_option "@catppuccin_weather_color" "$thm_yellow")"
text="$(get_tmux_batch_option "@catppuccin_weather_text" "#{weather}")"
module=$(build_status_module "$index" "$icon" "$color" "$text")
echo "$module" echo "$module"
} }

View file

@ -2,13 +2,13 @@
# WARNING: hex colors can't contain capital letters # WARNING: hex colors can't contain capital letters
# --> Catppuccin (Latte) # --> Catppuccin (Latte)
thm_bg="#dce0e8" thm_bg="#eff1f5"
thm_fg="#4c4f69" thm_fg="#4c4f69"
thm_cyan="#179299" thm_cyan="#04a5e5"
thm_black="#e6e9ef" thm_black="#e6e9ef"
thm_gray="#bcc0cc" thm_gray="#ccd0da"
thm_magenta="#ea76cb" thm_magenta="#8839ef"
thm_pink="#8839ef" thm_pink="#ea76cb"
thm_red="#d20f39" thm_red="#d20f39"
thm_green="#40a02b" thm_green="#40a02b"
thm_yellow="#df8e1d" thm_yellow="#df8e1d"

25
tmux.tera Normal file
View file

@ -0,0 +1,25 @@
---
whiskers:
version: "2.1.1"
matrix:
- flavor
filename: "themes/catppuccin_{{flavor.identifier}}.tmuxtheme"
---
{%- set palette = flavor.colors -%}
# NOTE: you can use vars with $<var> and ${<var>} as long as the str is double quoted: ""
# WARNING: hex colors can't contain capital letters
# --> Catppuccin ({{ flavor.identifier | capitalize }})
thm_bg="#{{ palette.base.hex | lower }}"
thm_fg="#{{ palette.text.hex | lower }}"
thm_cyan="#{{ palette.sky.hex| lower }}"
thm_black="#{{ palette.mantle.hex | lower }}"
thm_gray="#{{ palette.surface0.hex | lower }}"
thm_magenta="#{{ palette.mauve.hex | lower }}"
thm_pink="#{{ palette.pink.hex | lower }}"
thm_red="#{{ palette.red.hex | lower }}"
thm_green="#{{ palette.green.hex | lower }}"
thm_yellow="#{{ palette.yellow.hex | lower }}"
thm_blue="#{{ palette.blue.hex | lower }}"
thm_orange="#{{ palette.peach.hex | lower }}"
thm_black4="#{{ palette.surface2.hex | lower }}"

View file

@ -0,0 +1,11 @@
#!/bin/sh
do_color_interpolation() {
local all_interpolated="$1"
for ((i=0; i<${#color_interpolation[@]}; i++)); do
all_interpolated=${all_interpolated//${color_interpolation[$i]}/${color_values[$i]}}
done
echo "$all_interpolated"
}

51
utils/module_utils.sh Normal file
View file

@ -0,0 +1,51 @@
#!/bin/sh
load_modules() {
local modules_list=$1
shift
local module_directories=("$@")
local -i module_index=0;
local module_name
local module_path
local loaded_modules
local IN=$modules_list
# https://stackoverflow.com/questions/918886/how-do-i-split-a-string-on-a-delimiter-in-bash#15988793
while [ "$IN" != "$iter" ] ;do
# extract the substring from start of string up to delimiter.
iter=${IN%% *}
# delete this first "element" AND next separator, from $IN.
IN="${IN#"$iter "}"
# Print (or doing anything with) the first "element".
module_name=$iter
for module_dir in "${module_directories[@]}" ; do
module_path="$module_dir/$module_name.sh"
if [ -r "$module_path" ]; then
# shellcheck source=/dev/null
source "$module_path"
loaded_modules="$loaded_modules$( "show_$module_name" "$module_index" )"
module_index+=1
continue 2
fi
done
if [[ -z "${module_name/ }" ]]; then
if [[ -z "${modules_list/ }" ]]; then
tmux_echo "catppuccin warning: a module list has only white space, to remove all modules set it to \\\"null\\\"" 100
else
tmux_echo "catppuccin warning: a module list with value \\\"$modules_list\\\" has leading/trailing whitespace" 101
fi
continue
fi
tmux_echo "catppuccin warning: module $module_name not found" 102
done
echo "$loaded_modules"
}

151
utils/tmux_utils.sh Normal file
View file

@ -0,0 +1,151 @@
#!/bin/sh
tmux_echo() {
local hook
hook="after-new-session[$2]"
tmux set-hook -g "$hook" "run-shell 'echo -e \"$1\"'; set-hook -gu \"$hook\""
}
get_tmux_option() {
local option value default
option="$1"
default="$2"
value=$(tmux show-option -gqv "$option")
if [ -n "$value" ]
then
if [ "$value" = "null" ]
then
echo ""
else
echo "$value"
fi
else
echo "$default"
fi
}
get_interpolated_tmux_option() {
local option value default
option="$1"
default="$2"
value=$(tmux show-option -gqv "$option")
if [ -n "$value" ]
then
if [ "$value" = "null" ]
then
echo ""
else
do_color_interpolation "$value"
fi
else
echo "$default"
fi
}
set() {
local option=$1
local value=$2
tmux_commands+=(set-option -gq "$option" "$value" ";")
}
setw() {
local option=$1
local value=$2
tmux_commands+=(set-window-option -gq "$option" "$value" ";")
}
get_tmux_batch_option() {
local option default value
option="$1"
default="$2"
for option_index in "${!tmux_batch_options[@]}"; do
IFS="" read -r read_option read_value <<<"${tmux_batch_options[$option_index]}"
if [[ "$read_option" == "$option" ]]; then
echo "$read_value"
return
fi
done
echo "$default"
}
get_interpolated_tmux_batch_option() {
local option default value
option="$1"
default="$2"
for option_index in "${!tmux_batch_options[@]}"; do
IFS="" read -r read_option read_value <<<"${tmux_batch_options[$option_index]}"
if [[ "$read_option" == "$option" ]]; then
do_color_interpolation "$read_value"
return
fi
done
echo "$default"
}
add_tmux_batch_option() {
local option
option="$1"
tmux_batch_options_commands+=("show-option -gq $option ;")
}
set_tmux_batch_option() {
local option value
option="$1"
value="$2"
# NOTE: don't check for duplicates just append
# for option_index in "${!tmux_batch_options[@]}"; do
# read -d '' -r read_option <<<"${tmux_batch_options[$option_index]}"
# if [[ "$read_option" == "$option" ]]; then
# tmux_batch_options["$option_index"]="$option$value"
# return
# fi
# done
tmux_batch_options+=("$option$value")
}
run_tmux_batch_commands() {
local temp
# shellcheck disable=SC2048,SC2086,SC2162
while IFS=' ' read option value; do
if [ -n "$value" ]; then
if [ "$value" = "null" ]; then
set_tmux_batch_option "$option" ""
else
temp="${value%\"}"
temp="${temp#\"}"
set_tmux_batch_option "$option" "$temp"
fi
fi
done < <(tmux ${tmux_batch_options_commands[*]})
tmux_batch_options_commands=()
}
tmux_batch_setup_status_module() {
local name="$1"
# Don't want to run commands set before since we can't update
# `tmux_batch_options` for it
# shellcheck disable=SC2034
tmux_batch_options_commands=()
# No need to check previous options
# shellcheck disable=SC2034
tmux_batch_options=()
add_tmux_batch_option "@catppuccin_${name}_icon"
add_tmux_batch_option "@catppuccin_${name}_color"
add_tmux_batch_option "@catppuccin_${name}_text"
}

View file

@ -1,11 +1,24 @@
show_window_current_format() { show_window_current_format() {
local number="#I" local number color background text fill current_window_format
local color=$(get_tmux_option "@catppuccin_window_current_color" "$thm_orange") # shellcheck disable=SC2034
local background=$(get_tmux_option "@catppuccin_window_current_background" "$thm_bg") local tmux_batch_options_commands=()
local text="$(get_tmux_option "@catppuccin_window_current_text" "#{b:pane_current_path}")" # use #W for application instead of directory # shellcheck disable=SC2034
local fill="$(get_tmux_option "@catppuccin_window_current_fill" "number")" # number, all, none local tmux_batch_options=()
local current_window_format=$( build_window_format "$number" "$color" "$background" "$text" "$fill" ) add_tmux_batch_option "@catppuccin_window_current_color"
add_tmux_batch_option "@catppuccin_window_current_background"
add_tmux_batch_option "@catppuccin_window_current_text"
add_tmux_batch_option "@catppuccin_window_current_fill"
run_tmux_batch_commands
number="#I"
color=$(get_tmux_batch_option "@catppuccin_window_current_color" "$thm_orange")
background=$(get_tmux_batch_option "@catppuccin_window_current_background" "$thm_bg")
text="$(get_tmux_batch_option "@catppuccin_window_current_text" "#{b:pane_current_path}")" # use #W for application instead of directory
fill="$(get_tmux_batch_option "@catppuccin_window_current_fill" "number")" # number, all, none
current_window_format=$(build_window_format "$number" "$color" "$background" "$text" "$fill" "current")
echo "$current_window_format" echo "$current_window_format"
} }

View file

@ -1,11 +1,24 @@
show_window_default_format() { show_window_default_format() {
local number="#I" local number color background text fill default_window_format
local color=$(get_tmux_option "@catppuccin_window_default_color" "$thm_blue") # shellcheck disable=SC2034
local background=$(get_tmux_option "@catppuccin_window_default_background" "$thm_gray") local tmux_batch_options_commands=()
local text="$(get_tmux_option "@catppuccin_window_default_text" "#{b:pane_current_path}")" # use #W for application instead of directory # shellcheck disable=SC2034
local fill="$(get_tmux_option "@catppuccin_window_default_fill" "number")" # number, all, none local tmux_batch_options=()
local default_window_format=$( build_window_format "$number" "$color" "$background" "$text" "$fill" ) add_tmux_batch_option "@catppuccin_window_default_color"
add_tmux_batch_option "@catppuccin_window_default_background"
add_tmux_batch_option "@catppuccin_window_default_text"
add_tmux_batch_option "@catppuccin_window_default_fill"
run_tmux_batch_commands
number="#I"
color=$(get_tmux_batch_option "@catppuccin_window_default_color" "$thm_blue")
background=$(get_tmux_batch_option "@catppuccin_window_default_background" "$thm_gray")
text="$(get_tmux_batch_option "@catppuccin_window_default_text" "#{b:pane_current_path}")" # use #W for application instead of directory
fill="$(get_tmux_batch_option "@catppuccin_window_default_fill" "number")" # number, all, none
default_window_format=$(build_window_format "$number" "$color" "$background" "$text" "$fill" "default")
echo "$default_window_format" echo "$default_window_format"
} }