aboutsummaryrefslogtreecommitdiffhomepage
path: root/uzbl-browser
diff options
context:
space:
mode:
authorGravatar Dieter Plaetinck <dieter@plaetinck.be>2009-10-25 16:54:13 +0100
committerGravatar Dieter Plaetinck <dieter@plaetinck.be>2009-10-25 16:54:13 +0100
commitea180a8cc03260b5ca9db31fba971ab5da6b4549 (patch)
treec8cfa113968e0dc0e821a48f75b1a3da234b304b /uzbl-browser
parentf602734b897ed26126c3a23700eb0636995f53f2 (diff)
make uzbl-browser work out of the box (auto create xdg dirs, config, ..), rely on $PATH instead of own hacks, put python scripts that we actually use in $PREFIX/bin
Diffstat (limited to 'uzbl-browser')
-rwxr-xr-xuzbl-browser45
1 files changed, 35 insertions, 10 deletions
diff --git a/uzbl-browser b/uzbl-browser
index b1205ac..a075886 100755
--- a/uzbl-browser
+++ b/uzbl-browser
@@ -1,13 +1,15 @@
#!/bin/sh
-# this script implements are more useful "browsing experience".
-# We are assuming you want to use the event_manager.py and cookie_daemon.py.
-# So, you must have them in the appropriate place, and cookie_daemon_socket must be configured in the default location
+# 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
@@ -18,14 +20,37 @@ then
export XDG_CACHE_HOME=$HOME/.cache
fi
-if [ ! -S $XDG_CACHE_HOME/uzbl/cookie_daemon_socket ]
+if [ -z "$XDG_CONFIG_HOME" ]
then
- if [ -f "$XDG_DATA_HOME/uzbl/scripts/cookie_daemon.py" ]
+ 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
- $XDG_DATA_HOME/uzbl/scripts/cookie_daemon.py
- else
- /usr/local/share/uzbl/examples/data/uzbl/scripts/cookie_daemon.py
+ 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
@@ -33,7 +58,7 @@ DAEMON_PID=$XDG_CACHE_HOME/uzbl/event_daemon.pid
#if [ -f "$DAEMON_PID" ]
#then
- uzbl-daemon start
+ event_manager.py -v start
#fi
uzbl-core "$@" --connect-socket $DAEMON_SOCKET 1>/dev/null