From ea180a8cc03260b5ca9db31fba971ab5da6b4549 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sun, 25 Oct 2009 16:54:13 +0100 Subject: 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 --- uzbl-browser | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) (limited to 'uzbl-browser') 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 -- cgit v1.2.3