From 6f36f8129a2a51a1123401f141161a5c9ae4ffae Mon Sep 17 00:00:00 2001 From: Shantanu Mishra Date: Tue, 27 Feb 2024 16:37:50 +0530 Subject: [PATCH] Create jump --- jump | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 jump diff --git a/jump b/jump new file mode 100644 index 0000000..3f811ba --- /dev/null +++ b/jump @@ -0,0 +1,28 @@ +#!/bin/bash + +while getopts "s:w:" opt; do + case $opt in + s) target_session=$OPTARG ;; + w) target_window=$OPTARG ;; + \?) echo "Invalid option: -$OPTARG" >&2 + exit 1 ;; + esac +done + +if [ -z "$target_session" ] || [ -z "$target_window" ]; then + echo "Usage: $0 -s -w " + exit 1 +fi + +current_session=$(tmux display-message -p '#S') +current_window=$(tmux display-message -p '#I') + +# if [ "$current_session" != "$target_session" ]; then +# tmux switch-client -t "$target_session" +# fi +# +# if [ "$current_window" -ne "$target_window" ]; then +# tmux select-window -t "$target_window" +# fi + +tmux switch-client -t "$target_session" \; select-window -t "$target_window"