summaryrefslogtreecommitdiffstats
path: root/browser
blob: 87c50c1cd6fd85ebd635960b5f310772850d8b25 (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
56
57
58
59
60
#!/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* || $URL == *vimeo.com* ]];then
    notify-send "Browser" "youtube/vimeo for $URL"
    #DFILE=
    #trap 'rm $DFILE;kill $$' TERM
    #trap '~/bin/mplayeraux stop' INT
    #tubeplay $URL
    #cvlc "$URL" &! &>/dev/null
    if [[ -t 0 ]];then
        quvi --exec "/usr/bin/mplayer %u" $URL
    else
        quvi --exec "/usr/bin/mplayer %u" $URL &!
    fi
    #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"
    #$OB "$URL"
else
    OB="$TBROWSER"
    tmux new-window -a -d -t uake: "echo -e '\a'; $OB $URL"
fi