From 2a9538f7711dcea71ba5702ca94a9d9c00287ea4 Mon Sep 17 00:00:00 2001 From: luxagraf Date: Sun, 16 Feb 2020 15:57:40 -0500 Subject: added the rest of bin --- bin/open-in-pane | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 bin/open-in-pane (limited to 'bin/open-in-pane') diff --git a/bin/open-in-pane b/bin/open-in-pane new file mode 100755 index 0000000..f5f07ab --- /dev/null +++ b/bin/open-in-pane @@ -0,0 +1,23 @@ +#!/bin/sh + +W3M='/usr/bin/w3m' + +# If the window has only one pane, create one by splitting. +pane_count=`tmux list-panes -F '#{line}' | wc -l` +if [ $pane_count -lt 2 ]; then + tmux split-window -h +fi + +# Start my reader if it ain't running already, and send it the URL +# to +# open. + +w3m_process_count=`ps auxw | grep "$W3M" | grep -cv grep` + +if [ $w3m_process_count = '1' ];then + tmux send-keys -t 2 "TU" "C-u" "$1" enter + tmux select-pane -t 2 +else + tmux send-keys -t 2 "$W3M \"$1\"" enter + tmux select-pane -t 2 +fi -- cgit v1.2.3-70-g09d2