40

In FF, I can move a tab to a new window by either dragging the tab out of the browser, or right clicking the "move to New window" option from the context menu. is there a shortcut key to move the current tab to a new window without dragging or using the context menu, or a way to set one up?

Often, I like to look at 2 tabs side by side, so I drag one out, then hit WINDOWS KEY+ to put the detached tab on the right, then ALT+TAB to tab back to the main window, then WINDOWS KEY+ to put the main window on the left. It would be great if I could do the whole process on the keyboard.

I checked this documentation and did not find any shortcut key for detaching a tab:

chiliNUT
  • 1,027
  • 1
  • 12
  • 28

11 Answers11

25

I found the best way to do this without any third party software. Basically, this is @exic solution with only 2 steps instead of 6 :

Ctrl + L : Focus address bar

Shift + Enter : Open url in new window

This of course has the same con as @exic of loading a new page instead of taking the current one out.

Atralb
  • 486
  • 1
  • 5
  • 11
  • 4
    Strictly speaking, this doesn’t move the tab, it copies the tab — it creates a new window at the same URL as the existing tab *while leaving the tab alone.* – G-Man Says 'Reinstate Monica' Jan 03 '20 at 19:16
  • 3
    @G-ManSays'ReinstateMonica' so you downvote me because you're wrong ? Again : - " this is exic solution [...]" - "This of course has the same con of loading a new page instead of taking the current one out." ... – Atralb Jan 05 '20 at 07:43
  • 1
    @G-ManSays'ReinstateMonica' Coming back to this post, and I can't leave this conversation this way. You're unbelievably obnoxious and haughty while, even after a 5 message conversation, still unable to fully read/understand my post. How can you not comprehend this ==> *** " **This of course has the con of loading a new page instead of taking the current one out.** " ***. What you were obstinate to mention was already stated in my answer from the beginning. That said, adding Alt+Echap & Ctrl+W still makes it 2 steps quicker than the other one, but you needed to make an altercation out of it. – Atralb Feb 05 '20 at 16:12
19

With Vimium-FF, it can be done by pressing W, i.e. shift + w.

AXO
  • 948
  • 12
  • 19
  • 1
    This is true as well if you are using the great [Surfingkeys](https://github.com/brookhong/Surfingkeys) addon. `Shift + w` `Enter` – rtviii May 15 '23 at 06:40
11

Been using this plugin, which fits the bill, shortcuts are customisable.

https://addons.mozilla.org/en-GB/firefox/addon/tabdetach/

jps
  • 211
  • 2
  • 4
  • 1
    This one works well, and it only asks for "Access browser tabs" permission, which seems like the minimal required and doesn't worry me. ("The extension could obtain the URL, title, and icon from any tab" according to https://support.mozilla.org/en-US/kb/permission-request-messages-firefox-extensions?as=u&utm_source=inproduct#w_access-browser-tabs) – Steve Onorato Jul 20 '21 at 21:50
  • This is just perfect, thank you! – Tom Aug 08 '21 at 07:23
  • does the job without doing anything else. great! – Flion Aug 10 '22 at 15:39
11

Here's how to create your own keyboard shortcut to Detach a Firefox Tab to a New Window:

  1. Install the Keyconfig addon

  2. Open the Keyconfig Preferences by pressing Ctrl+Shift+F12 (On Mac it may be ⌘ Cmd+Shift+F12)

  3. Click Add a new key at the bottom left of the keyconfig window.

  4. Replace the contents of the Name field with the name of this command:

    Detach Tab to New Window
    
  5. Paste the following code into the /* CODE */ field:

    window.openDialog("chrome://browser/content/browser.xul","_blank","chrome,dialog=no,all",gBrowser.mCurrentTab);
    
  6. Click OK.

  7. Your new command will be marked as <Disabled> This means you need to set a keyboard shortcut for this command. Make sure your command is selected from the list of commands. Click inside the field at the bottom left of the window. It will highlight the contents and whatever keys you hit next will be entered inside that box. For example, you might use Ctrl+Alt+N. Or if you're a fan of Vim you might use Shift+Y.

  8. Click Apply and then click Close to close the keyconfig window. Test your keyboard shortcut by loading a window with at least 2 tabs and then use your new keyboard shortcut. The current tab should detach itself and form a new window.

Nic
  • 184
  • 5
5

I like to use this shortcut sequence, which does what you want:

Ctrl-L # Focus URL
Ctrl-C # Copy it
Ctrl-W # Close current tab
Ctrl-N # Open new window
Ctrl-V # Paste 
Enter  # Open URL

Obviously it has side effects:

  1. Your buffer is overridden
  2. The page is reloaded (don't do it if you already put input on that page)
  3. It won't work if the current page captures Ctrl-L (like the StackExchange post editor, which has it mapped to "Insert Hyperlink" :-D)

But it doesn't require addons or code.

exic
  • 469
  • 5
  • 9
  • What does "capture" mean in this context? Does it refer to something specific to browsers? Or does it just mean that Ctrl-L is ignored when the cursor is focused on an edit field, or some other element contained within the page? – Nicholas Cousar Oct 09 '19 at 21:05
  • Apparently a website may override shortcuts such as Ctrl-L. The StackExchange editor (the one you get when you answer a question) has Ctrl-L bound to "insert hyperlink", so you won't be able to focus the URL on that website or in that context. – exic Oct 11 '19 at 04:10
5

A solution with keyboard shortcuts that really move the tab, and does not only reopen it.

Ctrl+L                    # Focus the adress bar
Shift+Tab                 # Repeatedly until the tab is focused (3 times for me)
Right-Click Shortcut Key  # Open contextual menu of the tab
v                         # Mo*v*e Tab
w                         # Move to New *W*indow

And, as described in the "Selection of Multiple Tabs" section of the Keyboard shortcuts Firefox Documentation, you can even easily select multiple tabs between step 2 and 3 by using ctrl + arrows and ctrl + space.

Note: I thing that the last two steps (v and w) may depend on your firefox installation, but you can easily spot which key to press becausse this is the underlined letter in the corresponding action name.

paime
  • 151
  • 1
  • 2
  • This would be a great solution but I feel like 'Right-Click Shortcut Key' needs a bit of explenation. – Joe Nov 22 '21 at 10:56
  • This is the key on the left of the right `Ctrl` key, a.k.a the "menu" key on this layout: https://en.wikipedia.org/wiki/British_and_American_keyboards#/media/File:KB_United_States-NoAltGr.svg – paime Nov 24 '21 at 07:09
  • On my machine (Ubuntu 20.04) the "Right-Click Shortcut Key" is Shift-F10. Strangely, it's also four Shift-Tabs rather than three. – davidvandebunte Aug 05 '23 at 15:40
2

In addition to @Nic's answer, use the following code to also close the detached tab from the original window:

window.openDialog("chrome://browser/content/browser.xul","_blank","chrome,dialog=no,all",gBrowser.mCurrentTab);
window.open('','_gBrowser.mCurrentTab').close();
1

Two steps : simplest way to get this done is to SELECT the tab address by just clicking on the address bar then just press CTRL+SHIFT.

 1. SELECT the tab address
 2. Press CTRL+SHIFT

enter image description here

NJENGAH
  • 119
  • 3
  • When I highlight the address and press Ctrl+Shift nothing happens for me. Also, in your screenshot it looks like its reloading the page which is undesirable. – chiliNUT Apr 23 '21 at 18:50
  • It might be `Shift+Enter` instead of `Ctrl+Shift`, but yes it only duplicates the tab in another window – paime Nov 24 '21 at 07:11
0

I use Alfred and built a workflow that starts with a hotkey to run this osascript (javascript)

(thanks to James Robert who wrote the initial code which I adapted):

// Origin: https://gist.github.com/jiaaro/c95e89ea5cacc6906040

var sys_events = Application('System Events')
var key_codes = {
  '→': 124,
  '←': 123,
  '↑': 126,
  '↓': 125,
  '⏎': 36, // Return
  '⇥': 48, // Tab
  '⌫': 51, // Delete
  '⎋': 53 // Escape
}
var modifiers = {
  '⌘': 'command down',
  '^': 'control down',
  '⌥': 'option down',
  '⇧': 'shift down'
}

function press(hotkey) {
  var using = []

  while (hotkey.length > 1) {
    if (modifiers[hotkey[0]] == undefined) {
      throw new Error(hotkey[0] + ' is not a recognized modifier key')
    }
    using.push(modifiers[hotkey[0]])
    hotkey = hotkey.slice(1)
  }

  if (key_codes[hotkey] != undefined) sys_events.keyCode(key_codes[hotkey], { using: using })
  else sys_events.keystroke(hotkey.toLowerCase(), { using: using })
}

const sequence = [
  { key: '⌘L' },
  { key: '⌘C' },
  { key: '⌘W' },
  { key: '⌘⌥←' }, // I use specticle app to manage window locations
  { key: '⌘N', wait: 0.8 },
  { key: '⌘⌥→' }, // I use specticle app to manage window locations
  { key: '⌘L' },
  { key: '⌘V' },
  { key: '⏎' }
]

for (const { key, wait } of sequence) {
  press(key)
  wait && delay(wait)
}

Now when I'm in chrome I run CMD-pagedown as my hotkey and it does the magic.

Jim
  • 101
  • 1
0

I am on Ubuntu 22.04 and Firefox 105 and I use this keyboard shortcut to detach the current tab and move to a new window:

Ctrl + Shift + Space

Pablo
  • 141
  • 6
-3

For a list of all keyboard shortcuts in FireFox, visit this website. For information on tab shortcuts, scroll down about halfway. I believe the one you are looking for is Insert or Shift+Insert.

  • 3
    I checked there first but didn't see anything. I should add that to the question. Insert and shift+insert don't do anything for me. – chiliNUT Feb 24 '15 at 04:33