« uzbl » le vi des navigateurs Web

closeCet article a été publié il y a 2 ans 7 mois 24 jours, il est donc possible qu’il ne soit plus à jour. Les informations proposées sont donc peut-être expirées.

Je viens de découvrir un navigateur web qui devrait ravir les fans de vi.

En effet uzbl (prononcer « usable ») est fidèle à la philosophie « Unix », un programme réalise une seule tâche (mais bien :o )

C’est pourquoi plutôt que de laisser le navigateur tout prendre en charge, on utilise des scripts. On peut ainsi gérer ses marques pages, l’historique, la gestion des cookies et les téléchargements à sa convenance.

Pour le rendu des pages il s’appuie sur le moteur de rendu « Webkit ».

Un des avantages d’uzbl est donc qu’il est ultra léger et très rapide.

Pour l’installer vous avez le choix entre le compiler depuis les source ou si vous utilisez ubuntu un dépôt PPA existe, il suffit de l’ajouter à son fichier source.list

sudo vi /etc/apt/source.list

Ajouter les dépôts suivant

# UZBL
deb http://ppa.launchpad.net/pplr/uzbl/ubuntu jaunty main 
deb-src http://ppa.launchpad.net/pplr/uzbl/ubuntu jaunty main
 
# PPA for WebKit Team  
deb http://ppa.launchpad.net/webkit-team/ppa/ubuntu jaunty main 
deb-src http://ppa.launchpad.net/webkit-team/ppa/ubuntu jaunty main

Mettre à jour la liste des dépôts et installez uzbl

sudo aptitude update
sudo aptitude install uzbl

Maintenant vous pouvez tester l’installation

uzbl --uri uzbl.org

Voici ce que ça donne

uzbl

Pour qu’il soit utilisable nous allons maintenant configurer uzbl en utilisant les fichiers de configuration fournis en exemple

mkdir ~/.uzbl/
sudo cp -r /usr/share/uzbl/examples/* ~/.uzbl/

Donnez les bon droits aux fichiers fraichement copiés (remplacer « username » par votre log)

sudo chown "username":users ~/.uzbl/

Modifiez le fichier de configuration en renseignant le chemin vers l’icône du programme (rechercher la ligne « set icon »)

Voici le contenu de mon fichier config

cat ~/.uzbl/config/uzbl/config
# example uzbl config.
# all settings are optional.  you can use uzbl without any config at all (but it won't do much)
 
# keyboard behavior is vimstyle by default, but you can change this
# set always_insert_mode to always be in insert mode and disable going out of it.
# if you do this, make sure you've set a modkey so you can reach the commands
# from insert mode by combining them with the modkey
 
# Usually you want to spawn a script to handle things, but any command (such as sh) can be used
set history_handler  = spawn $XDG_DATA_HOME/uzbl/scripts/history.sh
set download_handler = spawn $XDG_DATA_HOME/uzbl/scripts/download.sh
set cookie_handler   = spawn $XDG_DATA_HOME/uzbl/scripts/cookies.py
 
 
# You can bind whatever things (spawn <foo>, script <bar>,..) to some events TODO: make events system more generic
set load_start_handler = set status_message = <span foreground="khaki">wait</span>
set load_commit_handler = set status_message = <span foreground="green">recv</span>
set load_finish_handler = set status_message = <span foreground="gold">done</span>
 
 
set minimum_font_size = 6
set font_size = 11
## monospace_size defaults to font_size, but you can alter it independently
#set monospace_size = 10
 
## Display or supress images within html sites
#set autoload_images = 0
 
## Shrink images to window size
#set autoshrink_images = 0
 
## Spellchecker
set enable_spellcheck = 1
 
## Private browsing
#set enable_private = 0
 
## The URI of a stylesheet that is applied to every page
#set stylesheet_uri = http://www.user.com/mystylelesheet.css
 
## enable/disable JavaScript
#set disable_scripts = 1
 
## Whether text areas are resizable
#set resizeable_text_areas = 1
 
## The default encoding used to display text
#set default_encoding = iso-8859-1
 
## Whether background images should be printed
#set print_background = 0
 
## Enforce a resolution of 96 DPI. This is meant for compatibility with
## web pages which cope badly with different screen resolutions
#set enforce_96_dpi = 1
 
 
#
# use with bind ... = sh <shell-oneliner>
set shell_cmd         = sh -c
 
 
 
# Behaviour and appearance
set show_status       = 1
# you can optionally use this setting to override the background color of the statusbar from your GTK theme.
set status_background = #303030
set status_format     = <span font_family="monospace"><span background="khaki" foreground="black">[MODE]</span> [<span weight="bold" foreground="red">KEYCMD</span>] <span foreground="#606060"> LOAD_PROGRESSBAR </span><span foreground="#99FF66">URI</span> <span foreground="khaki">NAME</span> <span foreground="orange">MSG</span><span foreground="#606060">SELECTED_URI</span></span>
set status_top        = 0
# define how your titlebar should look like. (short = statusbar is also shown, long = show everything you must see if statusbar is off)
set title_format_short = TITLE - Uzbl browser <NAME>
set title_format_long = KEYCMD MODE TITLE - Uzbl browser <NAME> > SELECTED_URI
# set the characters to use for, and the width of the progress bar
set status_pbar_done  = *
set status_pbar_pending = -
set status_pbar_width = 12
set insert_indicator = I
set command_indicator = C
set modkey = Mod1
# reset to command mode when new page is loaded
set reset_command_mode = 1
# this var has precedence over reset_command_mode
set always_insert_mode = 0
 
# to start a local socks server, do : ssh -fND localhost:8118 localhost
#set  proxy_url       = http://127.0.0.1:8118
#values 0-3
#set  http_debug      = 0
#set  useragent       = uzbl (Webkit WEBKIT_MAJOR.WEBKIT_MINOR.WEBKIT_MICRO)
# Example user agent containing everything:
set  useragent       = Uzbl (Webkit WEBKIT_MAJOR.WEBKIT_MINOR.WEBKIT_MICRO) (SYSNAME NODENAME KERNREL KERNVER ARCH_SYSTEM [ARCH_UZBL]) (Commit COMMIT)
#set  max_conns	      = 0
#set  max_conns_host  = 0
 
set fifo_dir = /tmp
set socket_dir = /tmp
 
# Key bindings
bind    j         = scroll_vert 20
bind    k         = scroll_vert -20
bind    h         = scroll_horz -20
bind    l         = scroll_horz 20
bind    <<        = scroll_begin
bind    >>        = scroll_end
bind    b         = back
bind    m         = forward
bind    S         = stop
bind    r         = reload
bind    R         = reload_ign_cache
bind    +         = zoom_in
bind    -         = zoom_out
bind    T         = toggle_zoom_type
bind    1         = sh "echo set zoom_level = 1.0 > $4"
bind    2         = sh "echo set zoom_level = 2.0 > $4"
bind    t         = toggle_status
# Hilight matches. Notice the * after the slash - it makes the command incremental, i.e. gets called
# on every character you type.  You can do `bind /_ = search %s' if you want it less interactive.
bind    /*        = search %s
bind    ?*        = search_reverse %s
#jump to next
bind    n         = search
bind    N         = search_reverse
bind    gh        = uri http://www.uzbl.org
bind    gj        = uri http://bordel-de-nerd.net
 
# like this you can enter any command at runtime, interactively. prefixed by ':'
bind    :_        = chain '%s'
 
# shortcut to set the uri. TODO: i think we can abandon the uri command in favor of 'set uri = ..'
bind    o _       = uri %s
# shortcut to set variables
bind    s _       = set %s
bind    \wiki _   = uri http://wiki.archlinux.org/index.php/Special:Search?search=%s&go=Go
bind    gg _      = uri http://www.google.com/search?q=%s
bind    i         = toggle_insert_mode
# disable insert mode (1 to enable).  note that Esc works to disable, regardless of this setting
bind    I         = toggle_insert_mode 0
# Enclose the executable in quotes if it has spaces.  Any additional parameters you use will
# appear AFTER the default parameters
bind    B         = spawn $XDG_DATA_HOME/uzbl/scripts/insert_bookmark.sh
bind    U         = spawn $XDG_DATA_HOME/uzbl/scripts/load_url_from_history.sh
bind    u         = spawn $XDG_DATA_HOME/uzbl/scripts/load_url_from_bookmarks.sh
# with the sample yank script, you can yank one of the arguments into clipboard/selection
bind    yurl      = spawn $XDG_DATA_HOME/uzbl/scripts/yank.sh 6 primary
bind    ytitle    = spawn $XDG_DATA_HOME/uzbl/scripts/yank.sh 7 clipboard
# does the same as yurl but without needing a script
bind    y2url     = sh 'echo -n $6 | xclip'
# go the page from primary selection
bind    p         = sh 'echo "uri `xclip -selection primary -o`" > $4'
# go to the page in clipboard
bind    P         = sh 'echo "uri `xclip -selection clipboard -o`" > $4'
# start a new uzbl instance from the page in primary selection
bind    'p        = sh 'exec uzbl --uri $(xclip -o)'
bind    ZZ        = exit
bind    Xs         = js alert("hi");
# example showing how to use sh
# it sends a command to the fifo, whose path is told via a positional param
# if fifo_dir is not set, it'll echo to a file named (null) somewhere >:) remember to delete it
# The body of the shell command should be one parameter, so if it has spaces like here,
# you must enclose it in quotes.  Remember to escape (and double-escape) quotes and backslashes
# in the body.  Any additional parameters you use will appear AFTER the default parameters (cfg file
# path, fifo & socket dirs, etc.)
bind    XS        = sh 'echo "js alert (\\"This is sent by the shell via a fifo\\")" > "$4"'
 
bind    !dump     = sh "echo dump_config > $4"
bind    !reload   = sh 'cat $1 > $4'
 
# this script allows you to configure (per domain) values to fill in form fields (eg login information) and to fill in these values automatically
bind za = spawn $XDG_DATA_HOME/uzbl/scripts/formfiller.sh
bind ze = spawn $XDG_DATA_HOME/uzbl/scripts/formfiller.sh edit
bind zn = spawn $XDG_DATA_HOME/uzbl/scripts/formfiller.sh new
bind zl = spawn $XDG_DATA_HOME/uzbl/scripts/formfiller.sh load
 
# other - more advanced - implementation using perl: (could not get this to run - Dieter )
bind LL = spawn $XDG_DATA_HOME/uzbl/scripts/formfiller.pl load
bind LN = spawn $XDG_DATA_HOME/uzbl/scripts/formfiller.pl new
bind LE = spawn $XDG_DATA_HOME/uzbl/scripts/formfiller.pl edit
 
# we ship some javascripts to do keyboard based link hinting/following.  (webkit does not have C DOM bindings yet)
# this is similar to how it works in vimperator (and konqueror)
# TODO: did we resolve: "no click() event for hyperlinks so no referrer set" ?
#hit F to toggle the Hints (now in form of link numbering)
bind    F = script $XDG_DATA_HOME/uzbl/scripts/hint.js
# the most stable version:
bind    fl* = script $XDG_DATA_HOME/uzbl/scripts/follow_Numbers.js %s
# using strings, not polished yet:
bind    fL* = script $XDG_DATA_HOME/uzbl/scripts/follow_Numbers_Strings.js %s
 
# you can use this to disable all plugins
set disable_plugins = 0
 
set icon = /home/launay/.uzbl/data/uzbl/uzbl.png
 
# "home" page if you will
set uri = uzbl.org

Une fois la configuration effectuée uzbl est prêt à l’emploi et a légèrement changé de look.

Vous pouvez le lancer en renseignant les variables $XDG_DATA_HOME et $XDG_CONFIG_HOME directement dans la commande ou en les ajoutant à votre ~/.bashrc

XDG_DATA_HOME=~/.uzbl/data XDG_CONFIG_HOME=~/.uzbl/config uzbl --uri http://bordel-de-nerd.net

ou ajoutez ces deux lignes à votre ~/.bashrc et lancez uzbl plus simplement

export XDG_DATA_HOME=~/.uzbl/data
export XDG_CONFIG_HOME=~/.uzbl/config
uzbl --uri http://bordel-de-nerd.net

uzbl

Pour les commandes de base, elles sont extrèmement proche celles de vi par exemple :

- pour changer d’url : « o » [ESPACE] « http://bordel-de-nerd.net »
- pour insérer du texte dans un champ, après avoir cliqué sur le champ : « i » (passe en mode insertion)
- pour aller sur google : « gg » (c’est un raccourci qu’on peut tout a fait paramétrer ou même en créer d’autres à l’aide de bind dans le fichier de conf)
- utiliser les marques pages/historique avec U/u

Vous trouverez une liste complète des commandes dans le fichier de configuration.

Pour conclure je dirais que ce navigateur est vraiment intéressant à essayer, tout comme vi, soit on aime soit on déteste.
Si vous adorez cliquer partout ne perdez pas votre temps ce logiciel ne vous convient pas.

Trackback URL

, , ,

3 Comments on "« uzbl » le vi des navigateurs Web"

  1. Johngeek
    26/09/2009 at 11 h 05 min Permalink

    Salut!

    Sympa ce petit navigateur!

    Une petite question qui n’a rien à voir : quel programme utilises-tu pour tes screenshots?
    Est ce que tu connais shutter ? http://shutter-project.org/

  2. Jérôme
    26/09/2009 at 11 h 11 min Permalink

    Toutes les captures sont réalisées avec shutter (gnome) ou scrot (ligne de commande) dans ce billet j’utilise d’ailleurs le plugin perl « Polaroid » de shutter.

  3. Johngeek
    26/09/2009 at 14 h 45 min Permalink

    Je ne connaissais pas le plugin polaroid!

    Très sympa!

Hi Stranger, leave a comment:

ALLOWED XHTML TAGS:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

Subscribe to Comments
Get Adobe Flash playerPlugin by wpburn.com wordpress themes