Skip to content

Commit

Permalink
Merge branch 'main' into justify
Browse files Browse the repository at this point in the history
  • Loading branch information
sgoudham authored Mar 15, 2024
2 parents 3248549 + 4eb10fa commit b4d28bb
Show file tree
Hide file tree
Showing 5 changed files with 175 additions and 17 deletions.
71 changes: 71 additions & 0 deletions .github/scripts/test.bash
Original file line number Diff line number Diff line change
@@ -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>&2)
exit_code="$?"

check "$exit_code" "$output"
fi

kill_tmux_server
}

main "$@"
33 changes: 33 additions & 0 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
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:
severity: error
additional_files: "catppuccin.tmux"
env:
SHELLCHECK_OPTS: "-s bash"
53 changes: 53 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
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 # Bash version used by macos
steps:
- uses: actions/checkout@v4
- name: Check Syntax is Valid
shell: bash
run: |
# No tmux available in this container
tmp="$(mktemp -d)"
touch "$tmp/tmux"
chmod +x "$tmp/tmux"
export PATH="$tmp:$PATH"
bash --version
./.github/scripts/test.bash ./catppuccin.tmux
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ Values:

#### Override windows status icons
```sh
set -g @catppuccin_icon_window_last "σ°–°"
set -g @catppuccin_icon_window_current "σ°–―"
set -g @catppuccin_icon_window_zoom "󰁌"
set -g @catppuccin_icon_window_mark "󰃀"
set -g @catppuccin_icon_window_silent "σ°‚›"
set -g @catppuccin_icon_window_activity "σ°–²"
set -g @catppuccin_icon_window_bell "σ°‚ž"
set -g @catppuccin_icon_window_last "σ°–° "
set -g @catppuccin_icon_window_current "σ°–― "
set -g @catppuccin_icon_window_zoom "󰁌 "
set -g @catppuccin_icon_window_mark "󰃀 "
set -g @catppuccin_icon_window_silent "σ°‚› "
set -g @catppuccin_icon_window_activity "σ±…« "
set -g @catppuccin_icon_window_bell "σ°‚ž "
```

### Window default
Expand Down Expand Up @@ -403,16 +403,17 @@ This module depends on [tmux-loadavg](https://github.com/jamesoff/tmux-loadavg).
The prefered way to install tmux-loadavg is using [TPM](https://github.com/tmux-plugins/tpm).

#### Configure
Load tmux-weather after you load catppuccin.
Load tmux-loadavg after you load catppuccin.
```sh
set -g @plugin 'catppuccin/tmux'
...
set -g @plugin 'jamesoff/tmux-loadavg'
```

Add the weather module to the status modules list.
Add the load module to the status modules list.
```sh
set -g @catppuccin_status_modules_right "... load ..."
```

### Uptime module

Expand All @@ -424,6 +425,7 @@ The prefered way to install tmux-uptime is using [TPM](https://github.com/tmux-p

#### Configure
Load tmux-uptime after you load catppuccin.

```sh
set -g @plugin 'catppuccin/tmux'
...
Expand Down
15 changes: 7 additions & 8 deletions catppuccin.tmux
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,13 @@ setw() {

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" "σ°‚ž")
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
Expand Down

0 comments on commit b4d28bb

Please sign in to comment.