aboutsummaryrefslogtreecommitdiffhomepage
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
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
-rw-r--r--Makefile12
-rwxr-xr-xuzbl-browser45
-rwxr-xr-xuzbl-daemon25
3 files changed, 43 insertions, 39 deletions
diff --git a/Makefile b/Makefile
index f368e99..6fe6f2c 100644
--- a/Makefile
+++ b/Makefile
@@ -61,10 +61,10 @@ test-dev: uzbl-core
test-dev-browser: uzbl-browser
XDG_DATA_HOME=./examples/data XDG_CACHE_HOME=./examples/cache XDG_CONFIG_HOME=./examples/config PATH="`pwd`:$$PATH" ./examples/data/uzbl/scripts/cookie_daemon.py start -nv &
- XDG_DATA_HOME=./examples/data XDG_CACHE_HOME=./examples/cache XDG_CONFIG_HOME=./examples/config PATH="`pwd`:$$PATH" ./uzbl-daemon start -nv &
- XDG_DATA_HOME=./examples/data XDG_CACHE_HOME=./examples/cache XDG_CONFIG_HOME=./examples/config PATH="`pwd`:$$PATH" ./uzbl-browser --uri http://www.uzbl.org --verbose
+ XDG_DATA_HOME=./examples/data XDG_CACHE_HOME=./examples/cache XDG_CONFIG_HOME=./examples/config PATH="`pwd`:$$PATH" ./examples/data/uzbl/scripts/event_manager.py start -nv & #still needed? uzbl-browser takes care of this?
+ XDG_DATA_HOME=./examples/data XDG_CACHE_HOME=./examples/cache XDG_CONFIG_HOME=./examples/config PATH="`pwd`:$$PATH:`pwd`/examples/data/uzbl/scripts/" ./uzbl-browser --uri http://www.uzbl.org --verbose
XDG_DATA_HOME=./examples/data XDG_CACHE_HOME=./examples/cache XDG_CONFIG_HOME=./examples/config PATH="`pwd`:$$PATH" ./examples/data/uzbl/scripts/cookie_daemon.py stop -v
- XDG_DATA_HOME=./examples/data XDG_CACHE_HOME=./examples/cache XDG_CONFIG_HOME=./examples/config PATH="`pwd`:$$PATH" ./uzbl-daemon stop -v
+ XDG_DATA_HOME=./examples/data XDG_CACHE_HOME=./examples/cache XDG_CONFIG_HOME=./examples/config PATH="`pwd`:$$PATH" ./examples/data/uzbl/scripts/event_manager.py stop -v
test-share: uzbl-core
XDG_DATA_HOME=${PREFIX}/share/uzbl/examples/data XDG_CONFIG_HOME=${PREFIX}/share/uzbl/examples/config ./uzbl-core --uri http://www.uzbl.org --verbose
@@ -96,7 +96,9 @@ install-uzbl-core: all
install-uzbl-browser: all
install -d $(PREFIX)/bin
install -m755 uzbl-browser $(PREFIX)/bin/uzbl-browser
- install -m755 uzbl-daemon $(PREFIX)/bin/uzbl-daemon
+ install -m755 examples/data/uzbl/scripts/cookie_daemon.py $(PREFIX)/bin/cookie_daemon.py
+ install -m755 examples/data/uzbl/scripts/event_manager.py $(PREFIX)/bin/event_manager.py
+ sed -i 's#^PREFIX=.*#PREFIX=$(PREFIX)#' $(PREFIX)/bin/uzbl-browser
install-uzbl-tabbed: all
install -d $(PREFIX)/bin
@@ -104,4 +106,6 @@ install-uzbl-tabbed: all
uninstall:
rm -rf $(PREFIX)/bin/uzbl-*
+ rm -rf $(PREFIX)/bin/cookie_daemon.py
+ rm -rf $(PREFIX)/bin/event_manager.py
rm -rf $(PREFIX)/share/uzbl
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
diff --git a/uzbl-daemon b/uzbl-daemon
deleted file mode 100755
index d07beb2..0000000
--- a/uzbl-daemon
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-
-# TODO: Fix up the launcher to check the following paths in order to find the
-# correct event_manager.py to run:
-# 1. $XDG_DATA_HOME/uzbl/scripts/event_manager.py
-# 2. /usr/local/share/uzbl/examples/data/uzbl/scripts/event_manager.py
-
-if [ -z "$XDG_DATA_HOME" ]
-then
- XDG_DATA_HOME=$HOME/.local/share
-fi
-
-if [ -z "$XDG_CACHE_HOME" ]
-then
- XDG_CACHE_HOME=$HOME/.cache
-fi
-
-if [ -f "$XDG_DATA_HOME/uzbl/scripts/event_manager.py" ]
-then
- EVENT_MANAGER=$XDG_DATA_HOME/uzbl/scripts/event_manager.py
-else
- EVENT_MANAGER=/usr/local/share/uzbl/examples/data/uzbl/scripts/event_manager.py
-fi
-
-$EVENT_MANAGER -v "$@"