I suggest you ...

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

7 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Tiger.711Tiger.711 shared this idea  ·   ·  Admin →

    15 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • ithincAdminithinc (Admin, Tab Utilities) commented  · 

        Maybe a new closeWindowPermanently option, but what "Restore previous session" will do then? The session will be empty forever.

      • ithincAdminithinc (Admin, Tab Utilities) commented  · 

        Import the following setting:

        pref("extensions.tabutils.js.closeWindowFastPath", 'TU_hookCode("gBrowser.removeTab", /.*_beginRemoveTab.*/, function(s) s.replace("true", "false"));');

      • Tiger.711Tiger.711 commented  · 

        >OK, I see. You want a different behavior for closing window with last tab than closing window directly.

        Absolutely correct!

        >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.

      • ithincAdminithinc (Admin, Tab Utilities) commented  · 

        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)");

      • ithincAdminithinc (Admin, Tab Utilities) commented  · 

        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?

      • Tiger.711Tiger.711 commented  · 

        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

      • ithincAdminithinc (Admin, Tab Utilities) commented  · 

        > gPrefService.setBoolPref("browser.sessionstore.resume_session_once", true);
        > goQuitApplication();

        Useful. Works like a charm. Thanks!

      • Tiger.711Tiger.711 commented  · 

        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.

      • K4RBQT99K4RBQT99 commented  · 

        @Tiger
        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:

        gPrefService.setBoolPref("browser.sessionstore.resume_session_once", true);
        goQuitApplication();

        In any case, you always can to restore the previous session in the historial menu, if you forget to use the action mentioned.

      • Tiger.711Tiger.711 commented  · 

        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.

      • Tiger.711Tiger.711 commented  · 

        >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.

      Feedback and Knowledge Base