summaryrefslogtreecommitdiffstats
path: root/w3m
blob: ede25f763205b58b6703042af956e7d19c776541 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/zsh
#set -x


session="uake"
own=$$

if [[ -z $TMUX || $1 == -f ]];then
    [[ $1 == -f ]] && shift
    /usr/bin/w3m "[email protected]"
fi

if ! ps auxww | =grep -i w3m | =grep -v $own |  =grep -vq grep;then 
    lastone=$(( $(tmux list-windows -t $session | wc -l) + 2 )) 
    tmux new-window -d -t $session:$lastone "/usr/bin/w3m lwn.net"
    tmux join-pane -s $session:$lastone -p 80
    exit
else
    winum=$(~/bin/tux tnum w3m)
fi

if [[ $? != 0 ]];then 
	print "Failed"
        return
fi
#set +x



keys=""

for f in [email protected];do
    if isurl $f;then 
        :
    else
         if [[ $f == /* ]];then
             prefix=
         else
             prefix="$PWD/"
         fi
         f="${prefix}$f"
         if [[ ! -f $f ]];then
            echo "Failed"
            exit 1
         fi
    fi
    tmux send-keys -t $session:$winum 'C-c' 'T' "$f" 'Enter'
done

#if [[ -t 1 ]];then
    #tmux join-pane -s $session:$winum -p 75 
#else
    tmux select-window -t $session:$winum  
#fi
#set +x