summaryrefslogtreecommitdiff
path: root/bin/guiscripts/osurftxt
blob: ef601664d27f0fdaf1711332ef0983c490591bf5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh

# open all links in txt file into one tabbed surf

# dependencies: surf, osurf, dmenu

# $1: file path for non interactive use
if [ -z "$1" ]
then 
	d="$HOME/dl/txtabs"
	f="$(find "$d" -type f -printf '%f\n' | dmenu)"
	[ "$f" ] || exit 1
	f="$d"/"$f"
else
	[ -f "$1" ] || exit 1
	f="$1"
fi

winid="$(osurf "$(head -n 1 "$f")")"
tail -n +2 "$f" | while read -r url;
	do surf -e "$winid" "$url" &
	done