aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/uzbl-browser
blob: 1b7abe7425b2b1939f2734800053bccfeee99582 (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
65
66
67
68
69
70
#!/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 any of the helper tools, copy them
# to your $XDG_DATA_HOME/uzbl/scripts/ and edit them

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
	fi
done

# if no config exists yet in the recommended location, put the default (recommended) config there
if [ ! -f $XDG_CONFIG_HOME/uzbl/config ]
then
	if [ ! -r $PREFIX/share/uzbl/examples/config/config ]
	then
		echo "Error: Global config not found; please check if your distribution ships them separately"
		exit 3
	fi
	if ! cp $PREFIX/share/uzbl/examples/config/config $XDG_CONFIG_HOME/uzbl/config
	then
		echo "Could not copy default config to $XDG_CONFIG_HOME/uzbl/config" >&2
		# Run with the global configs as a last resort
		config="--config $PREFIX/share/uzbl/examples/config/config"
	fi
fi

# uzbl-cookie-manager will exit if another instance is already running.
# we could also check if its pid file exists to avoid having to spawn it.
#if [ ! -f "$XDG_CACHE_HOME"/uzbl/cookie_daemon_socket.pid ]
#then
	${UZBL_COOKIE_DAEMON:-uzbl-cookie-manager}
#fi

# uzbl-event-manager will exit if one is already running.
# we could also check if its pid file exists to avoid having to spawn it.
DAEMON_SOCKET="$XDG_CACHE_HOME"/uzbl/event_daemon
#if [ ! -f "$DAEMON_SOCKET".pid ]
#then
	${UZBL_EVENT_MANAGER:-uzbl-event-manager -va start}
#fi

exec uzbl-core "$@" $config --connect-socket $DAEMON_SOCKET