aboutsummaryrefslogtreecommitdiffstats
path: root/executables/bin
diff options
context:
space:
mode:
authorEugene Triguba <eugene.triguba@paymentworks.com>2025-07-07 08:45:05 -0400
committerEugene Triguba <eugene.triguba@paymentworks.com>2025-07-07 08:45:05 -0400
commitb6f57c53d10e9f0b841c41aadcd0234332ec1438 (patch)
tree9d24d92191e36390bae35bad050b3609c12795dc /executables/bin
parenttweak nvim config (diff)
parentadjust hotkey (diff)
downloaddotfiles-b6f57c53d10e9f0b841c41aadcd0234332ec1438.zip
Merge remote-tracking branch 'upstream'
Diffstat (limited to 'executables/bin')
-rwxr-xr-xexecutables/bin/tmux-toggle-term23
1 files changed, 23 insertions, 0 deletions
diff --git a/executables/bin/tmux-toggle-term b/executables/bin/tmux-toggle-term
new file mode 100755
index 0000000..6d6cbd7
--- /dev/null
+++ b/executables/bin/tmux-toggle-term
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+set -uo pipefail
+
+FLOAT_TERM="${1:-}"
+LIST_PANES="$(tmux list-panes -F '#F')"
+PANE_ZOOMED="$(echo "${LIST_PANES}" | grep Z)"
+PANE_COUNT="$(echo "${LIST_PANES}" | wc -l | bc)"
+
+if [ -n "${FLOAT_TERM}" ]; then
+ if [ "$(tmux display-message -p -F "#{session_name}")" = "popup" ]; then
+ tmux detach-client
+ else
+ tmux popup -d '#{pane_current_path}' -xC -yC -w90% -h80% -E "tmux attach -t popup || tmux new -s popup"
+ fi
+else
+ if [ "${PANE_COUNT}" = 1 ]; then
+ tmux split-window -c "#{pane_current_path}"
+ elif [ -n "${PANE_ZOOMED}" ]; then
+ tmux select-pane -t:.-
+ else
+ tmux resize-pane -Z -t1
+ fi
+fi