diff options
| author | Eugene Triguba <hello@eugenetriguba.com> | 2026-11-23 18:32:47 -0800 |
|---|---|---|
| committer | Eugene Triguba <hello@eugenetriguba.com> | 2026-11-23 18:32:47 -0800 |
| commit | cd3885855692653a4ac7a48adabc60009e70a8ef (patch) | |
| tree | 0c60a3a4bb3e6c14f72dd550ca9d7ca08019ac64 /tests/tmux.sh | |
| parent | Fix format of installation config in readme file (diff) | |
| download | tmux-toggle-term-cd3885855692653a4ac7a48adabc60009e70a8ef.zip | |
Change toggle term float and split key defaults
- `@toggle-term-float-key` now defaults to `f`.
- `@toggle-term-split-key` now defaults to `;`.
Diffstat (limited to 'tests/tmux.sh')
| -rw-r--r-- | tests/tmux.sh | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/tmux.sh b/tests/tmux.sh new file mode 100644 index 0000000..23c2700 --- /dev/null +++ b/tests/tmux.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bats + +tmux_new_session() { + tmux_cmd new-session -d -s "$1" +} + +tmux_kill_server() { + tmux_cmd kill-server || true +} + +tmux_pane_count() { + num_panes=$(tmux_cmd list-panes | wc -l | sed 's/^[[:space:]]*//g') + echo "$num_panes" +} + +tmux_active_panes() { + active_panes=$(tmux_cmd list-panes -F '#{pane_active}' | tr '\n' '-' | sed 's/-$//g') + echo "$active_panes" +} + +tmux_is_zoomed() { + is_zoomed=$(tmux_cmd list-panes -F '#{window_zoomed_flag}') + if echo "$is_zoomed" | grep -q 1; then + echo 'true' + else + echo 'false' + fi +} + +tmux_set_option() { + option="$1" + value="$2" + tmux_cmd set-option -g "$option" "$value" +} + +tmux_get_key_bindings() { + tmux_cmd list-keys 2>/dev/null | grep "toggle-term" || echo "" +} + +tmux_cmd() { + tmux -f "$TMUX_CONFIG_PATH" -L "$TMUX_SOCKET" "$@" +} + +tmux_has_prefix_binding() { + key="$1" + mode="$2" + tmux_get_key_bindings | grep -q "bind-key.*-T prefix.*${key}.*toggle-term.sh $mode" +} + +tmux_has_root_binding() { + key="$1" + mode="$2" + tmux_get_key_bindings | grep -q "bind-key.*-T root.*\"*${key}\"*.*toggle-term.sh $mode" +} |