Guest User

comhack

a guest
Nov 18th, 2009
373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.48 KB | None | 0 0
  1. # example uzbl config.
  2. # all settings are optional. you can use uzbl without any config at all (but it won't do much)
  3.  
  4. # === Shortcuts ==============================================================
  5.  
  6. # request BIND <keycmd> = <command>
  7. set bind = request BIND
  8. # request MODE_CONFIG <mode> <key> = <value
  9. set mode_config = request MODE_CONFIG
  10. # request TOGGLE_MODES <mode1> <mode2> ... <moden>
  11. set toggle_modes = request TOGGLE_MODES
  12. # request ON_EVENT <EVENT_NAME> <command>
  13. set on_event = request ON_EVENT
  14. # request PROGRESS_CONFIG <key> = <value>
  15. set progress = request PROGRESS_CONFIG
  16. # request MODMAP From To
  17. set modmap = request MODMAP
  18. set set_mode = set mode =
  19. set set_status = set status_message =
  20. set shell_cmd = sh -c
  21. set stylesheet_uri = file://$XDG_CONFIG_HOME/uzbl/lich.css
  22.  
  23. # Spawn path shortcuts. In spawn the first dir+path match is used in "dir1:dir2:dir3:executable"
  24. set scripts_dir = $XDG_DATA_HOME/uzbl:/usr/local/share/uzbl/examples/data/uzbl:scripts
  25. set config_dir = $XDG_CONFIG_HOME:/usr/local/share/uzbl/examples/config:uzbl
  26.  
  27. include @scripts_dir/modmap_keypad
  28. # === Handlers ===============================================================
  29.  
  30. #set download_handler = spawn @scripts_dir/download.sh
  31. set download_handler = spawn @scripts_dir/lich-download.sh
  32. set cookie_handler = talk_to_socket $XDG_CACHE_HOME/uzbl/cookie_daemon_socket
  33. set scheme_handler = sync_spawn @scripts_dir/scheme.py
  34. # New window handler options
  35. #set new_window = sh 'echo uri "$8" > $4' # open in same window
  36. set new_window = sh 'uzbl-browser -u $8' # equivalent to the default behaviour
  37.  
  38. # Load start handlers
  39. @on_event LOAD_START @set_status <span foreground="khaki">wait</span>
  40.  
  41. # Load commit handler
  42. @on_event LOAD_COMMIT @set_status <span foreground="green">recv</span>
  43.  
  44. # Load finish handlers
  45. @on_event LOAD_FINISH @set_status <span foreground="gold">done</span>
  46. @on_event LOAD_FINISH spawn @scripts_dir/history.sh
  47.  
  48. # Generate a FORM_ACTIVE event if an editable
  49. # element on the loaded site has initial focus
  50. @on_event LOAD_FINISH js if(document.activeElement.type == 'text') {Uzbl.run("event FORM_ACTIVE");}
  51.  
  52. # Switch to insert mode if a (editable) html form is clicked
  53. @on_event FORM_ACTIVE @set_mode insert
  54. # Switch to command mode if anything else is clicked
  55. @on_event ROOT_ACTIVE @set_mode command
  56.  
  57. # Misc on_event handlers
  58. #@on_event CONFIG_CHANGED print Config changed: %1 = %2
  59.  
  60.  
  61. # === Behaviour and appearance ===============================================
  62.  
  63. set show_status = 1
  64. set status_top = 0
  65. #set status_background = #303030
  66. set status_background = #000000
  67.  
  68. set modcmd_style = weight="bold" foreground="red"
  69. set keycmd_style = weight="light" foreground="red"
  70. set prompt_style = foreground="grey"
  71. set cursor_style = underline="single"
  72.  
  73. set mode_section = <span background="khaki" foreground="black">[\@[\@mode_indicator]\@]</span>
  74. set keycmd_section = [<span \@prompt_style>\@[\@keycmd_prompt]\@</span><span \@modcmd_style>\@modcmd</span><span \@keycmd_style>\@keycmd</span>]
  75. set progress_section = <span foreground="#606060">\@[\@progress_format]\@</span>
  76. set uri_section = <span foreground="#FFFF00">\@[\@uri]\@</span>
  77. set name_section = <span foreground="khaki">\@[\@NAME]\@</span>
  78. set status_section = <span foreground="orange">\@status_message</span>
  79. set selected_section = <span foreground="#606060">\@[\@SELECTED_URI]\@</span>
  80.  
  81. set status_format = <span font_family="Terminal">@mode_section @keycmd_section @progress_section @uri_section @name_section @status_section @selected_section</span>
  82.  
  83. # Progress bar config
  84. @progress width = 8
  85. # %d = done, %p = pending %c = percent done, %i = int done, %s = spinner,
  86. # %t = percent pending, %o = int pending, %r = sprite scroll
  87. @progress format = [%d>%p]%c
  88. @progress done = =
  89. @progress pending =
  90.  
  91. # Or ride those spinnas'
  92. #@progress format = [%d%s%p]
  93. #@progress spinner = -\\|/
  94. #@progress done = -
  95. #@progress pending =
  96.  
  97.  
  98. # === Core settings ==========================================================
  99.  
  100. set useragent = Uzbl (Webkit @WEBKIT_MAJOR.@WEBKIT_MINOR.@WEBKIT_MICRO) (@(uname -o)@ @(uname -m)@ [@ARCH_UZBL]) (Commit @COMMIT)
  101. set fifo_dir = /tmp
  102. set socket_dir = /tmp
  103.  
  104.  
  105. # === Binding modmaps ========================================================
  106.  
  107. #modmap from to
  108. @modmap Control Ctrl
  109. @modmap ISO_Left_Tab Shift-Tab
  110. @modmap space Space
  111.  
  112.  
  113. # === Keyboard bindings ======================================================
  114.  
  115. # With this command you can enter in any command at runtime when prefixed with
  116. # a colon.
  117. @bind :_ = chain '%s'
  118. @bind gp = spawn $XDG_DATA_HOME/uzbl/scripts/google_clip.pl
  119. @bind j = scroll_vert 20
  120. @bind k = scroll_vert -20
  121. @bind h = scroll_horz -20
  122. @bind l = scroll_horz 20
  123. @bind << = scroll_begin
  124. @bind >> = scroll_end
  125. @bind b = back
  126. @bind m = forward
  127. @bind S = stop
  128. @bind r = reload
  129. @bind R = reload_ign_cache
  130. @bind + = zoom_in
  131. @bind - = zoom_out
  132. @bind T = toggle_zoom_type
  133. @bind 1 = sh "echo set zoom_level = 1.0 > $4"
  134. @bind 2 = sh "echo set zoom_level = 2.0 > $4"
  135. @bind t = toggle_status
  136. @bind /* = search %s
  137. @bind ?* = search_reverse %s
  138. #jump to next
  139. @bind n = search
  140. @bind N = search_reverse
  141. @bind gh = uri http://www.google.com/ig
  142. @bind gi = script @scripts_dir/go_input.js %s
  143. # shortcut to set variables
  144. @bind s _ = set %s
  145. @bind \wiki _ = uri http://wiki.archlinux.org/index.php/Special:Search?search=%s&go=Go
  146. @bind gg _ = uri http://www.google.com/search?q=%s
  147. # Enclose the executable in quotes if it has spaces. Any additional parameters you use will
  148. # appear AFTER the default parameters
  149. # use a script to insert bookmarks. or use the EM/keycmd technique a bit further down
  150. @bind B = spawn @scripts_dir/insert_bookmark.sh
  151. @bind U = spawn @scripts_dir/load_url_from_history.sh
  152. @bind u = spawn @scripts_dir/load_url_from_bookmarks.sh
  153. # with the sample yank script, you can yank one of the arguments into clipboard/selection
  154. @bind yurl = spawn @scripts_dir/yank.sh 6 primary
  155. @bind ytitle = spawn @scripts_dir/yank.sh 7 clipboard
  156. # does the same as yurl but without needing a script
  157. @bind y2url = sh 'echo -n $6 | xclip'
  158. # go the page from primary selection
  159. @bind p = sh 'echo "uri `xclip -selection primary -o`" > $4'
  160. # go to the page in clipboard
  161. @bind P = sh 'echo "uri `xclip -selection clipboard -o`" > $4'
  162. # start a new uzbl instance from the page in primary selection
  163. @bind 'p = sh 'exec uzbl --uri $(xclip -o)'
  164. @bind ZZ = exit
  165. @bind Xs = js alert("hi");
  166. # example showing how to use sh
  167. # it sends a command to the fifo, whose path is told via a positional param
  168. # if fifo_dir is not set, it'll echo to a file named (null) somewhere >:) remember to delete it
  169. # The body of the shell command should be one parameter, so if it has spaces like here,
  170. # you must enclose it in quotes. Remember to escape (and double-escape) quotes and backslashes
  171. # in the body. Any additional parameters you use will appear AFTER the default parameters (cfg file
  172. # path, fifo & socket dirs, etc.)
  173. @bind XS = sh 'echo "js alert (\\"This is sent by the shell via a fifo\\")" > "$4"'
  174.  
  175. @bind !dump = sh "echo dump_config > $4"
  176. @bind !reload = sh "sed '/^# === Post-load misc commands/,$d' $1 > $4"
  177.  
  178. # this script allows you to configure (per domain) values to fill in form fields (eg login information) and to fill in these values automatically
  179. set formfiller = spawn @scripts_dir/formfiller
  180. @bind za = @{formfiller}.sh
  181. @bind ze = @{formfiller}.sh edit
  182. @bind zn = @{formfiller}.sh new
  183. @bind zl = @{formfiller}.sh load
  184.  
  185. # Or the more advanced implementation using perl: (could not get this to run - Dieter)
  186. @bind LL = @{formfiller}.pl load
  187. @bind LN = @{formfiller}.pl new
  188. @bind LE = @{formfiller}.pl edit
  189.  
  190. # we ship some javascripts to do keyboard based link hinting/following. (webkit does not have C DOM bindings yet)
  191. # this is similar to how it works in vimperator (and konqueror)
  192. # TODO: did we resolve: "no click() event for hyperlinks so no referrer set" ?
  193. #hit F to toggle the Hints (now in form of link numbering)
  194. @bind F = script @scripts_dir/hint.js
  195. # the most stable version:
  196. @bind fl* = script @scripts_dir/follow_Numbers.js %s
  197. # using strings, not polished yet:
  198. @bind fL* = script @scripts_dir/follow_Numbers_Strings.js %s
  199.  
  200.  
  201. # Examples using multi-stage-bindings with text prompts.
  202. @bind o<uri:>_ = uri %s
  203. @bind O<uri:\@uri>_ = uri %s
  204.  
  205. # multi-stage binding way to write bookmarks to file from inside uzbl.
  206. @bind <Ctrl>b<tags:>_ = sh 'echo -e "$6 %s" >> $XDG_DATA_HOME/uzbl/bookmarks'
  207.  
  208. # Multi-stage bindings with blank prompts (similar behaviour to emacs M-c M-s bindings?)
  209. @bind <Ctrl>a<:><Ctrl>q = exit
  210. @bind <Ctrl>a<:><Ctrl>h = uri http://uzbl.org/
  211.  
  212. # Inject handy values into the keycmd.
  213. @bind <Ctrl>su = event INJECT_KEYCMD \@uri
  214. @bind <Ctrl>st = event INJECT_KEYCMD \@TITLE
  215. # Or append.
  216. @bind <Ctrl>du = event APPEND_KEYCMD \@uri
  217. @bind <Ctrl>dt = event APPEND_KEYCMD \@TITLE
  218.  
  219.  
  220. # === command editing configuration ==========================================
  221.  
  222. # you'll want this at the very least
  223. @bind <Return> = event KEYCMD_EXEC_CURRENT
  224. @bind <Escape> = @set_mode
  225.  
  226. # basic searching
  227. @bind <Home> = event SET_CURSOR_POS 0
  228. @bind <End> = event SET_CURSOR_POS -1
  229. @bind <Left> = event SET_CURSOR_POS -
  230. @bind <Right> = event SET_CURSOR_POS +
  231. @bind <BackSpace> = event KEYCMD_BACKSPACE
  232. @bind <Delete> = event KEYCMD_DELETE
  233.  
  234. # readline-ish bindings
  235. @bind <Ctrl>w = event KEYCMD_STRIP_WORD
  236. @bind <Ctrl>u = event SET_KEYCMD
  237. @bind <Ctrl>a = event SET_CURSOR_POS 0
  238. @bind <Ctrl>e = event SET_CURSOR_POS -1
  239.  
  240.  
  241. # === Context menu items =====================================================
  242.  
  243. # Default context menu
  244. menu_add Google = set uri = http://google.com
  245. menu_add Go Home = set uri =http://google.com/ig
  246. menu_separator separator_1
  247. menu_add Quit uzbl = exit
  248.  
  249. # Link context menu
  250. menu_link_add Print Link = print \@SELECTED_URI
  251.  
  252.  
  253. # === Mode configuration =====================================================
  254.  
  255. # Define some mode specific uzbl configurations.
  256. set command = @mode_config command
  257. set insert = @mode_config insert
  258. set stack = @mode_config stack
  259.  
  260. # Command mode config.
  261. @command keycmd_style = foreground="red"
  262. @command status_background = #202020
  263. @command mode_indicator = Cmd
  264.  
  265. # Insert mode config.
  266. @insert status_background = #303030
  267. @insert mode_indicator = Ins
  268.  
  269. # Multi-stage-binding mode config.
  270. @stack keycmd_events = 1
  271. @stack modcmd_updates = 1
  272. @stack keycmd_style = foreground="red"
  273. @stack prompt_style = foreground="#888" weight="light"
  274. @stack status_background = #202020
  275. @stack mode_indicator = Bnd
  276.  
  277. set default_mode = command
  278.  
  279. # Mode bindings:
  280. # Changing mode method via set.
  281. @bind I = @set_mode insert
  282.  
  283. # Or toggle between modes by rasing request events.
  284. set toggle_cmd_ins = @toggle_modes command insert
  285.  
  286. @bind i = @toggle_cmd_ins
  287. @bind <Ctrl><i> = @toggle_cmd_ins
  288.  
  289.  
  290. # === Post-load misc commands ===============================================
  291.  
  292. # Set the "home" page.
  293. set uri = http://www.google.com/ig
  294.  
Advertisement
Add Comment
Please, Sign In to add comment