about summary refs log tree commit diff stats
path: root/bin/catgirl-open.sh
blob: 76673ecde4aa078d7175832d88e1115aaefa0252 (plain) (blame)
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
#!/bin/sh
# script for tabbing together catgirl instances, similar to surf-open.sh
. ~/etc/shrc

xidfile="$XDG_CACHE_HOME/catgirl/tabbed-catgirl.xid"

choosenet() {
	for network in $(ls $HOME_ETC/catgirl/*.conf|sed 's/.*\///');
	do
	printf '%s\n' $network;
	done | dmenu -p "choose network:"
}

runtabbed() {
	tabbed -fdn comm -r 2 $TERMINAL -into '' -e catgirl $(choosenet) >"$xidfile" &
}

if [ ! -r "$xidfile" ];
then
	runtabbed
else
	xid=$(<"$xidfile")
	xprop -id "$xid" >/dev/null 2>&1
	if [ $? -gt 0 ];
	then
		runtabbed
	else
		$TERMINAL -into "$xid" -e catgirl $(choosenet) >/dev/null 2>&1 &
	fi
fi