Created
May 14, 2015 04:37
-
-
Save troyp/9f993eccb80bd074188d to your computer and use it in GitHub Desktop.
Pentadactyl ex file defining commands to go back/forward in a duplicated tab (like middle-clicking the navigation buttons)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Pentadactyl ex file: add to .pentadactylrc or source with :source command | |
" Defines commands to go back/forward in a duplicated tab (equivalent to middle-clicking the navigation buttons) | |
" Example keybindings: gh and gl (replacing the builtin gh binding): | |
unmap gh | |
map -g user -ex gh :backt | |
map -g user -ex gl :forwardt | |
command! backt | |
\ -description "Duplicate tab and go back in the browser history" | |
\ -js <<EOF | |
var currT = gBrowser.selectedTab; | |
var dupT = gBrowser.duplicateTab(currT); | |
var dupTB = gBrowser.getBrowserForTab(dupT); | |
var backtListener = function () { | |
gBrowser.goBack(); | |
dupTB.removeEventListener("DOMContentLoaded", backtListener); | |
}; | |
dupTB.addEventListener("DOMContentLoaded", backtListener); | |
gBrowser.selectedTab = dupT; | |
EOF | |
command! forwardt | |
\ -description "Duplicate tab and go forward in the browser history" | |
\ -js <<EOF | |
var currT = gBrowser.selectedTab; | |
var dupT = gBrowser.duplicateTab(currT); | |
var dupTB = gBrowser.getBrowserForTab(dupT); | |
var forwardtListener = function () { | |
gBrowser.goForward(); | |
dupTB.removeEventListener("DOMContentLoaded", forwardtListener); | |
}; | |
dupTB.addEventListener("DOMContentLoaded", forwardtListener); | |
gBrowser.selectedTab = dupT; | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment