diff options
37 files changed, 695 insertions, 505 deletions
@@ -1,6 +1,8 @@ uzbl-core *.o +*.lo *.pyc +*.sw[a-z] *~ tags -uzbl-cookie-manager +sandbox @@ -31,6 +31,7 @@ In alphabetical order: Cedric Staub - Javascript cookies Chris Mason - code snippets such as basic cookie handler Chris van Dijk (quigybo) - work on uzbl-tabbed + Christer Sjöholm - uzbl-tabbed bugfixes Ciprian Dorin, Craciun - patches Daiki Ueno (ueno) - fix for crash when opening image in new window Damien Leon - misc @@ -53,6 +54,7 @@ In alphabetical order: Jason Woofenden (JasonWoof) - geometry=maximized, link following Jochen Sprickerhof - session.sh enhancements k0ral - split status bar, cleanup and bugfix patches + Klaus T. Aehlig - various patches Lars-Dominik Braun (PromyLOPh) - added ability to enable/disable the webkit page cache Laurence Withers (lwithers) - talk_to_socket Luca Bruno <lucab@debian.org> - bashims fixes @@ -66,6 +68,7 @@ In alphabetical order: Moritz Lenz - small doc fix Nicolas Pouillard - refactored scroll command Olivier Schwander - auto file:// prepend + Olof-Joachim Frahm - bugfixes Paul Tomak - formfiller.sh script, uzbl vim syntax Paweł Zuzelski (pawelz) <pawelz@pld-linux.org> - http auth handler, misc patches Peter Suschlik - backwards searching @@ -84,7 +87,7 @@ In alphabetical order: Also, thanks to all people who've posted useful things to the mailing list and/or wiki. -Originaly based on http://trac.webkit.org/browser/trunk/WebKitTools/GtkLauncher/main.c +Originally based on http://trac.webkit.org/browser/trunk/WebKitTools/GtkLauncher/main.c Which is copyrighted: 2006, 2007 Apple Inc 2007 Alp Toker <alp@atoker.com> @@ -68,13 +68,13 @@ test-uzbl-core: uzbl-core ./uzbl-core --uri http://www.uzbl.org --verbose test-uzbl-browser: uzbl-browser - ./src/uzbl-browser --uri http://www.uzbl.org --verbose + ./bin/uzbl-browser --uri http://www.uzbl.org --verbose test-uzbl-core-sandbox: uzbl-core make DESTDIR=./sandbox RUN_PREFIX=`pwd`/sandbox/usr/local install-uzbl-core make DESTDIR=./sandbox RUN_PREFIX=`pwd`/sandbox/usr/local install-example-data cp -np ./misc/env.sh ./sandbox/env.sh - source ./sandbox/env.sh && uzbl-core --uri http://www.uzbl.org --verbose + . ./sandbox/env.sh && uzbl-core --uri http://www.uzbl.org --verbose make DESTDIR=./sandbox uninstall rm -rf ./sandbox/usr @@ -83,20 +83,21 @@ test-uzbl-browser-sandbox: uzbl-browser make DESTDIR=./sandbox RUN_PREFIX=`pwd`/sandbox/usr/local install-uzbl-browser make DESTDIR=./sandbox RUN_PREFIX=`pwd`/sandbox/usr/local install-example-data cp -np ./misc/env.sh ./sandbox/env.sh - -source ./sandbox/env.sh && uzbl-event-manager restart -avv - source ./sandbox/env.sh && uzbl-browser --uri http://www.uzbl.org --verbose - source ./sandbox/env.sh && uzbl-event-manager stop -ivv + -. ./sandbox/env.sh && uzbl-event-manager restart -avv + . ./sandbox/env.sh && uzbl-browser --uri http://www.uzbl.org --verbose + . ./sandbox/env.sh && uzbl-event-manager stop -ivv make DESTDIR=./sandbox uninstall rm -rf ./sandbox/usr test-uzbl-tabbed-sandbox: uzbl-browser make DESTDIR=./sandbox RUN_PREFIX=`pwd`/sandbox/usr/local install-uzbl-core make DESTDIR=./sandbox RUN_PREFIX=`pwd`/sandbox/usr/local install-uzbl-browser + make DESTDIR=./sandbox RUN_PREFIX=`pwd`/sandbox/usr/local install-uzbl-tabbed make DESTDIR=./sandbox RUN_PREFIX=`pwd`/sandbox/usr/local install-example-data cp -np ./misc/env.sh ./sandbox/env.sh - -source ./sandbox/env.sh && uzbl-event-manager restart -avv - source ./sandbox/env.sh && ./sandbox/home/.local/share/uzbl/scripts/uzbl-tabbed - source ./sandbox/env.sh && uzbl-event-manager stop -ivv + -. ./sandbox/env.sh && uzbl-event-manager restart -avv + . ./sandbox/env.sh && uzbl-tabbed + . ./sandbox/env.sh && uzbl-event-manager stop -ivv make DESTDIR=./sandbox uninstall rm -rf ./sandbox/usr @@ -134,8 +135,8 @@ install-uzbl-core: all install-dirs install -m755 uzbl-core $(INSTALLDIR)/bin/uzbl-core install-uzbl-browser: install-dirs - install -m755 src/uzbl-browser $(INSTALLDIR)/bin/uzbl-browser - install -m755 examples/data/scripts/uzbl-event-manager $(INSTALLDIR)/bin/uzbl-event-manager + install -m755 bin/uzbl-browser $(INSTALLDIR)/bin/uzbl-browser + install -m755 bin/uzbl-event-manager $(INSTALLDIR)/bin/uzbl-event-manager mv $(INSTALLDIR)/bin/uzbl-browser $(INSTALLDIR)/bin/uzbl-browser.bak sed 's#^PREFIX=.*#PREFIX=$(RUN_PREFIX)#' < $(INSTALLDIR)/bin/uzbl-browser.bak > $(INSTALLDIR)/bin/uzbl-browser chmod 755 $(INSTALLDIR)/bin/uzbl-browser @@ -146,7 +147,7 @@ install-uzbl-browser: install-dirs rm $(INSTALLDIR)/bin/uzbl-event-manager.bak install-uzbl-tabbed: install-dirs - install -m755 examples/data/scripts/uzbl-tabbed $(INSTALLDIR)/bin/uzbl-tabbed + install -m755 bin/uzbl-tabbed $(INSTALLDIR)/bin/uzbl-tabbed # you probably only want to do this manually when testing and/or to the sandbox. not meant for distributors install-example-data: @@ -257,9 +257,14 @@ The following commands are recognized: - Show the WebInspector * `add_cookie <domain> <path> <name> <value> <scheme> <expires>` - Adds a new cookie to the cookie jar -* 'delete_cookie <domain> <path> <name> <value> [<scheme> <expires>]` - - Deletes a matching cookie from the cookie jar. scheme and expire time - is currently not considered when matching. +* `delete_cookie <domain> <path> <name> <value> [<scheme> <expires>]` + - Deletes a matching cookie from the cookie jar. scheme and expire time + is currently not considered when matching. +* `clear_cookies` + - Clears all cookies from the cookie jar +* `download <uri> [<destination path>]` + - Starts a download using the given uri. A destination file path can be given + to specify where the download should be written to. ### VARIABLES AND CONSTANTS @@ -504,9 +509,15 @@ Handler scripts (`download_handler`, `cookie_handler`, `scheme_handler` and * download handler - `$1 url`: The URL of the item to be downloaded. - - `$2 suggested_filename`: A filename suggested by the server or based on the URL. + - `$2 suggested_filename`: A filename suggested by the server or based on the + URL. - `$3 content_type`: The mimetype of the file to be downloaded. - - `$4 total_size`: The size of the file to be downloaded in bytes. This may be inaccurate. + - `$4 total_size`: The size of the file to be downloaded in bytes. This may be + inaccurate. + - `$5 destination_path`: This is only present if the download was started + explicitly using the `download` command. If it is present, this is the path + that the file should be saved to. A download handler using WebKit's internal + downloader can just echo this path and exit when this argument is present. * cookie handler diff --git a/src/uzbl-browser b/bin/uzbl-browser index 81645ca..fb9a368 100755 --- a/src/uzbl-browser +++ b/bin/uzbl-browser @@ -42,7 +42,7 @@ then echo "Error: Global config not found; please check if your distribution ships them separately" exit 3 fi - if ! cp "$EXAMPLES"/config/config "$XDG_CONFIG_HOME"/uzbl/config + if ! cp "$EXAMPLES"/config/* "$XDG_CONFIG_HOME"/uzbl/ then echo "Could not copy default config to $XDG_CONFIG_HOME/uzbl/config" >&2 # Run with the global config as a last resort diff --git a/examples/data/scripts/uzbl-event-manager b/bin/uzbl-event-manager index cb462c7..cb462c7 100755 --- a/examples/data/scripts/uzbl-event-manager +++ b/bin/uzbl-event-manager diff --git a/examples/data/scripts/uzbl-tabbed b/bin/uzbl-tabbed index 72de00e..a15967a 100755 --- a/examples/data/scripts/uzbl-tabbed +++ b/bin/uzbl-tabbed @@ -363,6 +363,116 @@ class SocketClient: map(source_remove, self._watchers) self._watchers = [] +class EventDispatcher: + def __init__(self, uzbl): + self.uzbl = uzbl + self.parent = self.uzbl.parent + + def dispatch(self, message_type, args): + method = getattr(self, message_type.lower(), None) + + if method is None: + return + + return method(*args) + + def title_changed(self, title): + self.uzbl.title = title.strip() + self.uzbl.title_changed(False) + + def variable_set(self, var, _type, val): + try: + val = int(val) + except: + pass + + if var in UZBL_TABBED_VARS: + if config[var] != val: + config[var] = val + if var == "show_gtk_tabs": + self.parent.notebook.set_show_tabs(bool(val)) + elif var == "show_tablist" or var == "tablist_top": + self.parent.update_tablist_display() + elif var == "gtk_tab_pos": + self.parent.update_gtk_tab_pos() + elif var == "status_background": + if config['status_background'].strip(): + try: + col = gtk.gdk.color_parse(config['status_background']) + self.parent.ebox.modify_bg(gtk.STATE_NORMAL, col) + except ValueError: + pass # got an invalid colour, just ignore it + elif var == "tab_titles" or var == "tab_indexes": + for tab in self.parent.notebook: + self.parent.tabs[tab].title_changed(True) + + self.parent.update_tablist() + else: + config[var] = val + + if var == "uri": + self.uzbl.uri = val.strip() + self.parent.update_tablist() + + def load_commit(self, uri): + self.uzbl.uri = uri + + def new_tab(self, uri = None): + if uri: + self.parent.new_tab(uri) + else: + self.parent.new_tab() + + def new_tab_bg(self, uri = None): + if uri: + self.parent.new_tab(uri, switch = False) + else: + self.parent.new_tab(switch = False) + + def new_tab_next(self, uri = None): + if uri: + self.parent.new_tab(uri, next=True) + else: + self.parent.new_tab(next=True) + + def new_bg_tab_next(self, uri = None): + if uri: + self.parent.new_tab(uri, switch = False, next = True) + else: + self.parent.new_tab(switch = False, next = True) + + def next_tab(self, step = None): + if step: + self.parent.next_tab(int(step)) + else: + self.parent.next_tab() + + def prev_tab(self, step = None): + if step: + self.parent.prev_tab(int(step)) + else: + self.parent.prev_tab() + + def goto_tab(self, index): + self.parent.goto_tab(int(index)) + + def first_tab(self): + self.parent.goto_tab(0) + + def last_tab(self): + self.parent.goto_tab(-1) + + def preset_tabs(self, *args): + self.parent.parse_command(["preset"] + [ a for a in args ]) + + def bring_to_front(self): + self.parent.window.present() + + def clean_tabs(self): + self.parent.clean_slate() + + def exit_all_tabs(self): + self.parent.quitrequest() class UzblInstance: '''Uzbl instance meta-data/meta-action object.''' @@ -371,10 +481,13 @@ class UzblInstance: self.parent = parent self.tab = tab + self.dispatcher = EventDispatcher(self) + self.name = name self.title = title self.tabtitle = "" self.uri = uri + self._client = None self._switch = switch # Switch to tab after loading ? self.title_changed() @@ -458,82 +571,10 @@ class UzblInstance: ''' Parse event givent by the Uzbl instance ''' cmd = self.parse_event(cmd) - message, type, args = cmd[0], cmd[2], cmd[3:] - if message == "EVENT": - if type == "TITLE_CHANGED": - self.title = args[0].strip() - self.title_changed(False) - elif type == "VARIABLE_SET": - var, val = args[0], args[2] - - try: - val = int(val) - except: - pass - - if var in UZBL_TABBED_VARS: - if config[var] != val: - config[var] = val - if var == "show_gtk_tabs": - self.parent.notebook.set_show_tabs(bool(val)) - elif var == "show_tablist" or var == "tablist_top": - self.parent.update_tablist_display() - elif var == "gtk_tab_pos": - self.parent.update_gtk_tab_pos() - elif var == "status_background": - if config['status_background'].strip(): - col = gtk.gdk.color_parse(config['status_background']) - self.parent.ebox.modify_bg(gtk.STATE_NORMAL, col) - elif var == "tab_titles" or var == "tab_indexes": - for tab in self.parent.notebook: - self.parent.tabs[tab].title_changed(True) - - self.parent.update_tablist() - else: - config[var] = val - - if var == "uri": - self.uri = val.strip() - self.parent.update_tablist() - elif type == "LOAD_COMMIT": - self.uri = args[0] - elif type == "NEW_TAB": - if args: - self.parent.new_tab(args[0]) - else: - self.parent.new_tab() - elif type == "NEW_BG_TAB": - self.parent.new_tab(args[0], '', 0) - elif type == "NEW_TAB_NEXT": - self.parent.new_tab(args[0], next=True) - elif type == "NEW_BG_TAB_NEXT": - self.parent.new_tab(args[0], '', 0, next=True) - - elif type == "NEXT_TAB": - if args: - self.parent.next_tab(int(args[0])) - else: - self.parent.next_tab() - elif type == "PREV_TAB": - if args: - self.parent.prev_tab(int(args[0])) - else: - self.parent.prev_tab() - elif type == "GOTO_TAB": - self.parent.goto_tab(int(args[0])) - elif type == "FIRST_TAB": - self.parent.goto_tab(0) - elif type == "LAST_TAB": - self.parent.goto_tab(-1) - elif type == "PRESET_TABS": - self.parent.parse_command(["preset"] + args) - elif type == "BRING_TO_FRONT": - self.parent.window.present() - elif type == "CLEAN_TABS": - self.parent.clean_slate() - elif type == "EXIT_ALL_TABS": - self.parent.quitrequest() + message, message_type, args = cmd[0], cmd[2], cmd[3:] + if message == "EVENT": + self.dispatcher.dispatch(message_type, args) def close(self): '''The remote instance exited''' @@ -578,6 +619,11 @@ class UzblTabbed: self.window.set_title("Uzbl Browser") self.window.set_border_width(0) + # this prevents the window from expanding if the contents of the + # statusbar are wider than the window. + # i suspect this is not the right way to do this. + self.window.set_geometry_hints(min_width=1) + # Set main window icon icon_path = config['icon_path'] if os.path.exists(icon_path): @@ -956,6 +1002,8 @@ class UzblTabbed: error("parse_command: preset %r does not exist." % path) elif cmd[1] == "list": + # FIXME: what argument is this supposed to be passed, + # and why? uzbl = self.get_tab_by_name(int(cmd[2])) if uzbl: if not os.path.isdir(config['saved_sessions_dir']): @@ -1389,6 +1437,10 @@ if __name__ == "__main__": action='store_true', help="ignore session saving a loading.") parser.add_option('-v', '--verbose', dest='verbose', action='store_true', help='print verbose output.') + parser.add_option('-s', '--socketdir', dest='socketdir', + help="directory to create socket") + parser.add_option('-f', '--fifodir', dest='fifodir', + help="directory to create fifo") # Parse command line options (options, uris) = parser.parse_args() @@ -1403,6 +1455,12 @@ if __name__ == "__main__": import pprint sys.stderr.write("%s\n" % pprint.pformat(config)) + if options.socketdir: + config['socket_dir'] = options.socketdir + + if options.fifodir: + config['fifo_dir'] = options.fifodir + uzbl = UzblTabbed() # All extra arguments given to uzbl_tabbed.py are interpreted as diff --git a/examples/config/config b/examples/config/config index a1a3494..ab789f9 100644 --- a/examples/config/config +++ b/examples/config/config @@ -4,9 +4,10 @@ # === Core settings ========================================================== # common directory locations -set prefix = @(echo $PREFIX)@ -set data_home = @(echo $XDG_DATA_HOME)@ -set cache_home = @(echo $XDG_CACHE_HOME)@ +set prefix = @(echo $PREFIX)@ +set data_home = @(echo $XDG_DATA_HOME)@ +set cache_home = @(echo $XDG_CACHE_HOME)@ +set config_home = @(echo $XDG_CONFIG_HOME)@ # Interface paths. set fifo_dir = /tmp @@ -72,6 +73,7 @@ set download_handler = sync_spawn @scripts_dir/download.sh # add some javascript to the page for other 'js' and 'script' commands to access later. @on_event LOAD_COMMIT js uzbl = {}; @on_event LOAD_COMMIT script @scripts_dir/formfiller.js +@on_event LOAD_COMMIT script @scripts_dir/follow.js # Userscripts/per-site-settings. See the script and the example configuration for details #@on_event LOAD_COMMIT spawn @scripts_dir/per-site-settings.py @data_home/uzbl/per-site-settings @@ -93,6 +95,9 @@ set download_handler = sync_spawn @scripts_dir/download.sh # === Behaviour and appearance =============================================== +# Custom CSS can be defined here, including link follower hint styles +set stylesheet_uri = file://@config_home/uzbl/style.css + set show_status = 1 set status_top = 0 set status_background = #303030 @@ -181,6 +186,7 @@ set ebind = @mode_bind global,-insert # Resets keycmd and returns to default mode. @on_event ESCAPE @set_mode @on_event ESCAPE event KEYCMD_CLEAR +@on_event ESCAPE js uzbl.follow.clearHints() @bind <Escape> = event ESCAPE @bind <Ctrl>[ = event ESCAPE @@ -263,6 +269,9 @@ set ebind = @mode_bind global,-insert @cbind n = search @cbind N = search_reverse +# Print pages to a printer +@cbind <Ctrl>p = hardcopy + # Web searching binds @cbind gg<Google:>_ = uri http://www.google.com/search?q=\@<encodeURIComponent(%r)>\@ @cbind ddg<DuckDuckGo:>_ = uri http://duckduckgo.com/?q=%s @@ -296,6 +305,13 @@ set ebind = @mode_bind global,-insert # Hard-bound bookmarks @cbind gh = uri http://www.uzbl.org +# New window binds +@cbind gw = event REQ_NEW_WINDOW + +# SSL-ify bindings +@cbind zs = uri \@(echo "$UZBL_URI" | sed -e 's/^http:/https:/')\@ +@cbind zS = event REQ_NEW_WINDOW \@(echo "$UZBL_URI" | sed -e 's/^http:/https:/')\@ + # Yanking & pasting binds @cbind yu = sh 'echo -n "$UZBL_URI" | xclip' @cbind yU = sh 'echo -n "$1" | xclip' \@SELECTED_URI @@ -321,14 +337,19 @@ set ebind = @mode_bind global,-insert @cbind U = spawn @scripts_dir/load_url_from_history.sh @cbind u = spawn @scripts_dir/load_url_from_bookmarks.sh +# Temporary bookmarks +@cbind <Ctrl>d = spawn @scripts_dir/insert_temp.sh +@cbind D = spawn @scripts_dir/load_url_from_temps.sh + # Link following (similar to vimperator and konqueror) # Set custom keys you wish to use for navigation. Some common examples: set follow_hint_keys = 0123456789 #set follow_hint_keys = qwerty #set follow_hint_keys = asdfghjkl; #set follow_hint_keys = thsnd-rcgmvwb/;789aefijkopquxyz234 -@cbind fl* = spawn @scripts_dir/follow.sh "%s" -@cbind gi = spawn @scripts_dir/go_input.sh +@cbind fl* = spawn @scripts_dir/follow.sh \@< uzbl.follow("\@follow_hint_keys", "%s", 0) >\@ +@cbind Fl* = spawn @scripts_dir/follow.sh \@< uzbl.follow("\@follow_hint_keys", "%s", 1) >\@ +@cbind fi = spawn @scripts_dir/go_input.sh # Form filler binds # This script allows you to configure (per domain) values to fill in form @@ -336,10 +357,10 @@ set follow_hint_keys = 0123456789 # This implementation allows you to save multiple profiles for each form # (think about multiple accounts on some website). set formfiller = spawn @scripts_dir/formfiller.sh -@cbind za = @formfiller add @cbind ze = @formfiller edit @cbind zn = @formfiller new @cbind zl = @formfiller load +@cbind zo = @formfiller once # --- Uzbl tabbed binds ------------------------------------------------------ @@ -365,7 +386,8 @@ set preset = event PRESET_TABS @cbind gs<preset save:>_ = @preset save %s @cbind glo<preset load:>_ = @preset load %s @cbind gd<preset del:>_ = @preset del %s -@cbind gli = @preset list +# This doesn't work right now. +#@cbind gli = @preset list # === Context menu items ===================================================== diff --git a/examples/config/style.css b/examples/config/style.css new file mode 100644 index 0000000..a368aa0 --- /dev/null +++ b/examples/config/style.css @@ -0,0 +1,28 @@ +#uzbl_link_hints > span { + z-index: 1000 !important; + + background-color: #333 !important; + margin: 0 !important; + padding: 3px !important; + + color: #ccc !important; + font-size: 9px !important; + line-height: 9px !important; + font-weight: bold !important; + font-variant: normal !important; + text-decoration: none !important; + + -webkit-transform: translate(-5px,-5px); + opacity: 0.8; + -webkit-border-radius: 6px !important; + /* Play around with this, pretty fun things to do :) */ + /* -webkit-transform: scale(1) rotate(0deg) translate(-6px,-5px) !important; */ +} + +/* we can have different colours for different types of hints! */ +#uzbl_link_hints.new-window > span { + background-color: #ffff00 !important; + color: black !important; +} + +/* vim:set et ts=4: */ diff --git a/examples/data/scripts/download.sh b/examples/data/scripts/download.sh index c410ad2..dbc9caf 100755 --- a/examples/data/scripts/download.sh +++ b/examples/data/scripts/download.sh @@ -1,25 +1,63 @@ #!/bin/sh -# # uzbl's example configuration sets this script up as its download_handler. -# when uzbl starts a download it runs this script. +# this script is run when uzbl encounters a URL that it can't display, and when +# a download is requested using the 'download' command. +# # if the script prints a file path to stdout, uzbl will save the download to -# that path. -# if nothing is printed to stdout, the download will be cancelled. +# that path using it's internal downloader. +# +# if nothing is printed to stdout, the internal download will be cancelled. +# you could do your own download handling in your script that way. -. $UZBL_UTIL_DIR/uzbl-dir.sh +# if $5 is set, it is the path that was passed to uzbl's "download" command. +# we want to use that if it's available. +[ -n "$5" ] && echo "$5" && exit + +. "$UZBL_UTIL_DIR/uzbl-dir.sh" # the URL that is being downloaded -uri=$1 +uri="$1" +shift + +safe_uri="$( echo "$uri" | sed -e 's/\W/-/g' )" # a filename suggested by the server or based on the URL -suggested_filename=${2:-$(echo "$uri" | sed 's/\W/-/g')} +suggested_filename="${1:-$safe_uri}" +shift # the mimetype of the file being downloaded -content_type=$3 +content_type="$1" +shift # the size of the downloaded file in bytes. this is not always accurate, since # the server might not have sent a size with its response headers. -total_size=$4 +total_size="$1" +shift + +case "$suggested_filename" in + # example: save torrents to a separate directory + #*.torrent) + # path="$UZBL_DOWNLOAD_DIR/torrents/$suggested_filename" + # ;; + # Default case + *) + path="$UZBL_DOWNLOAD_DIR/$suggested_filename" + ;; +esac + +# Do nothing if we don't want to save the file +[ -z "$path" ] && exit 0 + +# Check if the file exists +if [ ! -e "$path" ]; then + echo "$path" + exit 0 +fi + +# Try to make a unique filename +count=1 +while [ -e "$path.$count" ]; do + count=$(( $count + 1 )) +done -# just save the file to the default directory with the suggested name -echo $UZBL_DOWNLOAD_DIR/$suggested_filename +echo "$path.$count" diff --git a/examples/data/scripts/follow.js b/examples/data/scripts/follow.js index d995696..b7b0d82 100644 --- a/examples/data/scripts/follow.js +++ b/examples/data/scripts/follow.js @@ -1,219 +1,197 @@ /* This is the basic linkfollowing script. - * Its pretty stable, and you configure which keys to use for hinting * - * TODO: Some pages mess around a lot with the zIndex which - * lets some hints in the background. - * TODO: Some positions are not calculated correctly (mostly - * because of uber-fancy-designed-webpages. Basic HTML and CSS - * works good - * TODO: Still some links can't be followed/unexpected things - * happen. Blame some freaky webdesigners ;) + * TODO: + * Some pages mess around a lot with the zIndex which + * lets some hints in the background. + * Some positions are not calculated correctly (mostly + * because of uber-fancy-designed-webpages. Basic HTML and CSS + * works good + * Still some links can't be followed/unexpected things + * happen. Blame some freaky webdesigners ;) */ -//Just some shortcuts and globals -var uzblid = 'uzbl_link_hint'; -var uzbldivid = uzblid + '_div_container'; -var doc = document; -var win = window; -var links = document.links; -var forms = document.forms; -//Make onlick-links "clickable" -try { - HTMLElement.prototype.click = function() { - if (typeof this.onclick == 'function') { - this.onclick({ - type: 'click' - }); - } - }; -} catch(e) {} -//Catch the ESC keypress to stop linkfollowing -function keyPressHandler(e) { - var kC = window.event ? event.keyCode: e.keyCode; - var Esc = window.event ? 27 : e.DOM_VK_ESCAPE; - if (kC == Esc) { - removeAllHints(); - } +// Globals +uzbldivid = 'uzbl_link_hints'; + +uzbl.follow = function() { + // Export + charset = arguments[0]; + newwindow = arguments[2]; + + var keypress = arguments[1]; + return arguments.callee.followLinks(keypress); +} + +uzbl.follow.isFrame = function(el) { + return (el.tagName == "FRAME" || el.tagName == "IFRAME"); +} + +// find the document that the given element belongs to +uzbl.follow.getDocument = function(el) { + if (this.isFrame(el)) + return el.contentDocument; + + var doc = el; + while (doc.parentNode !== null) + doc = doc.parentNode; + return doc; +} + +// find all documents in the display, searching frames recursively +uzbl.follow.documents = function() { + return this.windows().map(function(w) { return w.document; }).filter(function(d) { return d != null; }); +} + +// find all windows in the display, searching for frames recursively +uzbl.follow.windows = function(w) { + w = (typeof w == 'undefined') ? window.top : w; + + var wins = [w]; + var frames = w.frames; + for(var i = 0; i < frames.length; i++) + wins = wins.concat(uzbl.follow.windows(frames[i])); + return wins; +} + +// search all frames for elements matching the given CSS selector +uzbl.follow.query = function(selector) { + var res = []; + this.documents().forEach(function (doc) { + var set = doc.body.querySelectorAll(selector); + // convert the NodeList to an Array + set = Array.prototype.slice.call(set); + res = res.concat(set); + }); + return res; } -//Calculate element position to draw the hint -//Pretty accurate but on fails in some very fancy cases -function elementPosition(el) { - var up = el.offsetTop; - var left = el.offsetLeft; - var width = el.offsetWidth; + +// Calculate element position to draw the hint +uzbl.follow.elementPosition = function(el) { + // el.getBoundingClientRect is another way to do this, but when a link is + // line-wrapped we want our hint at the left end of the link, not its + // bounding rectangle + var up = el.offsetTop; + var left = el.offsetLeft; + var width = el.offsetWidth; var height = el.offsetHeight; + while (el.offsetParent) { el = el.offsetParent; up += el.offsetTop; left += el.offsetLeft; } + return [up, left, width, height]; } -//Calculate if an element is visible -function isVisible(el) { - if (el == doc) { - return true; - } - if (!el) { - return false; - } - if (!el.parentNode) { - return false; - } - if (el.style) { - if (el.style.display == 'none') { - return false; - } - if (el.style.visibility == 'hidden') { - return false; - } - } - return isVisible(el.parentNode); -} -//Calculate if an element is on the viewport. -function elementInViewport(el) { - offset = elementPosition(el); - var up = offset[0]; - var left = offset[1]; - var width = offset[2]; + +// Calculate if an element is on the viewport. +uzbl.follow.elementInViewport = function(el) { + offset = uzbl.follow.elementPosition(el); + var up = offset[0]; + var left = offset[1]; + var width = offset[2]; var height = offset[3]; - return up < window.pageYOffset + window.innerHeight && left < window.pageXOffset + window.innerWidth && (up + height) > window.pageYOffset && (left + width) > window.pageXOffset; + return up < window.pageYOffset + window.innerHeight && + left < window.pageXOffset + window.innerWidth && + (up + height) > window.pageYOffset && + (left + width) > window.pageXOffset; } -//Removes all hints/leftovers that might be generated -//by this script. -function removeAllHints() { + +// Removes all hints/leftovers that might be generated +// by this script in the given document. +uzbl.follow.removeHints = function(doc) { var elements = doc.getElementById(uzbldivid); - if (elements) { - elements.parentNode.removeChild(elements); - } + if (elements) elements.parentNode.removeChild(elements); +} + +// Clears all hints in every document +uzbl.follow.clearHints = function() { + this.documents().forEach(uzbl.follow.removeHints); } -//Generate a hint for an element with the given label -//Here you can play around with the style of the hints! -function generateHint(el, label) { - var pos = elementPosition(el); - var hint = doc.createElement('div'); - hint.setAttribute('name', uzblid); + +// Generate a hint for an element with the given label +// Here you can play around with the style of the hints! +uzbl.follow.generateHint = function(doc, el, label, top, left) { + var hint = doc.createElement('span'); hint.innerText = label; - hint.style.display = 'inline'; - hint.style.backgroundColor = '#B9FF00'; - hint.style.border = '2px solid #4A6600'; - hint.style.color = 'black'; - hint.style.fontSize = '9px'; - hint.style.fontWeight = 'bold'; - hint.style.lineHeight = '9px'; - hint.style.margin = '0px'; - hint.style.width = 'auto'; // fix broken rendering on w3schools.com - hint.style.padding = '1px'; hint.style.position = 'absolute'; - hint.style.zIndex = '1000'; - // hint.style.textTransform = 'uppercase'; - hint.style.left = pos[1] + 'px'; - hint.style.top = pos[0] + 'px'; - // var img = el.getElementsByTagName('img'); - // if (img.length > 0) { - // hint.style.top = pos[1] + img[0].height / 2 - 6 + 'px'; - // } - hint.style.textDecoration = 'none'; - // hint.style.webkitBorderRadius = '6px'; // slow - // Play around with this, pretty funny things to do :) - // hint.style.webkitTransform = 'scale(1) rotate(0deg) translate(-6px,-5px)'; + hint.style.top = top + 'px'; + hint.style.left = left + 'px'; return hint; } -// Here we choose what to do with an element that the user has selected. -// Form elements get selected and/or focussed, and links and buttons are -// clicked. This function returns "XXXRESET_MODEXXX" to indicate that uzbl -// should be reset to command mode with an empty keycmd, or -// "XXX_EMIT_FORM_ACTIVEXXX" to indicate that uzbl should be set to insert mode. -function clickElem(item) { - removeAllHints(); - if (item) { - var name = item.tagName; - if (name == 'BUTTON') { - item.click(); - return "XXXRESET_MODEXXX"; - } else if (name == 'INPUT') { - var type = item.type.toUpperCase(); - if (type == 'TEXT' || type == 'SEARCH' || type == 'PASSWORD') { - item.focus(); - item.select(); - return "XXXEMIT_FORM_ACTIVEXXX"; - } else { - item.click(); - return "XXXRESET_MODEXXX"; - } - } else if (name == 'TEXTAREA' || name == 'SELECT') { +// Here we choose what to do with an element if we +// want to "follow" it. On form elements we "select" +// or pass the focus, on links we try to perform a click, +// but at least set the href of the link. (needs some improvements) +uzbl.follow.clickElem = function(item) { + if(!item) return; + var name = item.tagName; + + if (name == 'INPUT') { + var type = item.getAttribute('type').toUpperCase(); + if (type == 'TEXT' || type == 'FILE' || type == 'PASSWORD') { item.focus(); item.select(); return "XXXEMIT_FORM_ACTIVEXXX"; - } else { - item.click(); - window.location = item.href; - return "XXXRESET_MODEXXX"; - } - } -} -//Returns a list of all links (in this version -//just the elements itself, but in other versions, we -//add the label here. -function addLinks() { - res = [[], []]; - for (var l = 0; l < links.length; l++) { - var li = links[l]; - if (isVisible(li) && elementInViewport(li)) { - res[0].push(li); - } - } - return res; -} -//Same as above, just for the form elements -function addFormElems() { - res = [[], []]; - for (var f = 0; f < forms.length; f++) { - for (var e = 0; e < forms[f].elements.length; e++) { - var el = forms[f].elements[e]; - if (el && ['INPUT', 'TEXTAREA', 'SELECT', 'BUTTON'].indexOf(el.tagName) + 1 && isVisible(el) && elementInViewport(el)) { - res[0].push(el); - } } + // otherwise fall through to a simulated mouseclick. + } else if (name == 'TEXTAREA' || name == 'SELECT') { + item.focus(); + item.select(); + return "XXXEMIT_FORM_ACTIVEXXX"; } - return res; + + // simulate a mouseclick to activate the element + var mouseEvent = document.createEvent("MouseEvent"); + mouseEvent.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); + item.dispatchEvent(mouseEvent); + return "XXXRESET_MODEXXX"; } -//Draw all hints for all elements passed. "len" is for -//the number of chars we should use to avoid collisions -function reDrawHints(elems, chars) { - removeAllHints(); - var hintdiv = doc.createElement('div'); - hintdiv.setAttribute('id', uzbldivid); - for (var i = 0; i < elems[0].length; i++) { - if (elems[0][i]) { - var label = elems[1][i].substring(chars); - var h = generateHint(elems[0][i], label); - hintdiv.appendChild(h); - } - } - if (document.body) { - document.body.appendChild(hintdiv); - } + +// Draw all hints for all elements passed. +uzbl.follow.reDrawHints = function(elems, chars) { + var elements = elems.map(function(pair) { return pair[0] }); + var labels = elems.map(function(pair) { return pair[1].substring(chars) }); + // we have to calculate element positions before we modify the DOM + // otherwise the elementPosition call slows way down. + var positions = elements.map(uzbl.follow.elementPosition); + + this.documents().forEach(function(doc) { + uzbl.follow.removeHints(doc); + if (!doc.body) return; + doc.hintdiv = doc.createElement('div'); + doc.hintdiv.id = uzbldivid; + if(newwindow) doc.hintdiv.className = "new-window"; + doc.body.appendChild(doc.hintdiv); + }); + + elements.forEach(function(el, i) { + var label = labels[i]; + var pos = positions[i]; + var doc = uzbl.follow.getDocument(el); + var h = uzbl.follow.generateHint(doc, el, label, pos[0], pos[1]); + doc.hintdiv.appendChild(h); + }); } + // pass: number of keys // returns: key length -function labelLength(n) { +uzbl.follow.labelLength = function(n) { var oldn = n; var keylen = 0; - if(n < 2) { - return 1; - } - n -= 1; // our highest key will be n-1 + if(n < 2) return 1; + n -= 1; // Our highest key will be n-1 while(n) { keylen += 1; n = Math.floor(n / charset.length); } return keylen; } + // pass: number // returns: label -function intToLabel(n) { +uzbl.follow.intToLabel = function(n) { var label = ''; do { label = charset.charAt(n % charset.length) + label; @@ -221,55 +199,68 @@ function intToLabel(n) { } while(n); return label; } + // pass: label // returns: number -function labelToInt(label) { +uzbl.follow.labelToInt = function(label) { var n = 0; - var i; - for(i = 0; i < label.length; ++i) { + for(var i = 0; i < label.length; ++i) { n *= charset.length; n += charset.indexOf(label[i]); } return n; } -//Put it all together -function followLinks(follow) { - // if(follow.charAt(0) == 'l') { - // follow = follow.substr(1); - // charset = 'thsnlrcgfdbmwvz-/'; - // } + +// Put it all together +uzbl.follow.followLinks = function(follow) { var s = follow.split(''); - var linknr = labelToInt(follow); - if (document.body) document.body.setAttribute('onkeyup', 'keyPressHandler(event)'); - var linkelems = addLinks(); - var formelems = addFormElems(); - var elems = [linkelems[0].concat(formelems[0]), linkelems[1].concat(formelems[1])]; - var len = labelLength(elems[0].length); - var oldDiv = doc.getElementById(uzbldivid); - var leftover = [[], []]; - if (s.length == len && linknr < elems[0].length && linknr >= 0) { - return clickElem(elems[0][linknr]); - } else { - for (var j = 0; j < elems[0].length; j++) { - var b = true; - var label = intToLabel(j); - var n = label.length; - for (n; n < len; n++) { - label = charset.charAt(0) + label; - } - for (var k = 0; k < s.length; k++) { - b = b && label.charAt(k) == s[k]; - } - if (b) { - leftover[0].push(elems[0][j]); - leftover[1].push(label); - } + var linknr = this.labelToInt(follow); + + var followable = 'a, area, textarea, select, input:not([type=hidden]), button, *[onclick]'; + var uri = 'a, area, frame, iframe'; + //var focusable = 'a, area, textarea, select, input:not([type=hidden]), button, frame, iframe, applet, object'; + //var desc = '*[title], img[alt], applet[alt], area[alt], input[alt]'; + //var image = 'img, input[type=image]'; + + if(newwindow) + var res = this.query(uri); + else + var res = this.query(followable); + + var elems = res.filter(uzbl.follow.elementInViewport); + var len = this.labelLength(elems.length); + + if (s.length == len && linknr < elems.length && linknr >= 0) { + // an element has been selected! + var el = elems[linknr]; + + // clear all of our hints + this.clearHints(); + + if (newwindow) { + // we're opening a new window using the URL attached to this element + var uri = el.src || el.href; + if(uri.match(/javascript:/)) return; + window.open(uri); + return "XXXRESET_MODEXXX" } - reDrawHints(leftover, s.length); + + // we're just going to click the element + return this.clickElem(el); + } + + var leftover = []; + for (var j = 0; j < elems.length; j++) { + var b = true; + var label = this.intToLabel(j); + var n = label.length; + for (n; n < len; n++) + label = charset.charAt(0) + label; + for (var k = 0; k < s.length; k++) + b = b && label.charAt(k) == s[k]; + if (b) + leftover.push([elems[j], label]); } -} -//Parse input: first argument is follow keys, second is user input. -var args = '%s'.split(' '); -var charset = args[0]; -followLinks(args[1]); + this.reDrawHints(leftover, s.length); +} diff --git a/examples/data/scripts/follow.sh b/examples/data/scripts/follow.sh index d7fe117..014793e 100755 --- a/examples/data/scripts/follow.sh +++ b/examples/data/scripts/follow.sh @@ -1,21 +1,13 @@ #!/bin/sh +# This scripts acts on the return value of followLinks in follow.js -# This script is just a wrapper around follow.js that lets us change uzbl's mode -# after a link is selected. - -# if socat is installed then we can change Uzbl's input mode once a link is -# selected; otherwise we just select a link. -if ! which socat >/dev/null 2>&1; then - echo 'script @scripts_dir/follow.js "@{follow_hint_keys} '$1'"' > "$UZBL_FIFO" - exit -fi - -result=$(echo 'script @scripts_dir/follow.js "@{follow_hint_keys} '$1'"' | socat - unix-connect:"$UZBL_SOCKET") -case $result in - *XXXEMIT_FORM_ACTIVEXXX*) - # a form element was selected - echo 'event FORM_ACTIVE' > "$UZBL_FIFO" ;; - *XXXRESET_MODEXXX*) - # a link was selected, reset uzbl's input mode - printf 'set mode=\nevent KEYCMD_CLEAR\n' > "$UZBL_FIFO" ;; +case "$1" in + XXXEMIT_FORM_ACTIVEXXX) + # a form element was selected + printf 'event FORM_ACTIVE\nevent KEYCMD_CLEAR\n' > "$UZBL_FIFO" + ;; + XXXRESET_MODEXXX) + # a link was selected, reset uzbl's input mode + printf 'set mode=\nevent KEYCMD_CLEAR\n' > "$UZBL_FIFO" + ;; esac diff --git a/examples/data/scripts/formfiller.sh b/examples/data/scripts/formfiller.sh index 3dc9dc4..c1171a0 100755 --- a/examples/data/scripts/formfiller.sh +++ b/examples/data/scripts/formfiller.sh @@ -66,22 +66,22 @@ ParseFields () field = $0 sub ( /[^:]*:/, "", field ) - if ( parts[2] ~ /(text|password|search)/ ) + if ( parts[2] ~ /^(text|password|search)$/ ) printf( "js uzbl.formfiller.insert(\"%s\",\"%s\",\"%s\",0);\n", parts[1], parts[2], field ) - else if ( parts[2] ~ /(checkbox|radio)/ ) + else if ( parts[2] ~ /^(checkbox|radio)$/ ) printf( "js uzbl.formfiller.insert(\"%s\",\"%s\",\"%s\",%s);\n", parts[1], parts[2], parts[3], field ) - else if ( parts[2] == "textarea" ) { + else if ( parts[2] ~ /^textarea$/ ) { field = "" while (getline) { if ( /^%/ ) break sub ( /^\\/, "" ) gsub ( /"/, "\\\"" ) gsub ( /\\/, "\\\\" ) - field = field $0 "\\n" + field = field $0 "\\\\n" } printf( "js uzbl.formfiller.insert(\"%s\",\"%s\",\"%s\",0);\n", parts[1], parts[2], field ) @@ -116,7 +116,7 @@ Load () ParseProfile $option < "$file" \ | ParseFields \ - | sed 's/@/\\@/' \ + | sed 's/@/\\@/g' \ > "$UZBL_FIFO" } @@ -132,7 +132,7 @@ Once () test -e "$tmpfile" && ParseFields < "$tmpfile" \ - | sed 's/@/\\@' \ + | sed 's/@/\\@/g' \ > "$UZBL_FIFO" } diff --git a/examples/data/scripts/go_input.sh b/examples/data/scripts/go_input.sh index ace0e79..9797788 100755 --- a/examples/data/scripts/go_input.sh +++ b/examples/data/scripts/go_input.sh @@ -1,5 +1,7 @@ #!/bin/sh -case $(echo 'script @scripts_dir/go_input.js' | socat - unix-connect:"$UZBL_SOCKET") in - *XXXEMIT_FORM_ACTIVEXXX*) echo 'event FORM_ACTIVE' > "$UZBL_FIFO" ;; +case "$( echo "script @scripts_dir/go_input.js" | socat - "unix-connect:$UZBL_SOCKET" )" in + *XXXEMIT_FORM_ACTIVEXXX*) + echo "event FORM_ACTIVE" > "$UZBL_FIFO" + ;; esac diff --git a/examples/data/scripts/history.sh b/examples/data/scripts/history.sh index 266d65d..0709b5e 100755 --- a/examples/data/scripts/history.sh +++ b/examples/data/scripts/history.sh @@ -1,7 +1,7 @@ #!/bin/sh -. $UZBL_UTIL_DIR/uzbl-dir.sh +. "$UZBL_UTIL_DIR/uzbl-dir.sh" -[ -w "$UZBL_HISTORY_FILE" ] || [ ! -a "$UZBL_HISTORY_FILE" ] || exit 1 +>> "$UZBL_HISTORY_FILE" || exit 1 -echo $(date +'%Y-%m-%d %H:%M:%S')" $UZBL_URI $UZBL_TITLE" >> $UZBL_HISTORY_FILE +echo "$( date +'%Y-%m-%d %H:%M:%S' ) $UZBL_URI $UZBL_TITLE" >> "$UZBL_HISTORY_FILE" diff --git a/examples/data/scripts/insert_bookmark.sh b/examples/data/scripts/insert_bookmark.sh index f67e67a..f310e49 100755 --- a/examples/data/scripts/insert_bookmark.sh +++ b/examples/data/scripts/insert_bookmark.sh @@ -1,15 +1,14 @@ #!/bin/sh -. "$UZBL_UTIL_DIR"/uzbl-dir.sh +. "$UZBL_UTIL_DIR/uzbl-dir.sh" -[ -d "$UZBL_DATA_DIR" ] || exit 1 -[ -w "$UZBL_BOOKMARKS_FILE" ] || [ ! -a "$UZBL_BOOKMARKS_FILE" ] || exit 1 +>> "$UZBL_BOOKMARKS_FILE" || exit 1 which zenity >/dev/null 2>&1 || exit 2 -tags=$(zenity --entry --text="Enter space-separated tags for bookmark $UZBL_URI:") -exitstatus=$? -[ $exitstatus -eq 0 ] || exit $exitstatus +tags="$( zenity --entry --text="Enter space-separated tags for bookmark $UZBL_URI:" )" +exitstatus="$?" +[ "$exitstatus" -eq 0 ] || exit "$exitstatus" # TODO: check if already exists, if so, and tags are different: ask if you want to replace tags echo "$UZBL_URI $tags" >> "$UZBL_BOOKMARKS_FILE" diff --git a/examples/data/scripts/insert_temp.sh b/examples/data/scripts/insert_temp.sh new file mode 100755 index 0000000..7ed8d22 --- /dev/null +++ b/examples/data/scripts/insert_temp.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +. "$UZBL_UTIL_DIR/uzbl-dir.sh" + +>> "$UZBL_TEMPS_FILE" || exit 1 + +echo "$UZBL_URI $UZBL_TITLE" >> "$UZBL_TEMPS_FILE" diff --git a/examples/data/scripts/instance-select-wmii.sh b/examples/data/scripts/instance-select-wmii.sh index 19d04e8..b2aadbb 100755 --- a/examples/data/scripts/instance-select-wmii.sh +++ b/examples/data/scripts/instance-select-wmii.sh @@ -1,6 +1,5 @@ #!/bin/sh - # This script allows you to focus another uzbl window # It considers all uzbl windows in the current tag # you can select one from a list, or go to the next/previous one @@ -13,30 +12,30 @@ DMENU_SCHEME="wmii" -. $UZBL_UTIL_DIR/dmenu.sh +. "$UZBL_UTIL_DIR/dmenu.sh" case "$1" in - "list" ) - list= + "list") + list="" # get window id's of uzbl clients. we could also get the label in one shot but it's pretty tricky - for i in $(wmiir read /tag/sel/index | grep uzbl |cut -d ' ' -f2); do - label=$(wmiir read /client/$i/label) + for i in $( wmiir read /tag/sel/index | grep uzbl | cut -d ' ' -f 2 ); do + label="$( wmiir read /client/$i/label )" list="$list$i : $label\n" done - window=$(printf "$list\n" | $DMENU | cut -d ' ' -f1) + window="$( echo "$list" | $DMENU | cut -d ' ' -f 1 )" wmiir xwrite /tag/sel/ctl "select client $window" ;; - "next" ) - current=$(wmiir read /client/sel/ctl | head -n 1) + "next") + current="$( wmiir read /client/sel/ctl | head -n 1 )" # find the next uzbl window and focus it - next=$(wmiir read /tag/sel/index | grep -A 10000 " $current " | grep -m 1 uzbl | cut -d ' ' -f2) + next="$( wmiir read /tag/sel/index | grep -A 10000 " $current " | grep -m 1 uzbl | cut -d ' ' -f 2 )" if [ -n "$next" ]; then wmiir xwrite /tag/sel/ctl "select client $next" fi ;; - "prev" ) - current=$(wmiir read /client/sel/ctl | head -n 1) - prev=$(wmiir read /tag/sel/index | grep -B 10000 " $current " | tac | grep -m 1 uzbl | cut -d ' ' -f2) + "prev") + current="$( wmiir read /client/sel/ctl | head -n 1 )" + prev="$( wmiir read /tag/sel/index | grep -B 10000 " $current " | tac | grep -m 1 uzbl | cut -d ' ' -f 2 )" if [ -n "$prev" ]; then wmiir xwrite /tag/sel/ctl "select client $prev" fi diff --git a/examples/data/scripts/load_cookies.sh b/examples/data/scripts/load_cookies.sh index 17ec2ad..c7fcc58 100755 --- a/examples/data/scripts/load_cookies.sh +++ b/examples/data/scripts/load_cookies.sh @@ -1,20 +1,21 @@ #!/bin/sh -if [ "$1" != "" ]; then - cookie_file=$1 +if [ -n "$1" ]; then + cookie_file="$1" + shift else - cookie_file=${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/cookies.txt + cookie_file="${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/cookies.txt" fi awk -F \\t ' BEGIN { - scheme["TRUE"] = "https"; - scheme["FALSE"] = "http"; + scheme["TRUE"] = "https"; + scheme["FALSE"] = "http"; } $0 ~ /^#HttpOnly_/ { -printf("add_cookie \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"\n", substr($1,length("#HttpOnly_"),length($1)), $3, $6, $7, scheme[$4], $5) + printf("add_cookie \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"\n", substr($1,length("#HttpOnly_"),length($1)), $3, $6, $7, scheme[$4], $5) } $0 !~ /^#/ { -printf("add_cookie \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"\n", $1, $3, $6, $7, scheme[$4], $5) + printf("add_cookie \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"\n", $1, $3, $6, $7, scheme[$4], $5) } -' $cookie_file +' "$cookie_file" diff --git a/examples/data/scripts/load_url_from_bookmarks.sh b/examples/data/scripts/load_url_from_bookmarks.sh index a5d9586..a03db4b 100755 --- a/examples/data/scripts/load_url_from_bookmarks.sh +++ b/examples/data/scripts/load_url_from_bookmarks.sh @@ -5,18 +5,18 @@ DMENU_SCHEME="bookmarks" DMENU_OPTIONS="xmms vertical resize" -. "$UZBL_UTIL_DIR"/dmenu.sh -. "$UZBL_UTIL_DIR"/uzbl-dir.sh +. "$UZBL_UTIL_DIR/dmenu.sh" +. "$UZBL_UTIL_DIR/uzbl-dir.sh" [ -r "$UZBL_BOOKMARKS_FILE" ] || exit 1 if [ -z "$DMENU_HAS_VERTICAL" ]; then # because they are all after each other, just show the url, not their tags. - goto=$(awk '{print $1}' "$UZBL_BOOKMARKS_FILE" | $DMENU) + goto="$( awk '{ print $1 }' "$UZBL_BOOKMARKS_FILE" | $DMENU )" else # show tags as well - goto=$($DMENU < "$UZBL_BOOKMARKS_FILE" | awk '{print $1}') + goto="$( $DMENU < "$UZBL_BOOKMARKS_FILE" | cut -d ' ' -f 1 )" fi [ -n "$goto" ] && echo "uri $goto" > "$UZBL_FIFO" -#[ -n "$goto" ] && echo "uri $goto" | socat - unix-connect:"$UZBL_SOCKET" +#[ -n "$goto" ] && echo "uri $goto" | socat - "unix-connect:$UZBL_SOCKET" diff --git a/examples/data/scripts/load_url_from_history.sh b/examples/data/scripts/load_url_from_history.sh index 59ad492..24bfdce 100755 --- a/examples/data/scripts/load_url_from_history.sh +++ b/examples/data/scripts/load_url_from_history.sh @@ -3,21 +3,20 @@ DMENU_SCHEME="history" DMENU_OPTIONS="xmms vertical resize" -. "$UZBL_UTIL_DIR"/dmenu.sh -. "$UZBL_UTIL_DIR"/uzbl-dir.sh +. "$UZBL_UTIL_DIR/dmenu.sh" +. "$UZBL_UTIL_DIR/uzbl-dir.sh" [ -r "$UZBL_HISTORY_FILE" ] || exit 1 # choose from all entries, sorted and uniqued -# goto=$(awk '{print $3}' $history_file | sort -u | dmenu -i) if [ -z "$DMENU_HAS_VERTICAL" ]; then - current=$(tail -n 1 "$UZBL_HISTORY_FILE" | awk '{print $3}'); - goto=$( (echo $current; awk '{print $3}' "$UZBL_HISTORY_FILE" | grep -v "^$current\$" | sort -u) | $DMENU) + current="$( tail -n 1 "$UZBL_HISTORY_FILE" | cut -d ' ' -f 3 )" + goto="$( ( echo "$current"; awk '{ print $3 }' "$UZBL_HISTORY_FILE" | grep -v "^$current\$" | sort -u ) | $DMENU )" else # choose an item in reverse order, showing also the date and page titles # pick the last field from the first 3 fields. this way you can pick a url (prefixed with date & time) or type just a new url. - goto=$(tac "$UZBL_HISTORY_FILE" | $DMENU | cut -d ' ' -f -3 | awk '{print $NF}') + goto="$( tac "$UZBL_HISTORY_FILE" | $DMENU | cut -d ' ' -f -3 | awk '{ print $NF }' )" fi [ -n "$goto" ] && echo "uri $goto" > "$UZBL_FIFO" -#[ -n "$goto" ] && echo "uri $goto" | socat - unix-connect:"$UZBL_SOCKET" +#[ -n "$goto" ] && echo "uri $goto" | socat - "unix-connect:$UZBL_SOCKET" diff --git a/examples/data/scripts/load_url_from_temps.sh b/examples/data/scripts/load_url_from_temps.sh new file mode 100755 index 0000000..b46687b --- /dev/null +++ b/examples/data/scripts/load_url_from_temps.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +DMENU_SCHEME="temps" +DMENU_OPTIONS="xmms vertical resize" + +. "$UZBL_UTIL_DIR/dmenu.sh" +. "$UZBL_UTIL_DIR/uzbl-dir.sh" + +[ -r "$UZBL_TEMPS_FILE" ] || exit 1 + +if [ -z "$DMENU_HAS_VERTICAL" ]; then + # because they are all after each other, just show the url, not their titles. + goto=$( awk '{ print $1 }' "$UZBL_TEMPS_FILE" | $DMENU ) +else + # show titles + goto=$( $DMENU < "$UZBL_TEMPS_FILE" | cut -d ' ' -f 1 ) +fi + +sed -i -e "\<^$goto <d" $UZBL_TEMPS_FILE + +[ -n "$goto" ] && echo "uri $goto" > "$UZBL_FIFO" +#[ -n "$goto" ] && echo "uri $goto" | socat - "unix-connect:$UZBL_SOCKET" diff --git a/examples/data/scripts/session.sh b/examples/data/scripts/session.sh index ee09cf2..4e7bfd1 100755 --- a/examples/data/scripts/session.sh +++ b/examples/data/scripts/session.sh @@ -18,28 +18,30 @@ if [ -z "$UZBL_UTIL_DIR" ]; then # we're being run standalone, we have to figure out where $UZBL_UTIL_DIR is # using the same logic as uzbl-browser does. - UZBL_UTIL_DIR=${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/scripts/util + UZBL_UTIL_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/scripts/util" if ! [ -d "$UZBL_UTIL_DIR" ]; then - PREFIX=$(grep '^PREFIX' "$(which uzbl-browser)" | sed 's/.*=//') - UZBL_UTIL_DIR=$PREFIX/share/uzbl/examples/data/scripts/util + PREFIX="$( grep '^PREFIX' "$( which uzbl-browser )" | sed -e 's/.*=//' )" + UZBL_UTIL_DIR="$PREFIX/share/uzbl/examples/data/scripts/util" fi fi -. "$UZBL_UTIL_DIR"/uzbl-dir.sh +. "$UZBL_UTIL_DIR/uzbl-dir.sh" + [ -d "$UZBL_DATA_DIR" ] || exit 1 -UZBL="uzbl-browser -c $UZBL_CONFIG_FILE" # add custom flags and whatever here. +UZBL="uzbl-browser -c \"$UZBL_CONFIG_FILE\"" # add custom flags and whatever here. -scriptfile=$(readlink -f $0) # this script +scriptfile="$( readlink -f "$0" )" # this script act="$1" +shift if [ -z "$act" ]; then [ -f "$UZBL_SESSION_FILE" ] && act="launch" || act="endsession" fi case $act in - "launch" ) - urls=$(cat "$UZBL_SESSION_FILE") + "launch") + urls="$( cat "$UZBL_SESSION_FILE" )" if [ -z "$urls" ]; then $UZBL else @@ -50,17 +52,17 @@ case $act in fi ;; - "endinstance" ) + "endinstance") if [ -z "$UZBL_FIFO" ]; then echo "session manager: endinstance must be called from uzbl" exit 1 fi [ "$UZBL_URI" != "(null)" ] && echo "$UZBL_URI" >> "$UZBL_SESSION_FILE" - echo exit > "$UZBL_FIFO" + echo "exit" > "$UZBL_FIFO" ;; - "endsession" ) - for fifo in "$UZBL_FIFO_DIR"/uzbl_fifo_*; do + "endsession") + for fifo in "$UZBL_FIFO_DIR/uzbl_fifo_*"; do if [ "$fifo" != "$UZBL_FIFO" ]; then echo "spawn $scriptfile endinstance" > "$fifo" fi @@ -68,7 +70,7 @@ case $act in [ -z "$UZBL_FIFO" ] || echo "spawn $scriptfile endinstance" > "$UZBL_FIFO" ;; - * ) + *) echo "session manager: bad action" echo "Usage: $scriptfile [COMMAND] where commands are:" echo " launch - Restore a saved session or start a new one" diff --git a/examples/data/scripts/util/dmenu.sh b/examples/data/scripts/util/dmenu.sh index 354d7d1..0b7272e 100644 --- a/examples/data/scripts/util/dmenu.sh +++ b/examples/data/scripts/util/dmenu.sh @@ -30,6 +30,13 @@ case "$DMENU_SCHEME" in SB="#ccffaa" SF="#303030" ;; + # Temps + "temps" ) + NB="#303030" + NF="khaki" + SB="#ccffaa" + SF="#303030" + ;; # Default * ) NB="#303030" @@ -98,7 +105,7 @@ if dmenu --help 2>&1 | grep -q '\[-l <\?lines>\?\]'; then fi # Detect placement patch -if dmenu --help 2>&1 | grep -q '\[-x <xoffset>\]'; then +if dmenu --help 2>&1 | grep -q '\[-x <\?xoffset>\?\]'; then DMENU_PLACE_X="-x" DMENU_PLACE_Y="-y" DMENU_PLACE_WIDTH="-w" diff --git a/examples/data/scripts/util/uzbl-dir.sh b/examples/data/scripts/util/uzbl-dir.sh index bb56954..82510d8 100644 --- a/examples/data/scripts/util/uzbl-dir.sh +++ b/examples/data/scripts/util/uzbl-dir.sh @@ -2,18 +2,19 @@ # Common directories and files used in scripts # Common things first -UZBL_DATA_DIR=${XDG_DATA_HOME:-$HOME/.local/share}/uzbl -UZBL_CONFIG_DIR=${XDG_CONFIG_DIR:-$HOME/.config}/uzbl +UZBL_DATA_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/uzbl" +UZBL_CONFIG_DIR="${XDG_CONFIG_DIR:-$HOME/.config}/uzbl" UZBL_FIFO_DIR=/tmp UZBL_SOCKET_DIR=/tmp # Directories -UZBL_DOWNLOAD_DIR=${XDG_DOWNLOAD_DIR:-$HOME} -UZBL_FORMS_DIR=$UZBL_DATA_DIR/dforms +UZBL_DOWNLOAD_DIR="${XDG_DOWNLOAD_DIR:-$HOME}" +UZBL_FORMS_DIR="$UZBL_DATA_DIR/dforms" # Data files -UZBL_CONFIG_FILE=$UZBL_CONFIG_DIR/config -UZBL_COOKIE_FILE=$UZBL_DATA_DIR/cookies.txt -UZBL_BOOKMARKS_FILE=$UZBL_DATA_DIR/bookmarks -UZBL_HISTORY_FILE=$UZBL_DATA_DIR/history -UZBL_SESSION_FILE=$UZBL_DATA_DIR/browser-session +UZBL_CONFIG_FILE="$UZBL_CONFIG_DIR/config" +UZBL_COOKIE_FILE="$UZBL_DATA_DIR/cookies.txt" +UZBL_BOOKMARKS_FILE="$UZBL_DATA_DIR/bookmarks" +UZBL_TEMPS_FILE="$UZBL_DATA_DIR/temps" +UZBL_HISTORY_FILE="$UZBL_DATA_DIR/history" +UZBL_SESSION_FILE="$UZBL_DATA_DIR/browser-session" diff --git a/examples/data/scripts/util/uzbl-window.sh b/examples/data/scripts/util/uzbl-window.sh index a7e92eb..4b96372 100644 --- a/examples/data/scripts/util/uzbl-window.sh +++ b/examples/data/scripts/util/uzbl-window.sh @@ -1,11 +1,11 @@ #!/bin/sh # uzbl window detection -UZBL_WIN_POS=$(xwininfo -id $UZBL_XID | \ - sed -ne 's/Corners:[ ]*[+-]\([0-9]*\)[+-]\([0-9]*\).*$/\1 \2/p') -UZBL_WIN_SIZE=$(xwininfo -id $UZBL_XID | \ - sed -ne 's/-geometry[ ]*\([0-9]*\)x\([0-9]*\).*$/\1 \2/p') -UZBL_WIN_POS_X=$(echo $UZBL_WIN_POS | cut -d\ -f1) -UZBL_WIN_POS_Y=$(echo $UZBL_WIN_POS | cut -d\ -f2) -UZBL_WIN_WIDTH=$(echo $UZBL_WIN_SIZE | cut -d\ -f1) -UZBL_WIN_HEIGHT=$(echo $UZBL_WIN_SIZE | cut -d\ -f2) +UZBL_WIN_POS="$( xwininfo -id "$UZBL_XID" | \ + sed -n -e '[ ]*s/Corners:[ ]*[+-]\([0-9]*\)[+-]\([0-9]*\).*$/\1 \2/p' )" +UZBL_WIN_SIZE="$( xwininfo -id "$UZBL_XID" | \ + sed -n -e '[ ]*s/-geometry[ ]*\([0-9]*\)x\([0-9]*\).*$/\1 \2/p' )" +UZBL_WIN_POS_X="$( echo "$UZBL_WIN_POS" | cut -d ' ' -f 1 )" +UZBL_WIN_POS_Y="$( echo "$UZBL_WIN_POS" | cut -d ' ' -f 2 )" +UZBL_WIN_WIDTH="$( echo "$UZBL_WIN_SIZE" | cut -d ' ' -f 1 )" +UZBL_WIN_HEIGHT="$( echo "$UZBL_WIN_SIZE" | cut -d ' ' -f 2 )" diff --git a/examples/data/style.css b/examples/data/style.css deleted file mode 100644 index f9b111e..0000000 --- a/examples/data/style.css +++ /dev/null @@ -1,25 +0,0 @@ -.uzbl_highlight { background-color: yellow;} -.uzbl_h_first { background-color: lightgreen;} - -.uzbl_follow { border-style: dotted; - border-width: thin; -} - -#uzbl_hint > div { - display: inline; - border: 2px solid #4a6600; - background-color: #b9ff00; - color: black; - font-size: 9px; - font-weight: bold; - line-height: 9px; - margin: 0px; - padding: 0px; - position: absolute; - z-index: 1000; - -webkit-border-radius: 6px; - text-decoration: none; - -wekit-transform: scale(1) rotate(0deg) translate(-6px,-5px); -} - -/* vim:set et ts=4: */ diff --git a/misc/cleanprocs-files.sh b/misc/cleanprocs-files.sh deleted file mode 100755 index 463d1fb..0000000 --- a/misc/cleanprocs-files.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -killall uzbl; killall strace; -killall -9 uzbl; killall -9 strace - -rm -rf /tmp/uzbl_* - -echo "Uzbl processes:" -ps aux | grep uzbl | grep -v grep -echo "Uzbl /tmp entries:" -ls -alh /tmp/uzbl* 2>/dev/null diff --git a/misc/env.sh b/misc/env.sh index 68377f2..f815c44 100755 --- a/misc/env.sh +++ b/misc/env.sh @@ -10,14 +10,21 @@ # Maybe we should spawn processes from here with an 'exec' at the end? # Re-define our home location inside the sandbox dir. -export HOME=$(pwd)/sandbox/home +HOME=$(pwd)/sandbox/home +export HOME # Export default XDG_{DATA,CACHE,..}_HOME locations inside the sandbox # directory according to defaults in the xdg specification. # <http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html> -export XDG_DATA_HOME=$HOME/.local/share -export XDG_CACHE_HOME=$HOME/.cache -export XDG_CONFIG_HOME=$HOME/.config +XDG_DATA_HOME=$HOME/.local/share +export XDG_DATA_HOME + +XDG_CACHE_HOME=$HOME/.cache +export XDG_CACHE_HOME + +XDG_CONFIG_HOME=$HOME/.config +export XDG_CONFIG_HOME # Needed to run uzbl-browser etc from here. -export PATH="$(pwd)/sandbox/usr/local/bin:$PATH" +PATH="$(pwd)/sandbox/usr/local/bin:$PATH" +export PATH diff --git a/misc/fifotest.sh b/misc/fifotest.sh deleted file mode 100755 index 8ad0593..0000000 --- a/misc/fifotest.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -if [ -z "$1" ] -then - echo "Need fifo filename!" >&2 - exit 2 -fi -while : -do - echo 'uri dns.be' - echo 'uri dns.be' > $1 - sleep 2 - echo 'uri www.archlinux.org' - echo 'uri www.archlinux.org' > $1 - sleep 2 - echo 'uri icanhascheezburger.com' - echo 'uri icanhascheezburger.com' > $1 - sleep 2 - echo 'back' - echo 'back' > $1 -done diff --git a/src/callbacks.c b/src/callbacks.c index deda426..703107b 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -292,8 +292,11 @@ cmd_caret_browsing() { void set_current_encoding() { - webkit_web_view_set_custom_encoding(uzbl.gui.web_view, - uzbl.behave.current_encoding); + gchar *encoding = uzbl.behave.current_encoding; + if(strlen(encoding) == 0) + encoding = NULL; + + webkit_web_view_set_custom_encoding(uzbl.gui.web_view, encoding); } @@ -834,6 +837,11 @@ download_cb(WebKitWebView *web_view, WebKitDownload *download, gpointer user_dat /* get the URI being downloaded */ const gchar *uri = webkit_download_get_uri(download); + /* get the destination path, if specified. + * this is only intended to be set when this function is trigger by an + * explicit download using uzbl's 'download' action. */ + const gchar *destination = user_data; + if (uzbl.state.verbose) printf("Download requested -> %s\n", uri); @@ -880,6 +888,9 @@ download_cb(WebKitWebView *web_view, WebKitDownload *download, gpointer user_dat gchar *total_size_s = g_strdup_printf("%d", total_size); g_array_append_val(a, total_size_s); + if(destination) + g_array_append_val(a, destination); + GString *result = g_string_new (""); run_parsed_command(c, a, result); diff --git a/src/events.c b/src/events.c index 641409c..58dddfc 100644 --- a/src/events.c +++ b/src/events.c @@ -92,7 +92,7 @@ send_event_sockets(GPtrArray *sockets, GString *msg) { } } -static void +void replay_buffered_events() { guint i = 0; diff --git a/src/events.h b/src/events.h index 8e75097..bd519a6 100644 --- a/src/events.h +++ b/src/events.h @@ -33,10 +33,7 @@ void event_buffer_timeout(guint sec); void -send_event_socket(GString *msg); - -void -send_event_stdout(GString *msg); +replay_buffered_events(); void vsend_event(int type, const gchar *custom_event, va_list vargs); diff --git a/src/inspector.c b/src/inspector.c index de3dbcd..4c8c890 100644 --- a/src/inspector.c +++ b/src/inspector.c @@ -49,7 +49,7 @@ inspector_show_window_cb (WebKitWebInspector* inspector){ (void) inspector; gtk_widget_show(uzbl.gui.inspector_window); - send_event(WEBINSPECTOR, "open", NULL); + send_event(WEBINSPECTOR, NULL, TYPE_NAME, "open", NULL); return TRUE; } @@ -57,7 +57,7 @@ inspector_show_window_cb (WebKitWebInspector* inspector){ gboolean inspector_close_window_cb (WebKitWebInspector* inspector){ (void) inspector; - send_event(WEBINSPECTOR, "close", NULL); + send_event(WEBINSPECTOR, NULL, TYPE_NAME, "close", NULL); return TRUE; } @@ -61,7 +61,7 @@ attach_fifo(gchar *path) { if (g_io_add_watch(chan, G_IO_IN|G_IO_HUP, (GIOFunc) control_fifo, NULL)) { if (uzbl.state.verbose) printf ("attach_fifo: created successfully as %s\n", path); - send_event(FIFO_SET, path, NULL); + send_event(FIFO_SET, NULL, TYPE_STR, path, NULL); uzbl.comm.fifo_path = path; g_setenv("UZBL_FIFO", uzbl.comm.fifo_path, TRUE); return TRUE; @@ -216,8 +216,8 @@ init_connect_socket() { } /* replay buffered events */ - if(replay) - send_event_socket(NULL); + if(replay && uzbl.state.event_buffer) + replay_buffered_events(); } @@ -287,7 +287,7 @@ attach_socket(gchar *path, struct sockaddr_un *local) { if( (chan = g_io_channel_unix_new(sock)) ) { g_io_add_watch(chan, G_IO_IN|G_IO_HUP, (GIOFunc) control_socket, chan); uzbl.comm.socket_path = path; - send_event(SOCKET_SET, path, NULL); + send_event(SOCKET_SET, NULL, TYPE_STR, path, NULL); g_setenv("UZBL_SOCKET", uzbl.comm.socket_path, TRUE); return TRUE; } diff --git a/src/uzbl-core.c b/src/uzbl-core.c index d73fbdf..204c89c 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -551,7 +551,9 @@ CommandInfo cmdlist[] = { "include", include, TRUE }, { "show_inspector", show_inspector, 0 }, { "add_cookie", add_cookie, 0 }, - { "delete_cookie", delete_cookie, 0 } + { "delete_cookie", delete_cookie, 0 }, + { "clear_cookies", clear_cookies, 0 }, + { "download", download, 0 } }; void @@ -725,6 +727,42 @@ delete_cookie(WebKitWebView *page, GArray *argv, GString *result) { uzbl.net.soup_cookie_jar->in_manual_add = 0; } + +void +clear_cookies(WebKitWebView *page, GArray *argv, GString *result) { + (void) page; (void) argv; (void) result; + + // Replace the current cookie jar with a new empty jar + soup_session_remove_feature (uzbl.net.soup_session, + SOUP_SESSION_FEATURE (uzbl.net.soup_cookie_jar)); + g_object_unref (G_OBJECT (uzbl.net.soup_cookie_jar)); + uzbl.net.soup_cookie_jar = uzbl_cookie_jar_new (); + soup_session_add_feature(uzbl.net.soup_session, + SOUP_SESSION_FEATURE (uzbl.net.soup_cookie_jar)); +} + +void +download(WebKitWebView *web_view, GArray *argv, GString *result) { + (void) result; + + const gchar *uri = argv_idx(argv, 0); + const gchar *destination = NULL; + if(argv->len > 1) + destination = argv_idx(argv, 1); + + WebKitNetworkRequest *req = webkit_network_request_new(uri); + WebKitDownload *download = webkit_download_new(req); + + download_cb(web_view, download, destination); + + if(webkit_download_get_destination_uri(download)) + webkit_download_start(download); + else + g_object_unref(download); + + g_object_unref(req); +} + void act_dump_config() { dump_config(); @@ -1116,8 +1154,6 @@ spawn_sh_sync(WebKitWebView *web_view, GArray *argv, GString *result) { void run_parsed_command(const CommandInfo *c, GArray *a, GString *result) { - c->function(uzbl.gui.web_view, a, result); - /* send the COMMAND_EXECUTED event, except for set and event/request commands */ if(strcmp("set", c->key) && strcmp("event", c->key) && @@ -1128,12 +1164,18 @@ run_parsed_command(const CommandInfo *c, GArray *a, GString *result) { guint i = 0; while ((p = argv_idx(a, i++))) g_string_append_printf(param, " '%s'", p); + + /* might be destructive on array a */ + c->function(uzbl.gui.web_view, a, result); + send_event(COMMAND_EXECUTED, NULL, TYPE_NAME, c->key, TYPE_FORMATTEDSTR, param->str, NULL); g_string_free(param, TRUE); } + else + c->function(uzbl.gui.web_view, a, result); if(result) { g_free(uzbl.state.last_result); @@ -1478,6 +1520,10 @@ create_window() { gtk_widget_set_name (window, "Uzbl browser"); gtk_window_set_title(GTK_WINDOW(window), "Uzbl browser"); +#if GTK_CHECK_VERSION(3,0,0) + gtk_window_set_has_resize_grip (window, FALSE); +#endif + /* if the window has been made small, it shouldn't try to resize itself due * to a long statusbar. */ GdkGeometry hints; diff --git a/src/uzbl-core.h b/src/uzbl-core.h index 766fe56..be8fccd 100644 --- a/src/uzbl-core.h +++ b/src/uzbl-core.h @@ -303,9 +303,6 @@ void handle_authentication (SoupSession *session, SoupAuth *auth, gboolean retrying, gpointer user_data); -void handle_cookies (SoupSession *session, - SoupMessage *msg, - gpointer user_data); gboolean valid_name(const gchar* name); void set_var(WebKitWebView *page, GArray *argv, GString *result); void act_dump_config(); @@ -327,6 +324,8 @@ void include(WebKitWebView *page, GArray *argv, GString *result); void show_inspector(WebKitWebView *page, GArray *argv, GString *result); void add_cookie(WebKitWebView *page, GArray *argv, GString *result); void delete_cookie(WebKitWebView *page, GArray *argv, GString *result); +void clear_cookies(WebKitWebView *pag, GArray *argv, GString *result); +void download(WebKitWebView *pag, GArray *argv, GString *result); void builtins(); typedef void (*Command)(WebKitWebView*, GArray *argv, GString *result); |