aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/config/uzbl/config
blob: 1ca17706f50b993c602e155112ab701ac53ec697 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# example uzbl config.
# all settings are optional.  you can use uzbl without any config at all (but it won't do much)

# === Shortcuts ==============================================================

# request BIND <keycmd> = <command>
set bind           = request BIND
# request MODE_CONFIG <mode> <key> = <value
set mode_config    = request MODE_CONFIG
# request TOGGLE_MODES <mode1> <mode2> ... <moden>
set toggle_modes   = request TOGGLE_MODES
# request ON_EVENT <EVENT_NAME> <command>
set on_event       = request ON_EVENT
# request PROGRESS_CONFIG <key> = <value>
set progress       = request PROGRESS_CONFIG

set set_mode       = set mode =
set set_status     = set status_message =
set shell_cmd      = sh -c

# Spawn path shortcuts. In spawn the first dir+path match is used in "dir1:dir2:dir3:executable"
set scripts_dir    = $XDG_DATA_HOME/uzbl:/usr/local/share/uzbl/examples/data/uzbl:scripts


# === Handlers ===============================================================

set download_handler   = spawn @scripts_dir/download.sh
set cookie_handler     = talk_to_socket $XDG_CACHE_HOME/uzbl/cookie_daemon_socket
set scheme_handler     = spawn @scripts_dir/scheme.py

# New window handler options
#set new_window        = sh 'echo uri "$8" > $4' # open in same window
set new_window         = sh 'uzbl-browser -u $8' # equivalent to the default behaviour

# Load start handler
@on_event   LOAD_START     @set_status <span foreground="khaki">wait</span>

# Load commit handler
@on_event   LOAD_COMMIT    @set_status <span foreground="green">recv</span>

# Load finish handlers
@on_event   LOAD_FINISH    @set_status <span foreground="gold">done</span>
@on_event   LOAD_FINISH    spawn @scripts_dir/history.sh

# Generate a FORM_ACTIVE event if a text element on the loaded site
# has initial focus unfortunatelly this only works for text elements,
# yet due to webkit limitations
@on_event   LOAD_FINISH    js if(document.activeElement.type == 'text') {Uzbl.run("event FORM_ACTIVE");}

# Switch to insert mode if a (editable) html form is clicked
@on_event   FORM_ACTIVE    @set_mode insert
# Switch to command mode if anything else is clicked
@on_event   ROOT_ACTIVE    @set_mode command

# Misc on_event handlers
#@on_event  CONFIG_CHANGED print Config changed: %1 = %2


# === Behaviour and appearance ===============================================

set show_status       = 1
set status_top        = 0
set status_background = #303030

set keycmd_style      = weight="bold" foreground="red"
set prompt_style      = foreground="grey"
set cursor_style      = underline="single"

set mode_section      = <span background="khaki" foreground="black">[\@[\@mode_indicator]\@]</span>
set keycmd_section    = [<span \@prompt_style>\@[\@keycmd_prompt]\@</span><span \@keycmd_style>\@keycmd</span>]
set progress_section  = <span foreground="#606060">\@[\@progress_format]\@</span>
set uri_section       = <span foreground="#99FF66">\@[\@uri]\@</span>
set name_section      = <span foreground="khaki">\@[\@NAME]\@</span>
set status_section    = <span foreground="orange">\@status_message</span>
set selected_section  = <span foreground="#606060">\@[\@SELECTED_URI]\@</span>

set status_format     = <span font_family="monospace">@mode_section @keycmd_section @progress_section @uri_section @name_section @status_section @selected_section</span>

# Progress bar config
@progress width    = 8
# %d = done, %p = pending %c = percent done, %i = int done, %s = spinner,
# %t = percent pending, %o = int pending, %r = sprite scroll
@progress format   = [%d>%p]%c
@progress done     = =
@progress pending  =

# Or ride those spinnas'
#@progress format   = [%d%s%p]
#@progress spinner  = -\\|/
#@progress done     = -
#@progress pending  =


# === Core settings ==========================================================

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


# === Keyboard bindings ======================================================

# With this command you can enter in any command at runtime when prefixed with
# a colon.
@bind    :_        = chain '%s'

@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
@bind    /*        = search %s
@bind    ?*        = search_reverse %s
#jump to next
@bind    n         = search
@bind    N         = search_reverse
@bind    gh        = uri http://www.uzbl.org
# 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
# Enclose the executable in quotes if it has spaces.  Any additional parameters you use will
# appear AFTER the default parameters
#@bind    B         = spawn @scripts_dir/insert_bookmark.sh
@bind    U         = spawn @scripts_dir/load_url_from_history.sh
@bind    u         = spawn @scripts_dir/load_url_from_bookmarks.sh
# with the sample yank script, you can yank one of the arguments into clipboard/selection
@bind    yurl      = spawn @scripts_dir/yank.sh 6 primary
@bind    ytitle    = spawn @scripts_dir/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
set formfiller = spawn @scripts_dir/formfiller
@bind    za        = @{formfiller}.sh
@bind    ze        = @{formfiller}.sh edit
@bind    zn        = @{formfiller}.sh new
@bind    zl        = @{formfiller}.sh load

# Or the more advanced implementation using perl: (could not get this to run - Dieter)
@bind    LL        = @{formfiller}.pl load
@bind    LN        = @{formfiller}.pl new
@bind    LE        = @{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 @scripts_dir/hint.js
# the most stable version:
@bind    fl*       = script @scripts_dir/follow_Numbers.js %s
# using strings, not polished yet:
@bind    fL*       = script @scripts_dir/follow_Numbers_Strings.js %s


# Examples using multi-stage-bindings with text prompts.
@bind o<uri:>_ = uri %s

# Prints tab separated "uri title keyword tags" to the bookmarks file.
# TODO: Improve bookmarks script to handle this format & include date in bookmark format.
@bind <Ctrl>b<name:>_<tags:>_ = sh 'echo -e "$6	$7	%s	%s" >> $XDG_DATA_HOME/uzbl/bookmarks'

# Multi-stage bindings with blank prompts (similar behaviour to emacs M-c M-s bindings?)
@bind <Ctrl>a<:>q = exit
@bind <Ctrl>a<:>h = uri http://uzbl.org/


# === Context menu items =====================================================

# Default context menu
menu_add Google = set uri = http://google.com
menu_add Go Home = set uri = http://uzbl.org
menu_separator separator_1
menu_add Quit uzbl = exit

# Link context menu
menu_link_add Print Link = print \@SELECTED_URI


# === Mode configuration =====================================================

# Define some mode specific uzbl configurations.
set command  = @mode_config command
set insert   = @mode_config insert
set stack    = @mode_config stack

# Command mode config.
@command  keycmd_style        = weight="bold" foreground="red"
@command  status_background   = #202020
@command  mode_indicator      = Cmd

# Insert mode config.
@insert   status_background   = #303030
@insert   mode_indicator      = Ins

# Multi-stage-binding mode config.
@stack    keycmd_events       = 1
@stack    modcmd_updates      = 1
@stack    keycmd_style        = foreground="red"
@stack    prompt_style        = foreground="#888" weight="light"
@stack    status_background   = #202020
@stack    mode_indicator      = Bnd

set default_mode = command

# Mode bindings:
# Changing mode method via set.
@bind I = @set_mode insert

# Or toggle between modes by rasing request events.
set toggle_cmd_ins = @toggle_modes command insert

@bind i        = @toggle_cmd_ins
@bind <Ctrl>i  = @toggle_cmd_ins


# === Post-load misc commands  ===============================================

# Set the "home" page.
set uri = uzbl.org