User Tools

Site Tools


uzbl_tabbed

uzbl-tabbed (partially out of date)

This python application is a shell that is able to open & contain multiple uzbl instances in the one window using a gtk.Notebook widget essentially giving uzbl tabbing support. The parent application (uzbl_tabbed.py) uses a FIFO socket to receive commands from child uzbl instances to execute various functions in the parent application like creating a new tab, opening a tab from the clipboard, going to the next tab, closeing tab number 5, etc in the same way you normally control uzbl through its FIFO socket. There is nothing stopping you from sending commands to uzbl_tabbed.py's socket and performing those same actions yourself either manually or automatically.

Upon start-up the uzbl_tabbed.py script reads the users uzbl config file (found at $XDG_CONFIG_HOME/uzbl/config) for any commands it is able to inherit and or load that relate specifically to uzbl_tabbed.py. After spawning a uzbl instance the parent communicates to its new child uzbl instance through its socket the bind commands that (you are able to define/change either in the application itself or in your uzbl config file) give you the ability to control uzbl_tabbed.py as you would any other external script. Remembering that uzbl_tabbed.py doesn't listen or catch ANY keys pressed by the user but rather relies entirely from commands it binds to each child to navigate to the next tab, open new tabs, close tabs, etc. Enjoy!

Download

Stable

Configuration

Because this version of uzbl_tabbed is able to inherit options from your main uzbl configuration file you may wish to configure uzbl tabbed from there. Here is a list of configuration options that can be customised and some example values for each:

General tabbing options:

set show_tablist            = 1
set show_gtk_tabs           = 0
set tablist_top             = 1
set gtk_tab_pos             = (top|left|bottom|right)
set switch_to_new_tabs      = 1
set capture_new_windows     = 1

Tab title options:

set tab_titles              = 1
set new_tab_title           = Loading
set max_title_len           = 50
set show_ellipsis           = 1

Session options:

set save_session            = 1
set json_session            = 0
set session_file            = $HOME/.local/share/uzbl/session

Inherited uzbl options:

set fifo_dir                = /tmp
set socket_dir              = /tmp
set icon_path               = $HOME/.local/share/uzbl/uzbl.png
set status_background       = #303030

Window options:

set window_size             = 800,800

And uzbl_tabbed.py takes care of the actual binding of the commands via each instances fifo socket.

Custom tab styling:

set tab_colours             = foreground = "#888" background = "#303030"
set tab_text_colours        = foreground = "#bbb"
set selected_tab            = foreground = "#fff"
set selected_tab_text       = foreground = "green"
set tab_indicate_https      = 1
set https_colours           = foreground = "#888"
set https_text_colours      = foreground = "#9c8e2d"
set selected_https          = foreground = "#fff"
set selected_https_text     = foreground = "gold"

Recent versions of uzbl-browser come with uzbl-tabbed binds out of the box, you will find something like the following:

# --- Uzbl tabbed binds ---
# Tab opening
@cbind  gn              = event NEW_TAB
@cbind  go<uri:>_       = event NEW_TAB %s
@cbind  gY              = sh 'echo "event NEW_TAB `xclip -selection primary -o`" > $4'
# Closing / resting
@cbind  gC              = exit
@cbind  gQ              = event CLEAN_TABS
# Tab navigating
@cbind  g<              = event FIRST_TAB
@cbind  g>              = event LAST_TAB
@cbind  gt              = event NEXT_TAB
@cbind  gT              = event PREV_TAB
@cbind  gi<index:>_     = event GOTO_TAB %s
# Preset loading
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

Controlling uzbl_tabbed.py from its fifo socket

Commands can be sent to uzbl_tabbed.py in the same way that you would send commands to uzbl's fifo socket.

Here is an overview of the commands available currently ( [] = optional, {} = required ):

new [uri]
    open new tab and head to optional uri.

newfromclip
    open new tab and head to uri on clipboard

close [tab-num]
    close current tab or close via tab id.

next [n-tabs]
    open next tab or n tabs down. Supports negative indexing.

prev [n-tabs]
    open prev tab or n tabs down. Supports negative indexing.

goto {tab-n}
    goto tab n.

first
    goto first tab.

last
    goto last tab.

bring_to_front
    brings the uzbl_tabbed.py window to the front

And an example showing these commands in action:

echo 'new http://uzbl.org/' > /tmp/uzbltabbed_[socket-num]
echo 'last' > /tmp/uzbltabbed_[socket-num]

Command line options

Currently this is the only command line option supported:

uzbl_tabbed.py -n, --no-session    ignore session saving or loading.

All other command line arguments are interpreted as uris to launch in new tabs. If sessions are enabled they will load after the restored session tabs.

Example:

./uzbl_tabbed.py -n http://google.com/ http://uzbl.org/ http://reddit.com/

Will open 3 new tabs pointing to the locations specified and ignore session saving/loading.

./uzbl_tabbed.py http://uzbl.org/

Will open a single tab on-top of the loaded session tabs.

./uzbl_tabbed.py -n

Will open a single tab pointing to your homepage and all session saving/loading will be ignored.

Dependencies

Required

  • python 2.5-2.6 (May work on 2.4 but un-tested on that version)
  • pygtk >= 2.0

Optional

  • xclip - required if you wish to use the open new tab from clipboard command.
  • simplejson - required if you chose to enable JSON session saving/loading.

Launch Script

This is a quick script that can be used to launch uzbl_tabbed.py when the user clickes on urls outside uzbl. It will launch a new tab with the url if uzbl_tabbed.py is already running, or launch a new uzbl_tabbed.py if one is not.

#!/bin/bash

# Find a random uzbl_tabbed.py open.
UZBLT=$(find /tmp -user $UID -name 'uzbltabbed*' -print | sort | tail -1)
if [ -p $UZBLT ]; then
    echo "new $1" > $UZBLT
    echo "bring_to_front" > $UZBLT
else
    exec uzbl-tabbed $@
fi
uzbl_tabbed.txt · Last modified: 2012/07/23 23:57 (external edit)