Skip to content

Instantly share code, notes, and snippets.

@cgsdev0
Created August 13, 2024 11:32
Show Gist options
  • Save cgsdev0/c5fd87b0213992bd50194f315296dc98 to your computer and use it in GitHub Desktop.
Save cgsdev0/c5fd87b0213992bd50194f315296dc98 to your computer and use it in GitHub Desktop.
#!/bin/bash
popup() {
TMP="$(mktemp)"
trap "rm $TMP" EXIT
cat > "$TMP"
tmux display-popup -w $WIDTH -h $HEIGHT $* "cat \"$TMP\" | termsand"
}
PANE=$(tmux display -p "#{pane_id}")
DIMENSIONS="$(tmux display -p "#{pane_width}x#{pane_height}")"
POSITION="$(tmux display -p "#{pane_left}x#{pane_top}")"
HEIGHT="${DIMENSIONS#*x}"
WIDTH="${DIMENSIONS%x*}"
Y="${POSITION#*x}"
((Y+=HEIGHT+1))
X="${POSITION%x*}"
STUFF="$(tmux capture-pane -p -e -t "$PANE")"
echo -e "$STUFF" \
| popup -E -B -y$Y -x$X -w $WIDTH -h $HEIGHT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment