Repository navigation
Sync the theme into tmux with one source-file instead of a client per variable #15040
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| #!/bin/bash | ||
|
|
||
| source "$(dirname "$0")/base-test.sh" | ||
|
|
||
| require_command tmux | ||
|
|
||
| TEST_HOME=$(mktemp -d) | ||
| # A tmux socket path must stay short, so the scratch server lives in /tmp. | ||
| TMUX_TMPDIR=$(mktemp -d /tmp/omarchy-tmux-test.XXXXXX) | ||
| export TMUX_TMPDIR | ||
| unset TMUX | ||
| trap 'tmux kill-server 2>/dev/null; rm -rf "$TEST_HOME" "$TMUX_TMPDIR"' EXIT | ||
|
|
||
| FAKE_BIN="$TEST_HOME/bin" | ||
| CURRENT_THEME="$TEST_HOME/.local/state/omarchy/current/theme" | ||
| TMUX_LOG="$TEST_HOME/tmux.log" | ||
| REAL_TMUX=$(command -v tmux) | ||
| mkdir -p "$FAKE_BIN" "$CURRENT_THEME" | ||
|
|
||
| cat >"$FAKE_BIN/tmux" <<EOF | ||
| #!/bin/bash | ||
| printf '%s\n' "\$1" >>"$TMUX_LOG" | ||
| exec "$REAL_TMUX" -f /dev/null "\$@" | ||
| EOF | ||
| chmod +x "$FAKE_BIN/tmux" | ||
|
|
||
| cat >"$CURRENT_THEME/colors.toml" <<'EOF' | ||
| background = "#f4f4f4" | ||
| foreground = "#222222" | ||
| bright_foreground = "#111111" | ||
| EOF | ||
|
|
||
| { | ||
| for i in $(seq 1 40); do | ||
| printf 'hl.env("GUM_VAR_%s", "#%06x")\n' "$i" "$i" | ||
| done | ||
| printf '%s\n' "hl.env(\"QUOTED\", \"it's \$HOME ~ #{session_name} a;b\")" | ||
| } >"$CURRENT_THEME/gum_env.lua" | ||
|
|
||
| for session in one two three; do | ||
| "$FAKE_BIN/tmux" new-session -d -s "$session" | ||
| done | ||
| : >"$TMUX_LOG" | ||
|
|
||
| PATH="$FAKE_BIN:$ROOT/bin:$PATH" HOME="$TEST_HOME" "$ROOT/bin/omarchy-theme-set-tmux" | ||
|
|
||
| for target in -g "-t one" "-t two" "-t three"; do | ||
| [[ $(tmux show-environment $target GUM_VAR_40) == "GUM_VAR_40=#000028" ]] || fail "tmux theme sync sets gum variables ($target)" | ||
| [[ $(tmux show-environment $target COLORFGBG) == "COLORFGBG=0;15" ]] || fail "tmux theme sync sets a light COLORFGBG ($target)" | ||
| done | ||
| pass "tmux theme sync sets theme variables globally and in every session" | ||
|
|
||
| [[ $(tmux show-environment -t two QUOTED) == "QUOTED=it's \$HOME ~ #{session_name} a;b" ]] || \ | ||
| fail "tmux theme sync passes values through literally" "$(tmux show-environment -t two QUOTED)" | ||
| pass "tmux theme sync passes values through literally" | ||
|
|
||
| [[ $(tmux show-options -gv window-style) == "fg=#222222,bg=#f4f4f4" ]] || fail "tmux theme sync sets the window style" | ||
| [[ $(tmux show-options -gv window-active-style) == "fg=#222222,bg=#f4f4f4" ]] || fail "tmux theme sync sets the active window style" | ||
| [[ $(tmux show-options -gv cursor-colour) == "#111111" ]] || fail "tmux theme sync sets the cursor colour" | ||
| pass "tmux theme sync sets window styles and the cursor colour" | ||
|
|
||
| (( $(wc -l <"$TMUX_LOG") <= 8 )) || fail "tmux theme sync batches its settings into a few tmux clients" "$(sort "$TMUX_LOG" | uniq -c)" | ||
| pass "tmux theme sync batches its settings into a few tmux clients" | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.