Difference between revisions of "Dwb"

From ArchWiki
Jump to: navigation, search
m (Navigation: typo)
(Basic usage: simplified)
Line 15: Line 15:
 
== Basic usage ==
 
== Basic usage ==
  
Starting from a fresh configuration, use {{keypress|S}}{{keypress|k}} to open the ''Keys'' page. As you can see from there, most bindings are borrowed from Vim and Emacs.
+
Starting from a fresh configuration, use {{keypress|S}}{{keypress|k}} to open the ''Keys'' page. As you can see from there, most bindings are borrowed from [[Vim]] and [[Emacs]].
  
 
Use {{keypress|:}} to access the command prompt. You can use {{keypress|Tab}} to auto-complete.
 
Use {{keypress|:}} to access the command prompt. You can use {{keypress|Tab}} to auto-complete.
Line 27: Line 27:
 
  o        = enter url
 
  o        = enter url
 
  O        = enter url in new tab
 
  O        = enter url in new tab
  f        = spawn hints next to each hyperlink. Type the letter to follow the link.
+
  f        = spawn hints next to each hyperlink. You can use arrow keys to browse the hints while displaying their URI, or use the hint letters.
 
  F        = spawn hints in new tab
 
  F        = spawn hints in new tab
 +
;b      = spawn hints in new background tab
 +
;r      = follow multiple background links rapidly
 
  H        = back
 
  H        = back
 
  L        = forward
 
  L        = forward
Line 40: Line 42:
 
  R        = reload ignoring cache
 
  R        = reload ignoring cache
 
  i        = toggle_insert_mode  (Esc works to go back to command mode much like vim)
 
  i        = toggle_insert_mode  (Esc works to go back to command mode much like vim)
 +
Esc      = back to normal mode
 +
ctrl+n  = back to normal mode
 
  gi      = go to the first input field and enter insert mode
 
  gi      = go to the first input field and enter insert mode
  ctrl+e  = open editable field in external editor
+
  ctrl+e  = open editable field in external editor. Very helpful for forums and wikis.
 
  ;d      = download via hints
 
  ;d      = download via hints
  
Line 50: Line 54:
 
  h        = scroll left
 
  h        = scroll left
 
  l        = scroll right
 
  l        = scroll right
ctrl+b  = scroll page up
 
ctrl+f  = scroll page down
 
 
  gg      = go to top
 
  gg      = go to top
 
  G        = go to bottom
 
  G        = go to bottom
 
  /        = find in page
 
  /        = find in page
 
  n        = repeat find forward
 
  n        = repeat find forward
N        = repeat find backwards
 
 
  +        = zoom_in
 
  +        = zoom_in
 
  -        = zoom_out
 
  -        = zoom_out
 
  =        = reset to 100%
 
  =        = reset to 100%
 +
gf      = toglle source view
  
 
====Other====
 
====Other====
  
 
  M        = save bookmark (bookmarks are saved in ~/.config/dwb/default/bookmarks
 
  M        = save bookmark (bookmarks are saved in ~/.config/dwb/default/bookmarks
 +
:        = enter command
 
  xb      = show/hide status bar
 
  xb      = show/hide status bar
 
  ZZ      = exit
 
  ZZ      = exit
:        = enter command
 
Esc      = back to normal mode
 
ctrl+n  = back to normal mode
 
  
dwb features some interesting bindings:
+
====Notes====
*Links:
+
* Press {{keypress|v}} to switch to caret browsing, then press {{keypress|space}} to toggle between caret and visual mode. Press {{keypress|Esc}} one or two times to go back to normal mode. While in caret browsing, you can use the arrow keys to browse the different parts of the page. Hold {{keypress|Shift}} to select text. Press {{keypress|Enter}} to follow links.
** Use {{keypress|f}} to follow links via hints. You can use arrow keys to browse the hints while displaying their URI, or use the hint letters. Note that the letters are displayed uppercase for readability only, you actually have to press the lowercase letters. Use {{keypress|F}} to follow the link in a new tab, {{keypress|;}}{{keypress|b}} to open the tab in the background.
+
** You can follow multiple links via hints by opening tabs in the background with {{keypress|;}}{{keypress|r}}.
+
** Use {{keypress|;}}{{keypress|d}} to download via hints.
+
*Interface:
+
** {{keypress|x}}{{keypress|v}} toggles the visibility of the current tab, which means that if you switch tab, they will be displayed side by side! You can to this with more than 2 tabs as well.
+
** Press {{keypress|Ctrl+e}} on an editable element to edit it from favorite editor. The content will be replaced once you close it. This can be very helpful for forum and wikis.
+
** Press {{keypress|v}} to switch to caret browsing, then press {{keypress|space}} to toggle between caret and visual mode. Press {{keypress|Esc}} one or two times to go back to normal mode. While in caret browsing, you can use the arrow keys to browse the different parts of the page. Hold {{keypress|Shift}} to select text. Press {{keypress|Enter}} to follow links.
+
** Use {{keypress|g}}{{keypress|f}} to toggle source view.
+
** {{keypress|x}}{{keypress|x}} will toggle the tab bar and the status bar, {{keypress|F11}} will go fullscreen and {{keypress|F12}} will go fullscreen while hiding the bars.
+
  
 
== Configuration ==
 
== Configuration ==

Revision as of 18:38, 25 August 2013

Template:Article summary start Template:Article summary text Template:Article summary end

dwb is an extremely fast, lightweight and flexible web browser using the webkit engine. It is customizable through its web interface and fully usable with keyboard shortcuts.

Installation

The dwb package can be found in the official repositories and can be installed with pacman.

# pacman -S dwb

There are also other versions in the AUR: dwb-gitAUR, dwb-gtk3AUR, and dwb-gtk3-gitAUR.

Basic usage

Starting from a fresh configuration, use Template:KeypressTemplate:Keypress to open the Keys page. As you can see from there, most bindings are borrowed from Vim and Emacs.

Use Template:Keypress to access the command prompt. You can use Template:Keypress to auto-complete.

Read the man page for more details and enable the auto-completion option in the settings to help you learn the bindings.

$ man dwb

Navigation

o        = enter url
O        = enter url in new tab
f        = spawn hints next to each hyperlink. You can use arrow keys to browse the hints while displaying their URI, or use the hint letters.
F        = spawn hints in new tab
;b       = spawn hints in new background tab
;r       = follow multiple background links rapidly
H        = back
L        = forward
J        = go to next tab
K        = go to previous tab
'n'+T    = goto 'n' tab
d        = close tab
u        = undo close tab
ctrl+s   = stop
r        = reload
R        = reload ignoring cache
i        = toggle_insert_mode   (Esc works to go back to command mode much like vim)
Esc      = back to normal mode
ctrl+n   = back to normal mode
gi       = go to the first input field and enter insert mode
ctrl+e   = open editable field in external editor. Very helpful for forums and wikis.
;d       = download via hints

Page Movement

j        = scroll down
k        = scroll up
h        = scroll left
l        = scroll right
gg       = go to top
G        = go to bottom
/        = find in page
n        = repeat find forward
+        = zoom_in
-        = zoom_out
=        = reset to 100%
gf       = toglle source view

Other

M        = save bookmark (bookmarks are saved in ~/.config/dwb/default/bookmarks
:        = enter command
xb       = show/hide status bar
ZZ       = exit

Notes

Configuration

Almost everything can be configured from the Settings page. You can access it with Template:KeypressTemplate:Keypress by default.

The configuration files are stored in $XDG_CONFIG_HOME/dwb/ (usually ~/.config/dwb/).

Search engines

Use Template:KeypressTemplate:Keypress to create a search engine from the first input field on the web page. Use Template:Keypress to switch between fields. Then enter a keyword.

Now you can use the keyword in the URI prompt to search directly on the corresponding website.

The first entry in $XDG_CONFIG_HOME/dwb/searchengines will be the default search engine.

Custom keybinds

You can create custom key bindings by editing file custom_keys in the profile directory. This is ~/.config/dwb/default by default. All keysyms which don't emit (multi)byte characters, must be enclosed in @. One keybind can execute multiple dwb commands. These commands execute in same order as they are defined in bind, and must be separated by ;; separator. If the keybind's chord is already bound by dwb, it might be ignored (behaviour is not consistent). In such case one can try to check, whether there is collison with binds defined in ~/.config/dwb/keys and try to unbind the chord there (eg set it to nothing). Any running dwb instance will owerwrite keys file on exit, so remember to do your modifications while dwb is not runing or use default dwb interface (S k).

~/.config/dwb/default/custom_keys
Control w           :close_tab
Control @Page_Up@   :focus_prev
Control @Page_Down@ :focus_next


Extensions

dwb features an extension manager as a separate executable, dwbem. To list all officially available extensions, use:

dwbem -a
   Available extensions:
   - adblock_subscriptions
   - autoquvi
   - contenthandler
   - downloadhandler
   - formfiller
   - googlebookmarks
   - googledocs
   - grabscrolling
   - multimarks
   - perdomainsettings
   - pwdhash
   - requestpolicy
   - simplyread
   - speeddial
   - supergenpass
   - unique_tabs
   - userscripts
   - whitelistshortcuts

Read the man page for more details.

Adblock

dwb features an Adblock extension. Install it with

$ dwbem -i adblock_subscriptions

Restart dwb, use the adblock_subscribe command and choose your favorite filter (avoid using more than one filter to prevent duplicate entries that make the adblocker much slower).

Userscripts

dwb can execute .js or .sh scripts put in ~/.config/dwb/userscripts/. Make sure they are executable:

chmod +x ~/.config/dwb/userscripts/myscript.js

Below are some example scripts, see dwb userscripts snippets for more:

Fast-forward

Opera features a neat key binding which allows users to load to ne next/previous logical page by incrementing/decrementing the last URI digit. This is very useful for forum threads, documentation, and articles spread over several pages.

This feature can be implemented with a simple javascript function and bound to custom keys:

custom_keys
]:exja (function(){var e=document.querySelector("[rel='next']");if(e){location=e.href;}else{var f=document.getElementsByTagName("a");var i=f.length;while((e=f[--i])){if(e.text.search(/(\bnext\b|^>$|^(>>|»)$|^(>|»)|(>|»)$|\bmore\b)/i)>-1){location=e.href; break;}}}})();
[:exja (function(){var e=document.querySelector("[rel='prev']");if(e){location=e.href;}else{var f=document.getElementsByTagName("a");var i=f.length;while((e=f[--i])){if(e.text.search(/(\b(prev|previous)\b|^<$|^(<<|«)$|^(<|«)|(<|«)$)/i)>-1){location=e.href;break;}}}})();

Alternatively, the navtools extension provides the same functionality and more, such as going up one directory, or loading the root URI.

startup-noautoreload

Prevents previously-opened tabs from reloading all at once after a restart.

~/.config/dwb/userscripts/startup-noautoreload.js
//!javascript
// prevents previously-opened tabs from reloading all at once after a restart.
execute("set load-on-focus true");

var sigId = signals.connect("navigation", function(wv) {
        if (wv == tabs.current)
        {
                    execute("set load-on-focus false");
                            signals.disconnect(sigId);
                                }
});

youtube-mplayer

Opens YouTube videos with mplayer (requires mplayer and youtube-dl).

~/.config/dwb/userscripts/youtube-mplayer.js
//!javascript 
// opens YouTube videos with mplayer.
var regex = new RegExp("http(.*)://www.youtube.com/watch\\?(.*&)*v=.*");

signals.connect("navigation", function (wv, frame, request) {
  if (wv.mainFrame == frame && regex.test(request.uri)) 
    system.spawn("sh -c 'mplayer \"$(youtube-dl -g " + request.uri + ")\"'");
  return false;
});

Stylesheets

Stylesheets can be defined in the Settings page under user-stylesheet-uri file:///home/tux/.config/dwb/stylesheet.css

Troubleshooting

HTML5 audio and video does not work

Make sure you have the following GStreamer packages installed:

# pacman -S --needed gstreamer0.10 gstreamer0.10-bad gstreamer0.10-bad-plugins gstreamer0.10-base gstreamer0.10-base-plugins gstreamer0.10-good gstreamer0.10-good-plugins gstreamer0.10-ugly gstreamer0.10-ugly-plugins

Search engines always search for undefined

If you are always searching for undefined even with the searchengine-submit-pattern option set, then you should edit $XDG_CONFIG_HOME/dwb/searchengines and adapt the URIs to match your searchengine-submit-pattern.

Fuzzy font in Github

Add this in your ~/.config/fontconfig/fonts.conf inside the fontconfig-tags:

 <selectfont>
   <rejectfont>
     <pattern>
       <patelt name="family">
         <string>Clean</string>
       </patelt>
     </pattern>
   </rejectfont>
 </selectfont>