aboutsummaryrefslogtreecommitdiffhomepage
path: root/uzbl-browser
blob: 108429197aa58e9bc1f18a0ee59724deb21b3ccc (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
61
62
63
64
#!/bin/sh
# this script implements a more useful out-of-the-box "browsing experience".
# it does so by combining uzbl-core with a set of "recommended" tools and practices.
# see docs for more info
# If you want to customize the behavior of the cookie-daemon or similar helper tools,
# copy them to your $XDG_DATA_HOME/uzbl/scripts/, edit them and update $PATH

# Also, we assume existence of fifo/socket == correctly functioning cookie_daemon/event_manager.
# Checking correct functioning of the daemons here would be too complex here, and it's not implemented in uzbl-core either.
# But this shouldn't cause much problems..

PREFIX=/usr/local
if [ -z "$XDG_DATA_HOME" ]
then
	export XDG_DATA_HOME=$HOME/.local/share
fi

if [ -z "$XDG_CACHE_HOME" ]
then
	export XDG_CACHE_HOME=$HOME/.cache
fi

if [ -z "$XDG_CONFIG_HOME" ]
then
	export XDG_CONFIG_HOME=$HOME/.config
fi

# assure the relevant directories exist.
for dir in $XDG_CACHE_HOME/uzbl $XDG_DATA_HOME/uzbl $XDG_CONFIG_HOME/uzbl
do
	if [ ! -d $dir ]
	then
		if ! mkdir -p $dir
		then
			echo "could not create $dir" >&2
			exit 2
		fi
		# if we're initialising a new config directory, put the default (recommended) config in it
		if [ "$dir" == $XDG_CONFIG_HOME/uzbl ]
		then
			if ! cp $PREFIX/share/uzbl/examples/config/uzbl/config $XDG_CONFIG_HOME/uzbl/config
			then
				echo "Could not copy default config to $XDG_CONFIG_HOME/uzbl/config" >&2
				exit 3
			fi
		fi
	fi
done

if [ ! -S $XDG_CACHE_HOME/uzbl/cookie_daemon_socket ]
then
	# if you want to customize it, copy to your $XDG_DATA_HOME/uzbl/scripts/ and update $PATH
	cookie_daemon.py
fi

DAEMON_SOCKET=$XDG_CACHE_HOME/uzbl/event_daemon
DAEMON_PID=$XDG_CACHE_HOME/uzbl/event_daemon.pid

#if [ -f "$DAEMON_PID" ]
#then
	event_manager.py -v start
#fi

uzbl-core "$@" --connect-socket $DAEMON_SOCKET | grep -v ^EVENT