Difference between revisions of "Dwb"

From ArchWiki
Jump to: navigation, search
m (Basic usage: Better phrasing.)
(fast-forward: Improved fast-forward functions with ++/-- in URI (fallback))
(34 intermediate revisions by 9 users not shown)
Line 3: Line 3:
 
{{Article summary text|This article addresses the steps necessary to run and configure dwb.}}
 
{{Article summary text|This article addresses the steps necessary to run and configure dwb.}}
 
{{Article summary end}}
 
{{Article summary end}}
 +
[[de:dwb]]
 
[[tr:dwb]]
 
[[tr:dwb]]
 
{{DISPLAYTITLE:dwb}}
 
{{DISPLAYTITLE:dwb}}
Line 9: Line 10:
  
 
== Installation ==
 
== Installation ==
The {{Pkg|dwb}} package can be found in the [[Official Repositories|official repositories]] and can be installed with [[pacman]].
+
 
# pacman -S dwb
+
The {{Pkg|dwb}} package can be found in the [[official repositories]] and can be installed with [[pacman]]. There are also other versions in the [[AUR]]: {{AUR|dwb-git}}, {{AUR|dwb-gtk3}}, and {{AUR|dwb-gtk3-git}}.
There are also other versions in the [[AUR]]: {{AUR|dwb-git}}, {{AUR|dwb-gtk3}}, and {{AUR|dwb-gtk3-git}}.
+
  
 
== 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 {{ic|Sk}} 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 {{ic|:}} to access the command prompt. You can use {{ic|Tab}} to auto-complete.
  
Read the man page for more details.
+
Read the man page for more details and enable the {{ic|auto-completion}} option in the settings to help you learn the bindings.
  
 
  $ man dwb
 
  $ man dwb
  
dwb features some very interesting bindings. Note that some of them may need the latest development version.
+
=== dwb-specific ===
* {{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.
+
* 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.
+
* Use {{keypress|;}}{{keypress|d}} to download via hints.
+
* {{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.
+
* You can follow multiple links via hints by opening tabs in the background with {{keypress|;}}{{keypress|r}}.
+
  
== Configuration ==
+
o        = enter url
 +
O        = enter url in new tab
 +
f        = spawn hints. 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
 +
gi      = go to the first input field and enter insert mode
 +
ctrl+e  = open editable field in external editor. Useful for forums and wikis.
 +
;d      = download via hints
 +
M        = save bookmark (bookmarks are saved in ~/.config/dwb/default/bookmarks)
 +
xb      = show/hide status bar
 +
gf      = toggle source view
 +
+        = zoom_in
 +
-        = zoom_out
 +
=        = reset to 100%
  
Almost everything can be configured from the ''Settings'' page. You can access it with {{keypress|S}}{{keypress|s}} by default.
+
=== vim-like ===
  
The configuration files are stored in {{ic|$XDG_CONFIG_HOME/dwb/}} (usually {{ic| ~/.config/dwb/}}).
+
i        = toggle_insert_mode  (Esc works to go back to normal mode much like Vim)
 +
Esc      = back to normal mode (ctrl+n works too)
 +
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
 +
ZZ      = save session and exit
  
=== Search engines ===
+
=== Notes ===
  
Use {{keypress|g}}{{keypress|s}} to create a search engine from the first input field on the web page. Use {{keypress|Tab}} to switch between fields. Then enter a keyword.
+
Press {{ic|v}} to switch to caret browsing, then press {{ic|space}} to toggle between caret and visual mode. Press {{ic|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 {{ic|Shift}} to select text. Press {{ic|Enter}} to follow links.
  
Now you can use the keyword in the URI prompt to search directly on the corresponding website.
+
== Configuration ==
  
The first entry in {{ic|$XDG_CONFIG_HOME/dwb/searchengines}} will be the default search engine.
+
The configuration files are stored in {{ic|$XDG_CONFIG_HOME/dwb/}} (usually {{ic| ~/.config/dwb/}}) and can be easily accessed through the web interface. Type {{ic|Ss}}  to open the ''Settings'' page.
 +
 
 +
=== Search engines ===
 +
 
 +
Open your favorite search engine, type {{ic|gs}} to select the web page's first input field, and then enter a keyword associated with it.
 +
 
 +
Now you can use the keyword in the URI prompt to search directly on the corresponding website. Typing queries directly in the address bar will search with the default search engine, which is the first entry in {{ic|$XDG_CONFIG_HOME/dwb/searchengines}}.
  
 
=== Custom keybinds ===
 
=== Custom keybinds ===
  
 
You can create custom key bindings by editing file {{ic|custom_keys}} in the profile directory. This is
 
You can create custom key bindings by editing file {{ic|custom_keys}} in the profile directory. This is
{{ic|~/.config/dwb/default}} by default. All keysyms which don't emit (multi)byte characters, must be enclosed in {{ic|@}}. One keybind can execute multiple dwb commands. These commands execute in same order as they are defined in bind, and must be separated by {{ic|;;}} 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 {{ic|~/.config/dwb/keys}} and try to unbind the chord there (eg set it to nothing). Any running dwb instance will owerwrite {{ic|keys}} file on exit, so remember to do your modifications while dwb is not runing or use default dwb interface (''S k'').
+
{{ic|~/.config/dwb/default}} by default. All keysyms which don't emit (multi)byte characters, must be enclosed in {{ic|@}}. One keybind can execute multiple ''dwb'' commands. These commands execute in same order as they are defined in bind, and must be separated by {{ic|;;}} 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 {{ic|~/.config/dwb/keys}} and try to unbind the chord there (eg set it to nothing). Any running ''dwb'' instance will owerwrite {{ic|keys}} file on exit, so remember to do your modifications while ''dwb'' is not runing or use default ''dwb'' interface ({{ic|Sk}}).
  
 
{{hc|~/.config/dwb/default/custom_keys|<nowiki>
 
{{hc|~/.config/dwb/default/custom_keys|<nowiki>
Line 60: Line 92:
 
== Extensions ==
 
== Extensions ==
  
dwb features an extension manager as a separate executable, ''dwbem''. To list all officially available extensions, use:
+
''dwb'' features an extension manager as a separate executable, ''dwbem''. To list all officially available extensions, use:
  
$ dwbem -a
+
{{hc|dwbem -a|
 +
  Available extensions:      Mainstream equivalent:
 +
  - adblock_subscriptions    Adblock
 +
  - autoquvi                Video DownloadHelper
 +
  - contenthandler          (Handle requests based on MIME type, filename extension or URI scheme)
 +
  - downloadhandler          (Handle downloads based on mimetype or filename extension, useful if 'download-no-confirm' is set)
 +
  - formfiller              LastPass, Lazarus (Save form data and fill forms with previously saved data, also with gpg-support)
 +
  - googlebookmarks          GBookmarks, GMarks (Add bookmarks to google bookmarks with a shortcut)
 +
  - googledocs              Open with Google Docs, Google Docs Viewer
 +
  - grabscrolling            (Adobe Acrobat style grab and drag mouse scrolling)
 +
  - multimarks              (Bookmark multiple urls to a single quickmark)
 +
  - navtools                Opera Fast Forward, IE 10 Flip Ahead
 +
  - perdomainsettings        (Change webkit-settings automatically on domain or url basis)
 +
  - pwdhash                  PwdHash
 +
  - requestpolicy            RequestPolicy, Disconnect, Ghostery
 +
  - simplyread              Readability, Clearly
 +
  - speeddial                Speed Dial
 +
  - supergenpass            (Generate domain-based passwords; compatible with the bookmarklet supergenpass but with additional options)
 +
  - unique_tabs              (Remove duplicate tabs or avoid duplicate tabs by autoswitching to tabs with same url)
 +
  - userscripts              GreaseMonkey/Stylish
 +
  - whitelistshortcuts      (Whitelist webkit settings for certain domains with a shortcut)
 +
}}
  
Read the [[man page]] for more details.
+
For more details, use {{ic|dwbem -I <extension>}} and read the [http://portix.bitbucket.org/dwb/resources/dwb.1.html dwb] and [http://portix.bitbucket.org/dwb/resources/dwbem.1.html dwbem] man pages.
 +
 
 +
Below is a list of popular extensions (or add-ons) for which ''dwb'' has a built-in alternative:
 +
 
 +
* NoScript/Flashblock: ''dwb'' blocks flash by default and can block javascript.
 +
* Omnibar: just like Chrome, ''dwb'''s address gives quick access to search, history, and bookmarks.
 +
* Download Statusbar: ''dwb'''s displays downloads in a neat status bar by default.
 +
* IE Tab: ''dwb'' can open a page in any external browser with a simple userscript.
 +
* Session Manager: ''dwb'' uses its built-in session manager by default.
 +
* Private browsing: add {{ic|xpp:toggle enable-private-browsing}} to {{ic|custom_keys}} to toggle privacy mode by typing {{ic|xpp}}.
  
 
=== Adblock ===
 
=== Adblock ===
  
dwb features an Adblock extension. Install it with
+
''dwb'' features an Adblock extension. Install it with
  
 
  $ dwbem -i adblock_subscriptions
 
  $ dwbem -i adblock_subscriptions
  
Restart dwb, use the ''adblock_subscribe'' command and choose your favorite lists of filters.
+
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 ==
 
== Userscripts ==
dwb can execute .js or .sh scripts put in {{ic|~/.config/dwb/userscripts/}}. Make sure they are executable:
+
 
 +
''dwb'' can execute .js or .sh scripts put in {{ic|~/.config/dwb/userscripts/}}. Make sure they are executable:
 
  chmod +x ~/.config/dwb/userscripts/myscript.js
 
  chmod +x ~/.config/dwb/userscripts/myscript.js
  
Below are some example scripts:
+
Below are some example scripts, see ''dwb'' [http://portix.bitbucket.org/dwb/snippets/snippets.html userscripts snippets] for more:
===startup-noautoreload===
+
 
 +
=== defer-loading ===
 +
 
 +
Prevents tabs from last session to load all at once at startup.
 +
{{hc|~/.config/dwb/userscripts/defer-loading.js|<nowiki>
 +
//!javascript
 +
if (settings.loadOnFocus === false) {
 +
    execute('local_set load-on-focus true');
 +
}
 +
Signal.connect('navigation', function(webview) {
 +
    if (webview == tabs.current) {
 +
        execute('local_set load-on-focus false');
 +
        this.disconnect();
 +
    }
 +
});</nowiki>}}
 +
 
 +
=== fast-forward ===
 +
 
 +
Opera features a neat key binding which allows users to load to next/previous logical page. 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 {{ic|<nowiki>}</nowiki>}} and {{ic|{}}:
 +
 
 +
{{hc|~/.config/dwb/default/custom_keys|<nowiki>
 +
}: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;}} location.href=location.href.replace(/(\d+)([^\/\d]*)$/, function(a,b,c){return ++b+c})}})();
 +
{: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;}} location.href=location.href.replace(/(\d+)([^\/\d]*)$/, function(a,b,c){return --b+c})}})();
 +
</nowiki>}}
 +
 
 +
Alternatively, the {{ic|navtools}} extension provides the same functionality and more, such as going up one directory, or loading the root URI.
 +
 
 +
=== open-firefox ===
 +
Opens current page in Firefox with {{ic|xf}} (uses {{Pkg|firefox}} and {{Pkg|notify-send}}).
 +
{{hc|~/.config/dwb/userscripts/open-firefox.sh|<nowiki>
 +
#!/bin/bash
 +
# dwb: xf
 +
firefox $DWB_URI &
 +
notify-send -u low "Firefox opening $DWB_URI" #optional notification
 +
</nowiki>}}
 +
 
 +
=== startup-noautoreload ===
 +
 
 
Prevents previously-opened tabs from reloading all at once after a restart.
 
Prevents previously-opened tabs from reloading all at once after a restart.
 
{{hc|~/.config/dwb/userscripts/startup-noautoreload.js|<nowiki>
 
{{hc|~/.config/dwb/userscripts/startup-noautoreload.js|<nowiki>
Line 86: Line 188:
 
execute("set load-on-focus true");
 
execute("set load-on-focus true");
  
var sigId = signals.connect("navigation", function(wv) {
+
var sigId = Signal.connect("navigation", function(wv) {
 
         if (wv == tabs.current)
 
         if (wv == tabs.current)
 
         {
 
         {
 
                     execute("set load-on-focus false");
 
                     execute("set load-on-focus false");
                             signals.disconnect(sigId);
+
                             Signal.disconnect(sigId);
 
                                 }
 
                                 }
 
});</nowiki>}}
 
});</nowiki>}}
  
===youtube-mplayer===
+
=== toggle-stylesheet ===
Opens YouTube videos with mplayer (requires {{pkg|mplayer}} and {{pkg|youtube-dl}}).
+
 
 +
Toggles between 2 global stylesheets with {{ic|xg}}.
 +
{{hc|~/.config/dwb/userscripts/toggle-stylesheet.sh|<nowiki>
 +
#!/bin/bash
 +
# dwb:xg
 +
 
 +
CURRENT_STYLESHEET="$(dwbremote get setting user-stylesheet-uri)"
 +
 
 +
STYLESHEET_1="file://$HOME/.config/dwb/stylesheets/foo.css"
 +
STYLESHEET_2="file://$HOME/.config/dwb/stylesheets/bar.css"
 +
 
 +
if [[ "${CURRENT_STYLESHEET}" = ${STYLESHEET_1} ]]; then
 +
    dwbremote :local_set user-stylesheet-uri "$STYLESHEET_2"
 +
else
 +
    dwbremote :local_set user-stylesheet-uri "$STYLESHEET_1"
 +
fi</nowiki>}}
 +
 
 +
=== youtube-player ===
 +
 
 +
Opens YouTube videos with MPlayer (uses {{Pkg|mplayer}} and {{Pkg|youtube-dl}}).
 
{{hc|~/.config/dwb/userscripts/youtube-mplayer.js|<nowiki>
 
{{hc|~/.config/dwb/userscripts/youtube-mplayer.js|<nowiki>
 
//!javascript  
 
//!javascript  
Line 107: Line 228:
 
});</nowiki>}}
 
});</nowiki>}}
  
==Stylesheets==
+
== Stylesheet ==
Stylesheets can be defined in the Settings page under '''user-stylesheet-uri'''<nowiki>
+
 
file:///home/tux/.config/dwb/stylesheet.css</nowiki>
+
a global stylesheet can be defined in the Settings, under {{ic|user-stylesheet-uri}} (i.e. {{ic|file:///home/tux/.config/dwb/stylesheet.css}})
 +
 
 +
If you browse with the status bar hidden and are annoyed by the the link previews that appear while hovering over links with the mouse, add this to the stylesheet: {{ic|#dwb_hover_element { display:none!important; }}}
  
 
== Troubleshooting ==
 
== Troubleshooting ==
Line 116: Line 239:
  
 
Make sure you have the following GStreamer packages installed:
 
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
+
  # 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 gstreamer0.10-ffmpeg
  
=== Search engines always search for ''undefined'' ===
+
=== Search engines search for ''undefined'' ===
  
 
If you are always searching for ''undefined'' even with the {{ic|searchengine-submit-pattern}} option set, then you should edit {{ic|$XDG_CONFIG_HOME/dwb/searchengines}} and adapt the URIs to match your {{ic|searchengine-submit-pattern}}.
 
If you are always searching for ''undefined'' even with the {{ic|searchengine-submit-pattern}} option set, then you should edit {{ic|$XDG_CONFIG_HOME/dwb/searchengines}} and adapt the URIs to match your {{ic|searchengine-submit-pattern}}.
Line 124: Line 247:
 
=== Fuzzy font in Github ===
 
=== Fuzzy font in Github ===
  
Add this in your ~/.config/fontconfig/fonts.conf inside the fontconfig-tags:
+
Add this in your {{ic|~/.config/fontconfig/fonts.conf}} inside the fontconfig-tags:
  
 
   <selectfont>
 
   <selectfont>

Revision as of 18:31, 12 November 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. There are also other versions in the AUR: dwb-gitAUR, dwb-gtk3AUR, and dwb-gtk3-gitAUR.

Basic usage

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

Use : to access the command prompt. You can use Tab 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

dwb-specific

o        = enter url
O        = enter url in new tab
f        = spawn hints. 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
gi       = go to the first input field and enter insert mode
ctrl+e   = open editable field in external editor. Useful for forums and wikis.
;d       = download via hints
M        = save bookmark (bookmarks are saved in ~/.config/dwb/default/bookmarks)
xb       = show/hide status bar
gf       = toggle source view
+        = zoom_in
-        = zoom_out
=        = reset to 100%

vim-like

i        = toggle_insert_mode   (Esc works to go back to normal mode much like Vim)
Esc      = back to normal mode (ctrl+n works too)
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
ZZ       = save session and exit

Notes

Press v to switch to caret browsing, then press space to toggle between caret and visual mode. Press 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 Shift to select text. Press Enter to follow links.

Configuration

The configuration files are stored in $XDG_CONFIG_HOME/dwb/ (usually ~/.config/dwb/) and can be easily accessed through the web interface. Type Ss to open the Settings page.

Search engines

Open your favorite search engine, type gs to select the web page's first input field, and then enter a keyword associated with it.

Now you can use the keyword in the URI prompt to search directly on the corresponding website. Typing queries directly in the address bar will search with the default search engine, which is the first entry in $XDG_CONFIG_HOME/dwb/searchengines.

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 (Sk).

~/.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:      Mainstream equivalent:
   - adblock_subscriptions    Adblock
   - autoquvi                 Video DownloadHelper
   - contenthandler           (Handle requests based on MIME type, filename extension or URI scheme)
   - downloadhandler          (Handle downloads based on mimetype or filename extension, useful if 'download-no-confirm' is set)
   - formfiller               LastPass, Lazarus (Save form data and fill forms with previously saved data, also with gpg-support)
   - googlebookmarks          GBookmarks, GMarks (Add bookmarks to google bookmarks with a shortcut)
   - googledocs               Open with Google Docs, Google Docs Viewer
   - grabscrolling            (Adobe Acrobat style grab and drag mouse scrolling)
   - multimarks               (Bookmark multiple urls to a single quickmark)
   - navtools                 Opera Fast Forward, IE 10 Flip Ahead
   - perdomainsettings        (Change webkit-settings automatically on domain or url basis)
   - pwdhash                  PwdHash
   - requestpolicy            RequestPolicy, Disconnect, Ghostery
   - simplyread               Readability, Clearly
   - speeddial                Speed Dial
   - supergenpass             (Generate domain-based passwords; compatible with the bookmarklet supergenpass but with additional options)
   - unique_tabs              (Remove duplicate tabs or avoid duplicate tabs by autoswitching to tabs with same url)
   - userscripts              GreaseMonkey/Stylish
   - whitelistshortcuts       (Whitelist webkit settings for certain domains with a shortcut)

For more details, use dwbem -I <extension> and read the dwb and dwbem man pages.

Below is a list of popular extensions (or add-ons) for which dwb has a built-in alternative:

  • NoScript/Flashblock: dwb blocks flash by default and can block javascript.
  • Omnibar: just like Chrome, dwb's address gives quick access to search, history, and bookmarks.
  • Download Statusbar: dwb's displays downloads in a neat status bar by default.
  • IE Tab: dwb can open a page in any external browser with a simple userscript.
  • Session Manager: dwb uses its built-in session manager by default.
  • Private browsing: add xpp:toggle enable-private-browsing to custom_keys to toggle privacy mode by typing xpp.

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:

defer-loading

Prevents tabs from last session to load all at once at startup.

~/.config/dwb/userscripts/defer-loading.js
//!javascript
if (settings.loadOnFocus === false) {
    execute('local_set load-on-focus true');
}
Signal.connect('navigation', function(webview) {
    if (webview == tabs.current) {
        execute('local_set load-on-focus false');
        this.disconnect();
    }
});

fast-forward

Opera features a neat key binding which allows users to load to next/previous logical page. 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 } and {:

~/.config/dwb/default/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;}} location.href=location.href.replace(/(\d+)([^\/\d]*)$/, function(a,b,c){return ++b+c})}})();
{: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;}} location.href=location.href.replace(/(\d+)([^\/\d]*)$/, function(a,b,c){return --b+c})}})();

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

open-firefox

Opens current page in Firefox with xf (uses firefox and notify-send).

~/.config/dwb/userscripts/open-firefox.sh
#!/bin/bash
# dwb: xf
firefox $DWB_URI &
notify-send -u low "Firefox opening $DWB_URI" #optional notification

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 = Signal.connect("navigation", function(wv) {
        if (wv == tabs.current)
        {
                    execute("set load-on-focus false");
                            Signal.disconnect(sigId);
                                }
});

toggle-stylesheet

Toggles between 2 global stylesheets with xg.

~/.config/dwb/userscripts/toggle-stylesheet.sh
#!/bin/bash
# dwb:xg

CURRENT_STYLESHEET="$(dwbremote get setting user-stylesheet-uri)"

STYLESHEET_1="file://$HOME/.config/dwb/stylesheets/foo.css"
STYLESHEET_2="file://$HOME/.config/dwb/stylesheets/bar.css"

if [[ "${CURRENT_STYLESHEET}" = ${STYLESHEET_1} ]]; then
    dwbremote :local_set user-stylesheet-uri "$STYLESHEET_2"
else 
    dwbremote :local_set user-stylesheet-uri "$STYLESHEET_1"
fi

youtube-player

Opens YouTube videos with MPlayer (uses 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;
});

Stylesheet

a global stylesheet can be defined in the Settings, under user-stylesheet-uri (i.e. file:///home/tux/.config/dwb/stylesheet.css)

If you browse with the status bar hidden and are annoyed by the the link previews that appear while hovering over links with the mouse, add this to the stylesheet: #dwb_hover_element { display:none!important; }

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 gstreamer0.10-ffmpeg

Search engines 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>