When closing window with last tab, switch to a new tab before closing
When closing window with last tab, switch to a blank tab before closing.
Otherwise the browser remembers the session and restores it after the next startup. (last closed tab, which is no needed).
Maybe a new closeWindowPermanently option, but what "Restore previous session" will do then? The session will be empty forever.
Import the following setting:
pref("extensions.tabutils.js.closeWindowFastPath", 'TU_hookCode("gBrowser.removeTab", /.*_beginRemoveTab.*/, function(s) s.replace("true", "false"));');
>OK, I see. You want a different behavior for closing window with last tab than closing window directly.
>But then you'll lose the possibility to undo close the tab.
I will lose the session, yes. I want to close the session.
>I'm not sure if this is favored by the majorities.
Option can be switchable.
>Is there a Firefox bug for this?
I don't know. Never see it.
If I remember correctly, by default Firefox don't allow close last tab. I always use the https://addons.mozilla.org/ru/firefox/addon/last-tab-close-button/
This is my temporally solution. But it duplicate functionality of TU.
Also, I want to minimize the number of extensions.
A quick solution for you, append the following code to your userChrome.js file, or create a "extensions.tabutils.js." preference for it in about:config.
TU_hookCode("gBrowser.removeTab", "_beginRemoveTab(aTab, false, null, true)", "_beginRemoveTab(aTab, false, null, false)");
OK, I see. You want a different behavior for closing window with last tab than closing window directly. But then you'll lose the possibility to undo close the tab. I'm not sure if this is favored by the majorities. Is there a Firefox bug for this?
last tab - i don't want see anymore - close by ctrl+w
one tab - i do want see it next session - close window by alt+F4
> gPrefService.setBoolPref("browser.sessionstore.resume_session_once", true);
Useful. Works like a charm. Thanks!
How do you differentiate the last tab from one tab?
I don't want that. I want to:
- If I close window with last tab > I have a blank page after next start;
- If I close window with one or more tabs > I have them after next start.
I like the same behaviour, and I found two options. I use the second:
* You can to use about:home as start page, that have a 'restore session' button. fast.
* Maintain about:black as start page, and add a button/menuitem/key for the action 'close firefox and force to open the last session the next time'. The code for this is:
In any case, you always can to restore the previous session in the historial menu, if you forget to use the action mentioned.
Sometimes I have complete using the browser and close it (close last tab of it).
But sometimes I have one or more unread tabs, to which I want to return after next launch of the browser. Sometimes, but not every time.
What's the difficulty for you if "When Firefox starts: Show a blank page"?
>Tools .. When Firefox starts: Show a blank page
I use "Restore previous session" in this config.
And if I don't want to save session (and open after next start) - I just close all tabs - and session don't saving.
But if I don't use this extension - Firefox always opens the tab, which I have already closed the last time.
Look, how it's works in https://addons.mozilla.org/ru/firefox/addon/last-tab-close-button/?src=api
Tools > Options > General > Startup > When Firefox starts: Show a blank page