diff options
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | Makefile | 43 | ||||
-rw-r--r-- | README | 15 | ||||
-rw-r--r-- | callbacks.c | 18 | ||||
-rw-r--r-- | examples/config/uzbl/config | 2 | ||||
-rwxr-xr-x | sandbox/env.sh | 12 | ||||
-rw-r--r-- | uzbl-core.c | 29 |
7 files changed, 80 insertions, 40 deletions
@@ -38,6 +38,7 @@ In alphabetical order: Jake Probst <jake.probst@gmail.com> - uzbl_tabbed: multiline tablist James S Wheaton (uranther) - zoom level, test framework Jan Kolkmeier (jouz) - scrolling, link following + Jason Woofenden (JasonWoof) - geometry=maximized Laurence Withers (lwithers) - talk_to_socket Mark Nevill - misc patches Mason Larobina - uzbl-tabbed.py, cookie-daemon, event-manager&plugins, ... @@ -41,8 +41,10 @@ uzbl-browser: uzbl-core # packagers, set DESTDIR to your "package directory" and PREFIX to the prefix you want to have on the end-user system # end-users who build from source: don't care about DESTDIR, update PREFIX if you want to +# RUN_PREFIX : what the prefix is when the software is run. usually the same as PREFIX PREFIX?=/usr/local INSTALLDIR?=$(DESTDIR)$(PREFIX) +RUN_PREFIX?=$(PREFIX) # the 'tests' target can never be up to date .PHONY: tests @@ -53,27 +55,28 @@ tests: ${OBJ} force $(CC) -shared -Wl ${OBJ} -o ./tests/libuzbl-core.so cd ./tests/; $(MAKE) -test: uzbl-core - ./uzbl-core --uri http://www.uzbl.org --verbose +test-uzbl-core: uzbl-core + ./uzbl-core --uri http://www.uzbl.org --verbose -test-browser: uzbl-browser - PATH="`pwd`:$$PATH" ./uzbl-browser --uri http://www.uzbl.org --verbose +test-uzbl-browser: uzbl-browser + ./uzbl-browser --uri http://www.uzbl.org --verbose -test-dev: uzbl-core - XDG_DATA_HOME=./examples/data XDG_CONFIG_HOME=./examples/config ./uzbl-core --uri http://www.uzbl.org --verbose +test-uzbl-core-sandbox: uzbl-core + make DESTDIR=./sandbox RUN_PREFIX=`pwd`/sandbox/usr/local install-uzbl-core + source ./sandbox/env.sh && uzbl-core --uri http://www.uzbl.org --verbose + make DESTDIR=./sandbox uninstall + rm -rf ./sandbox/usr -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/uzbl-cookie-daemon restart -nv & - XDG_DATA_HOME=./examples/data XDG_CACHE_HOME=./examples/cache XDG_CONFIG_HOME=./examples/config PATH="`pwd`:$$PATH" ./examples/data/uzbl/scripts/uzbl-event-manager restart -nav & - XDG_DATA_HOME=./examples/data XDG_CACHE_HOME=./examples/cache XDG_CONFIG_HOME=./examples/config PATH="`pwd`:`pwd`/examples/data/uzbl/scripts/:$$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/uzbl-cookie-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/uzbl-event-manager stop -v +test-uzbl-browser-sandbox: uzbl-browser + make DESTDIR=./sandbox RUN_PREFIX=`pwd`/sandbox/usr/local install-uzbl-browser + source ./sandbox/env.sh && uzbl-cookie-daemon restart -nv & + source ./sandbox/env.sh && uzbl-event-manager restart -nav & + source ./sandbox/env.sh && uzbl-browser --uri http://www.uzbl.org --verbose + source ./sandbox/env.sh && uzbl-cookie-daemon stop -v + source ./sandbox/env.sh && uzbl-event-manager stop -v + make DESTDIR=./sandbox uninstall + rm -rf ./sandbox/usr -test-share: uzbl-core - XDG_DATA_HOME=${INSTALLDIR}/share/uzbl/examples/data XDG_CONFIG_HOME=${INSTALLDIR}/share/uzbl/examples/config ./uzbl-core --uri http://www.uzbl.org --verbose - -test-share-browser: uzbl-browser - XDG_DATA_HOME=${INSTALLDIR}/share/uzbl/examples/data XDG_CONFIG_HOME=${INSTALLDIR}/share/uzbl/examples/config PATH="`pwd`:$$PATH" ./uzbl-browser --uri http://www.uzbl.org --verbose clean: rm -f uzbl-core @@ -96,15 +99,15 @@ install-uzbl-core: all install -m755 uzbl-core $(INSTALLDIR)/bin/uzbl-core install -m644 AUTHORS $(INSTALLDIR)/share/uzbl/docs install -m644 README $(INSTALLDIR)/share/uzbl/docs - sed -i 's#^set prefix.*=.*#set prefix = $(PREFIX)#' $(INSTALLDIR)/share/uzbl/examples/config/uzbl/config + sed -i 's#^set prefix.*=.*#set prefix = $(RUN_PREFIX)#' $(INSTALLDIR)/share/uzbl/examples/config/uzbl/config install-uzbl-browser: all install -d $(INSTALLDIR)/bin install -m755 uzbl-browser $(INSTALLDIR)/bin/uzbl-browser install -m755 examples/data/uzbl/scripts/uzbl-cookie-daemon $(INSTALLDIR)/bin/uzbl-cookie-daemon install -m755 examples/data/uzbl/scripts/uzbl-event-manager $(INSTALLDIR)/bin/uzbl-event-manager - sed -i 's#^PREFIX=.*#PREFIX=$(PREFIX)#' $(INSTALLDIR)/bin/uzbl-browser - sed -i "s#^PREFIX = .*#PREFIX = '$(PREFIX)'#" $(INSTALLDIR)/bin/uzbl-event-manager + sed -i 's#^PREFIX=.*#PREFIX=$(RUN_PREFIX)#' $(INSTALLDIR)/bin/uzbl-browser + sed -i "s#^PREFIX = .*#PREFIX = '$(RUN_PREFIX)'#" $(INSTALLDIR)/bin/uzbl-event-manager install-uzbl-tabbed: all install -d $(INSTALLDIR)/bin @@ -291,12 +291,21 @@ The above example demonstrates two things: Command substitution will launch any commands and substitute the call with the return value of the command. +There are two methods: -Uzbl will substitute any commands enclosed within @( )@: + * through a shell: enclose commands with @( )@ (quotes escaping is handled by uzbl): print Command substitution: @(uname -a)@ -You can access any uzbl variable from within a command substitution: +This method allows you to use posix shell syntax in your commands + + * directly: + + print Command substitution: @(+uname -a)@ + +This example will execute uname directly + +Note that you can access any uzbl variable from within a command substitution: print @(echo -n 'Accessing the show_status var from an external script, value: @show_status')@ @@ -496,7 +505,7 @@ Basically all events have this format: -n, --name=NAME Name of the current instance (defaults to Xorg window id) -c, --config=FILE Path to config file or '-' for stdin -s, --socket=SOCKET Socket ID - -g, --geometry=GEOMETRY Set window geometry (format: WIDTHxHEIGHT+-X+-Y) + -g, --geometry=GEOMETRY Set window geometry (format: WIDTHxHEIGHT+-X+-Y or maximized) -V, --version Print the version and exit --display=DISPLAY X display to use --help Help diff --git a/callbacks.c b/callbacks.c index 18ea2e0..dab92c1 100644 --- a/callbacks.c +++ b/callbacks.c @@ -40,12 +40,18 @@ void cmd_set_geometry() { int ret=0, x=0, y=0; unsigned int w=0, h=0; - /* we used to use gtk_window_parse_geometry() but that didn't work how it was supposed to */ - ret = XParseGeometry(uzbl.gui.geometry, &x, &y, &w, &h); - if(ret & XValue) - gtk_window_move((GtkWindow *)uzbl.gui.main_window, x, y); - if(ret & WidthValue) - gtk_window_resize((GtkWindow *)uzbl.gui.main_window, w, h); + if(uzbl.gui.geometry) { + if(uzbl.gui.geometry[0] == 'm') { /* m/maximize/maximized */ + gtk_window_maximize((GtkWindow *)(uzbl.gui.main_window)); + } else { + /* we used to use gtk_window_parse_geometry() but that didn't work how it was supposed to */ + ret = XParseGeometry(uzbl.gui.geometry, &x, &y, &w, &h); + if(ret & XValue) + gtk_window_move((GtkWindow *)uzbl.gui.main_window, x, y); + if(ret & WidthValue) + gtk_window_resize((GtkWindow *)uzbl.gui.main_window, w, h); + } + } /* update geometry var with the actual geometry this is necessary as some WMs don't seem to honour diff --git a/examples/config/uzbl/config b/examples/config/uzbl/config index d627059..34574cc 100644 --- a/examples/config/uzbl/config +++ b/examples/config/uzbl/config @@ -111,7 +111,7 @@ set status_format = <span font_family="monospace">@mode_section @keycmd_sect # === Core settings ========================================================== -set useragent = Uzbl (Webkit @WEBKIT_MAJOR.@WEBKIT_MINOR.@WEBKIT_MICRO) (@(uname -o)@ @(uname -m)@ [@ARCH_UZBL]) (Commit @COMMIT) +set useragent = Uzbl (Webkit @WEBKIT_MAJOR.@WEBKIT_MINOR.@WEBKIT_MICRO) (@(+uname -o)@ @(+uname -m)@ [@ARCH_UZBL]) (Commit @COMMIT) set fifo_dir = /tmp set socket_dir = /tmp diff --git a/sandbox/env.sh b/sandbox/env.sh new file mode 100755 index 0000000..0806055 --- /dev/null +++ b/sandbox/env.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# it would be better to use something more flexible like $(dirname $0) but i +# couldn't get to work nicely from the Makefile: +# - sourcing file gives $0 == /bin/sh +# - executing limits scope of variables too much (even with exporting) +# maybe we should spawn processes from here with an 'exec' at the end? + +XDG_DATA_HOME=./sandbox/examples/data +XDG_CACHE_HOME=./sandbox/examples/cache +XDG_CONFIG_HOME=./sandbox/examples/config +PATH=".sandbox/usr/local/share/uzbl/examples/data/uzbl/scripts/:$PATH" # needed when running uzbl-browser from here. not sure anymore why +PATH="./sandbox/usr/local/bin:$PATH" # needed to run uzbl-browser etc from here diff --git a/uzbl-core.c b/uzbl-core.c index 5da987c..fd8ee41 100644 --- a/uzbl-core.c +++ b/uzbl-core.c @@ -54,7 +54,7 @@ GOptionEntry entries[] = { "connect-socket", 0, 0, G_OPTION_ARG_STRING_ARRAY, &uzbl.state.connect_socket_names, "Connect to server socket", "CSOCKET" }, { "geometry", 'g', 0, G_OPTION_ARG_STRING, &uzbl.gui.geometry, - "Set window geometry (format: WIDTHxHEIGHT+-X+-Y)", "GEOMETRY" }, + "Set window geometry (format: WIDTHxHEIGHT+-X+-Y or maximized)", "GEOMETRY" }, { "version", 'V', 0, G_OPTION_ARG_NONE, &uzbl.behave.print_version, "Print the version and exit", NULL }, { NULL, 0, 0, 0, NULL, NULL, NULL } @@ -267,15 +267,24 @@ expand(const char *s, guint recurse) { else if(recurse != 1 && etype == EXP_EXPR) { - mycmd = expand(ret, 1); - gchar *quoted = g_shell_quote(mycmd); - gchar *tmp = g_strdup_printf("%s %s", - uzbl.behave.shell_cmd?uzbl.behave.shell_cmd:"/bin/sh -c", - quoted); - g_spawn_command_line_sync(tmp, &cmd_stdout, NULL, NULL, &err); - g_free(mycmd); - g_free(quoted); - g_free(tmp); + /* execute program directly */ + if(ret[0] == '+') { + mycmd = expand(ret+1, 1); + g_spawn_command_line_sync(mycmd, &cmd_stdout, NULL, NULL, &err); + g_free(mycmd); + } + /* execute program through shell, quote it first */ + else { + mycmd = expand(ret, 1); + gchar *quoted = g_shell_quote(mycmd); + gchar *tmp = g_strdup_printf("%s %s", + uzbl.behave.shell_cmd?uzbl.behave.shell_cmd:"/bin/sh -c", + quoted); + g_spawn_command_line_sync(tmp, &cmd_stdout, NULL, NULL, &err); + g_free(mycmd); + g_free(quoted); + g_free(tmp); + } if (err) { g_printerr("error on running command: %s\n", err->message); |