I don't want the last session's tabs restored when I reopen Thunderbird (68). There seems to be no setting to control this?
I have the "Manually Sort Folders" add-on set to start each time on Inbox, but other tabs remain open also, and if one of them was selected on close, that's where I go on restart.
There used to be a "Don't restore tabs" add-on but it doesn't work after TB 60.
Manage tabs on open/close
-
- Posts: 322
- Joined: April 16th, 2014, 8:54 pm
- Location: Colorado
- tanstaafl
- Moderator
- Posts: 49647
- Joined: July 30th, 2003, 5:06 pm
Re: Manage tabs on open/close
A crude hack would be to modify your shortcut to run a two line batch file. The first line deletes the session.json file in the profile. The second line runs Thunderbird.
session.json stores the default windows layout. This includes data on what tabs are open. Thunderbird (3.0 and later) deletes this file after reading the settings. Its re-created and the layout saved when Thunderbird terminates normally.
session.json stores the default windows layout. This includes data on what tabs are open. Thunderbird (3.0 and later) deletes this file after reading the settings. Its re-created and the layout saved when Thunderbird terminates normally.
-
- Posts: 6429
- Joined: February 3rd, 2009, 6:29 pm
Re: Manage tabs on open/close
You can overwrite the atStartupRestoreTabs function using the userChromeJS extension. (for advanced users only)
That's what the DontRestoreTabs addon does.
DontRestoreTabs (obsolete)
http://addons.thunderbird.net/thunderbird/addon/663190
userChromeJS by jikamens (compatible with TB 68 and TB 78 and TB 91)
http://addons.thunderbird.net/thunderbird/addon/986610
Instructions:
1. install userChromeJS extension
2. close email client
3. create or edit the userChrome.js file in the chrome folder
4. open email client
I tested the code in TB 78 and it works for me.
Reference
http://searchfox.org/comm-esr60/search? ... estoreTabs
http://searchfox.org/comm-esr68/search? ... estoreTabs
That's what the DontRestoreTabs addon does.
DontRestoreTabs (obsolete)
http://addons.thunderbird.net/thunderbird/addon/663190
Code: Select all
/* Thunderbird userChrome.js */
// Thunderbird 68 uses the messenger.xul page.
// Thunderbird 78 uses the messenger.xhtml page.
// Thunderbird 91 uses the messenger.xhtml page.
(function () {
if (location == "chrome://messenger/content/messenger.xul" ||
location == "chrome://messenger/content/messenger.xhtml") {
setTimeout(function () {
try {
atStartupRestoreTabs = function (aDontRestoreFirstTab) {
return false;
};
} catch (e) {
Components.utils.reportError(e);
}
}, 10);
}
})();
http://addons.thunderbird.net/thunderbird/addon/986610
Instructions:
1. install userChromeJS extension
2. close email client
3. create or edit the userChrome.js file in the chrome folder
4. open email client
I tested the code in TB 78 and it works for me.
Reference
http://searchfox.org/comm-esr60/search? ... estoreTabs
http://searchfox.org/comm-esr68/search? ... estoreTabs
-
- Posts: 322
- Joined: April 16th, 2014, 8:54 pm
- Location: Colorado
Re: Manage tabs on open/close
I've found that deleting session.json results in NO mail folder being open on restart, whereas I do always want Inbox (which I set in the MSF add-on).tanstaafl wrote:A crude hack would be to modify your shortcut to run a two line batch file. The first line deletes the session.json file in the profile. The second line runs Thunderbird.
Thanks. Before I try this, could you confirm that it won't have the same effect just described?morat wrote:You can overwrite the atStartupRestoreTabs function using the userChromeJS extension...
-
- Posts: 6429
- Joined: February 3rd, 2009, 6:29 pm
Re: Manage tabs on open/close
Are you saying that deleting the session.json file causes the Manually Sort Folders 'choose the default startup folder' feature to fail? The hack doesn't delete the session.json file so I guess it works like the DontRestoreTabs addon in Thunderbird 60.
-
- Posts: 322
- Joined: April 16th, 2014, 8:54 pm
- Location: Colorado
Re: Manage tabs on open/close
Yes. Without session.json, Thunderbird opens to Local Folders instead of what's selected in MSF, Inbox. (What's more puzzling about MSF is that if another tab just happened to be selected on closing, MSF doesn't even change the focus to Inbox instead on reopening. That's why I want the other tabs to close.)morat wrote:Are you saying that deleting the session.json file causes the Manually Sort Folders 'choose the default startup folder' feature to fail?
I looked up the userChromeJS add-on... it's marked "experimental" and has two user reviews, one of whom had problems with it. I'm starting to think I can just continue to manage tabs manually.
-
- Posts: 2
- Joined: October 17th, 2021, 12:21 pm
Re: Manage tabs on open/close
I worked with another person on an add-on that does what morat describes above, but it doesn't require adding files manually with userChromeJS, the add-on handles everything on its own. You just install and restart Thunderbird, and it will prevent tabs from loading on start.
The add-on is not yet accepted in the official Thunderbird add-ons. I submitted a version which hopefully will be accepted, but for now you can find the add-on and install it via "Install Add-on from file" (select the dontRestoreTabsRevival.xpi file).
Code: https://github.com/guylifshitz/DontRest ... ob/master/
Add-on XPI file: https://github.com/guylifshitz/DontRest ... evival.xpi
Extra news: apparently there will be a change the the add-ons API soon which will make this code irrelevant within a few months. I was told "We are working on a WebExtension API to handle sessions. ETA: End of November". We will try to return to this project at the end of the year and see if this add-on needs updating.
The add-on is not yet accepted in the official Thunderbird add-ons. I submitted a version which hopefully will be accepted, but for now you can find the add-on and install it via "Install Add-on from file" (select the dontRestoreTabsRevival.xpi file).
Code: https://github.com/guylifshitz/DontRest ... ob/master/
Add-on XPI file: https://github.com/guylifshitz/DontRest ... evival.xpi
Extra news: apparently there will be a change the the add-ons API soon which will make this code irrelevant within a few months. I was told "We are working on a WebExtension API to handle sessions. ETA: End of November". We will try to return to this project at the end of the year and see if this add-on needs updating.
-
- Posts: 2
- Joined: October 17th, 2021, 12:21 pm
Re: Manage tabs on open/close
I managed to get DontRestoreTabsRevival into the official AddOns website. It is at this link in case anyone wants to install it easily:
https://addons.thunderbird.net/en-US/th ... bsrevival/
As for sessions in the API, it doesn't seem to be there yet.
https://addons.thunderbird.net/en-US/th ... bsrevival/
As for sessions in the API, it doesn't seem to be there yet.