summaryrefslogtreecommitdiffstats
path: root/browser
blob: ed1a7a1d3a9d92e31f47e1c50e91edf74f6e4c33 (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
#!/bin/zsh
# The main browser script
URL="$1"
if [[ $URL == (#i)(*.jpg|*.png|*.jpeg) ]];then 
    notify-send "Browser" "feh for $URL"
    file=$URL:t
    file="~/.local/share/feh/$file"
    if [[ ! -f "$file" ]];then
        feh -j ~/.local/share/feh/ -k "$URL"
    else
        feh $file
    fi
    exit
fi

if [[ $URL == *youtube.com/watch* ]];then
    notify-send "Browser" "youtube for $URL"
    #DFILE=
    #trap 'rm $DFILE;kill $$' TERM
    #trap '~/bin/mplayeraux stop' INT
    #tubeplay $URL
    cvlc "$URL"
    #sleep 2
    #DFILE=$(ls -Acr |tail -1)
    #export DFILE
    exit
fi

if [[ $URL == (#i)(*.mp3|*.ogg) ]];then
    notify-send "Browser" "mp3/mplayer for $URL"
    #echo "$URL" | mpc add
    localf="${URL:t}"
    /usr/bin/wget -O - $URL | tee $HOME/media/online/$localf | /usr/bin/mplayer -cache 4096 -cache-min 40 "$URL"
    exit
fi


OB="firefox"
isrxvt=0

if [[ $0 == *ubrowser ]];then
    isrxvt=1
fi

#if [[ $URL == http://tinyurl* || $num1 == $num2 || ((! -t 1) && $isrxvt == 0) ]];then
if [[ $URL == http://tinyurl* || $isrxvt == 0 ]];then
    OB="$BROWSER"
    $OB -remote "openurl($URL)"
    #$OB "$URL"
else
    OB="$TBROWSER"
    tmux new-window -a -d -t uake: "echo -e '\a'; $OB $URL"
fi