Duplicate tab in DWB browser

DWB is a buttonless webkit browser with common-sense defaults. However, duplicate tab or clone tab function is missing out of the box.

Here’s how to create duplicate tab or clone tab for DWB browser. 

  1. Go to keyboard shotcuts manager. This is accessed by default with keys Sk or by open: dwb:keys.
  2. Scroll to the bottom of the page, to the text area Custom commands
  3. Enter: t:yank_primary;;tab_paste_primary

This will set t key as the shortcut for duplicate tab. If you need this key for something else, use some other key.

Usage case for duplicate tab

DWB intructions page at Archwiki offers a userscript to switch user stylesheets

#!/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

Set two stylesheets in position. Edit the file paths in the script accordingly. Save the script in ~/.config/dwb/userscripts/ and make it executable. Restart the browser. If everything went right, then xg keys will be switching between your two stylesheets.

The problem you will notice is that there’s no way back to the author-set stylesheets after you switched to user stylesheets. This is precisely where duplicate tab comes in handy. Duplicate tab will open up the same address in a new tab and reload author stylesheets.

Leave a Reply

Your email address will not be published. Required fields are marked *