Session Manager 0.1 to 0.3.9+

Talk about add-ons and extension development.
Locked
Peng
Posts: 778
Joined: November 9th, 2004, 2:31 pm
Location: Central Florida
Contact:

Post by Peng »

I think maybe 'Replace Existing Windows' should be off by default because it Does Bad Things. But, it is in the Session Manager menu, so maybe anyone who doesn't notice it deserves it. :P
Hug Peng
(aka Matt Nordhoff)
Check out: Adblock Plus | FoxClocks | OpenBook
********
Posts: 947
Joined: August 24th, 2005, 12:23 pm

Post by ******** »

really? it's been working fine for the most part here.
Peng
Posts: 778
Joined: November 9th, 2004, 2:31 pm
Location: Central Florida
Contact:

Post by Peng »

desertfox wrote:somehow saving POSTDATA in session manager made me double-post when i restarted the browser.
weird.
sry.


Yeah. I'm turning it off because of that.

desertfox wrote:really? it's been working fine for the most part here.


If you were talking to me, I just mean Does Bad Things as exactly what it does: Overwrites the tabs you had open.
Hug Peng
(aka Matt Nordhoff)
Check out: Adblock Plus | FoxClocks | OpenBook
********
Posts: 947
Joined: August 24th, 2005, 12:23 pm

Post by ******** »

Peng wrote:
desertfox wrote:somehow saving POSTDATA in session manager made me double-post when i restarted the browser.
weird.
sry.

Yeah. I'm turning it off because of that.

desertfox wrote:really? it's been working fine for the most part here.

If you were talking to me, I just mean Does Bad Things as exactly what it does: Overwrites the tabs you had open.

haha. :D
and yeah, saving POSTDATA is unreliable.
actually, i mean, too reliable :P
AnonEmoose
Posts: 2031
Joined: February 6th, 2004, 11:59 am

Post by AnonEmoose »

zeniko wrote:
AnonEmoose wrote:- Restore a session into tabs in current window (instead of a new window) as the default the restore method

Which is about as simple as adding a ! in front of aEvent.ctrlKey. ;)

hehe... :-)

zeniko wrote:
AnonEmoose wrote:- Middleclick tabbar = undoclosetab

As has already been mentioned, Tab Clicking Options is the recommended way to go. I prefer not having to hack an otherwise unrelated part of Firefox for getting such a feature (which I couldn't even test due to the lack of a middle mouse button).
I was only pointing out to Peng & alta that it could easily be done
AnonEmoose wrote:but if it is the case that it is my preference that perhaps other users don't want/need/prefer i just modify the code on my machine.

incidentally the code i use is here if anyone cares to use it and doesn't want to install any other extensions

~ line 76

this.setPref("_running", true);
this.mFullyLoaded = true;
getBrowser().mTabContainer.addEventListener("click",function(e){ if (e.button !=1 || !gSessionManager.mClosedTabs.length) return;
if(e.originalTarget.className == "tabs-right")
gSessionManager.undoCloseTab();
},false)
old zeniko
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post by old zeniko »

SevenSeven wrote:Actually, I was referring to the double-click replace function within the Save Current Window dialog. Instead of the old name, the one shown in the session list, being used for the double-click replacement, the new name, which is the one shown at the bottom of the dialog; maybe a checkbox or something near "Double-click an existing session..." that says "Replace existing session name with new..." or something.

You want to overwrite and to rename at the same time. One way to achieve something like this is to add the following line to your userChrome.js. You can then select a session and name it before overwriting it (right-click to select without overwriting the name):

Code: Select all

eval("gSessionManager.save = " + gSessionManager.save.toString().replace("text:", "allowNamedReplace: true, $&"));

BTW: It is recommended to update to version 0.3.7.6 for the best effect.

desertfox wrote:i don't think the hack is really necessary, considering clicking the toolbar button or clicking save session is just as fast, or at least almost as fast.

I hadn't even thought of that. I've thus removed the hack again. For those interested in the code, <a href="data:text/plain,288%2C289c288%2C291%0A%3C%20%09%09%09menuitem.setAttribute(%22oncommand%22%2C%20'gSessionManager.load(%22'%20%2B%20aSession.fileName%20%2B%20'%22%2C%20(event.shiftKey)%3F%22newwindow%22%3A(event.ctrlKey)%3F%22append%22%3A%22%22)%3B')%3B%0A%3C%20%09%09%09menuitem.setAttribute(%22onclick%22%2C%20'if%20(event.button%20%3D%3D%201)%20gSessionManager.load(%22'%20%2B%20aSession.fileName%20%2B%20'%22%2C%20%22newwindow%22)%3B')%3B%0A---%0A%3E%20%09%09%09menuitem.setAttribute(%22oncommand%22%2C%20%22gSessionManager.onSessionCommand(event%2C%20this)%3B%22)%3B%0A%3E%20%09%09%09menuitem.setAttribute(%22onclick%22%2C%20%22gSessionManager.onSessionClick(event%2C%20this)%22)%3B%0A%3E%20%09%09%09menuitem.setAttribute(%22_session%22%2C%20aSession.fileName)%3B%0A%3E%20%09%09%09menuitem.setAttribute(%22_name%22%2C%20aSession.name)%3B%0A292a295%0A%3E%20%09%09delete%20this.mMarkedSession%3B%0A326a330%2C358%0A%3E%20%09onSessionCommand%3A%20function(aEvent%2C%20aItem)%0A%3E%20%09%7B%0A%3E%20%09%09if%20(!this.mMarkedSession)%0A%3E%20%09%09%7B%0A%3E%20%09%09%09this.load(aItem.getAttribute(%22_session%22)%2C%20(aEvent.shiftKey)%3F%22newwindow%22%3A(aEvent.ctrlKey)%3F%22append%22%3A%22%22)%3B%0A%3E%20%09%09%7D%0A%3E%20%09%09else%20if%20(this.mMarkedSession%20%3D%3D%20aItem.getAttribute(%22_session%22))%0A%3E%20%09%09%7B%0A%3E%20%09%09%09this.save(aItem.getAttribute(%22_name%22)%2C%20this.mMarkedSession%2C%20aEvent.shiftKey)%3B%0A%3E%20%09%09%7D%0A%3E%20%09%7D%2C%0A%3E%20%0A%3E%20%09onSessionClick%3A%20function(aEvent%2C%20aItem)%0A%3E%20%09%7B%0A%3E%20%09%09if%20(aEvent.button%20%3D%3D%201%20%26%26%20!this.mMarkedSession)%0A%3E%20%09%09%7B%0A%3E%20%09%09%09this.load(aItem.getAttribute(%22_session%22)%2C%20%22newwindow%22)%3B%0A%3E%20%09%09%7D%0A%3E%20%09%09else%20if%20(aEvent.button%20%3D%3D%202)%0A%3E%20%09%09%7B%0A%3E%20%09%09%09if%20(this.mMarkedSession)%0A%3E%20%09%09%09%7B%0A%3E%20%09%09%09%09aItem.parentNode.getElementsByAttribute(%22_session%22%2C%20this.mMarkedSession)%5B0%5D.removeAttribute(%22marked%22)%3B%0A%3E%20%09%09%09%7D%0A%3E%20%09%09%09this.mMarkedSession%20%3D%20aItem.getAttribute(%22_session%22)%3B%0A%3E%20%09%09%09aItem.setAttribute(%22marked%22%2C%20%22true%22)%3B%0A%3E%20%09%09%7D%0A%3E%20%09%7D%2C%0A%3E%20%0A">there you are</a>.

desertfox wrote:somehow saving POSTDATA in session manager made me double-post when i restarted the browser.

That happens when you haven't been redirected at the moment of closing the browser. Currently there's not much I could do against that. You could simply disable POSTDATA saving.

Peng wrote:I think maybe 'Replace Existing Windows' should be off by default because it Does Bad Things. But, it is in the Session Manager menu, so maybe anyone who doesn't notice it deserves it. :P

I switched this on because (1) the use cases I saw primarily involved replacing rather than appending (and users might get confused by the many open windows), (2) the setting of this option is clearly visible when you click on a session and (3) if you get bitten by this, you can always reopen all (i.e. per default a maximum of 10) windows closed in the process.

AnonEmoose wrote:incidentally the code i use is here if anyone cares to use it and doesn't want to install any other extensions [...]

Or add the following code to your userChrome.js (if you're already using it, anyway):

Code: Select all

getBrowser().mTabContainer.addEventListener("click", function(aEvent) {
   if (aEvent.button == 1 && aEvent.originalTarget.className == "tabs-right") {
      gSessionManager.undoCloseTab();
   }
}, false);

Or if you prefer a double-click instead of a middle-click:

Code: Select all

getBrowser().mTabContainer.addEventListener("dblclick", function(aEvent) {
   if (aEvent.button == 0 && aEvent.originalTarget.className == "tabs-right") {
      gSessionManager.undoCloseTab();
   }
}, false);
Peng
Posts: 778
Joined: November 9th, 2004, 2:31 pm
Location: Central Florida
Contact:

Post by Peng »

zeniko wrote:That happens when you haven't been redirected at the moment of closing the browser. Currently there's not much I could do against that. You could simply disable POSTDATA saving.


Form data is still saved, right?

I still support a warning page when POSTDATA will be submitted again because of Crash Recovery/Session Manager. I think.

zeniko wrote:I switched this on because (1) the use cases I saw primarily involved replacing rather than appending (and users might get confused by the many open windows), (2) the setting of this option is clearly visible when you click on a session and (3) if you get bitten by this, you can always reopen all (i.e. per default a maximum of 10) windows closed in the process.


Oh, that's true, you can reopen them. No complaint from me, then. :)
Hug Peng
(aka Matt Nordhoff)
Check out: Adblock Plus | FoxClocks | OpenBook
old zeniko
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post by old zeniko »

Peng wrote:Form data is still saved, right?

Sure. Form data and POSTDATA are two different things (although the former usually becomes the latter ;)).

Peng wrote:I still support a warning page when POSTDATA will be submitted again because of Crash Recovery/Session Manager.

So do I. But this is currently impossible to achieve from JS, AFAICT.
Peng
Posts: 778
Joined: November 9th, 2004, 2:31 pm
Location: Central Florida
Contact:

Post by Peng »

zeniko wrote:Sure. Form data and POSTDATA are two different things (although the former usually becomes the latter ;)).


Just makin' sure. :)

Maybe there should be preferences for saving form data, and maybe cookies?

zeniko wrote:So do I. But this is currently impossible to achieve from JS, AFAICT.


Firefox does it when you try to refresh a page that has POSTDATA..


Oh, I thought of another thing: Since you can specify the default name for saved sessions, I would like to be able to specify the name of the session backups that are automatically made after Firefox crashes.


Edit: You know, there's no reason to use + in the Firefox maxVersion anymore. 1.6a1 or 1.6 work. But, do older versions of Firefox get confused by that when they try to parse the file?
Hug Peng
(aka Matt Nordhoff)
Check out: Adblock Plus | FoxClocks | OpenBook
Lost User 59366
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Feature request

Post by Lost User 59366 »

Like this extension,don't know if you are still doing changes but if you are, please consider: As a long time user of TabBrowserExtensions (TBE) there are some odds and ends that might improve this ext.:
1. Ability to right click or otherwise directly perform an operation on a saved session or tab rather than having to open the separate window.)
2. Numbers for retained items, enterable from keybd. to load selection.
3. A flush/delete all option.

And do you have any suggestions for an "easy" way to import sessions from TBE?
Peng
Posts: 778
Joined: November 9th, 2004, 2:31 pm
Location: Central Florida
Contact:

Re: Feature request

Post by Peng »

tjztzu wrote:Like this extension,don't know if you are still doing changes ...


zeniko's last post was an hour before yours and the last version was released today. Why wouldn't he (you are a he, right, zeniko?) still be doing changes?

tjztzu wrote: 1. Ability to right click or otherwise directly perform an operation on a saved session or tab rather than having to open the separate window.)


There was a discussion on having a context menu for the Session Manager menus a page or two ago. It's not going to happen.

tjztzu wrote: 3. A flush/delete all option.


In the window where you delete sessions, you can select all of them with Shift or Ctrl.

tjztzu wrote:And do you have any suggestions for an "easy" way to import sessions from TBE?


I don't, sorry. I haven't used TBE in a long time. The easiest way to do it would be to open each of the sessions with TBE and save them with Session Manager, I guess.


Edit: I have an ishoooo. When I upgraded from SM 0.3.7.3 to 0.3.7.6 just now, including uninstalling it, restarting, installing it, restarting one or two more times, and finally restarting and going back to my normal use, it both used old data for the session I saved before upgrading (not close to my current session, it might've been a copy of my last saved session, actually) and it randomly opened that session the first time I restarted, instead of what I had open when I closed Firefox. WTF?
Hug Peng
(aka Matt Nordhoff)
Check out: Adblock Plus | FoxClocks | OpenBook
SevenSeven
Posts: 33
Joined: February 8th, 2004, 1:05 pm

Post by SevenSeven »

zeniko wrote:You want to overwrite and to rename at the same time. One way to achieve something like this is to add the following line to your userChrome.js. You can then select a session and name it before overwriting it (right-click to select without overwriting the name):

Code: Select all

eval("gSessionManager.save = " + gSessionManager.save.toString().replace("text:", "allowNamedReplace: true, $&"));

BTW: It is recommended to update to version 0.3.7.6 for the best effect.

Is it possible to make this work for double-click? To do the "right-click to select without overwriting the name" with one less click, at least for me 'cause I use the middle-button-single-click-as-double-click, and less drag I'd prefer but if it's not, that's fine. Thanks!
old zeniko
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post by old zeniko »

Peng wrote:Maybe there should be preferences for saving form data, and maybe cookies?

Isn't there? You can already say where to save form data, cookies and POSTDATA and you can disable POSTDATA saving - which would result in precisely the pref you're advocating.

Peng wrote:Firefox does it when you try to refresh a page that has POSTDATA..

Sure it does, but Firefox isn't pure JS. Now, if somebody could point me into the right direction for doing this (or even provide the necessary code)...

Peng wrote:Oh, I thought of another thing: Since you can specify the default name for saved sessions, I would like to be able to specify the name of the session backups that are automatically made after Firefox crashes.

What's wrong with the default name? I'd really prefer not to have to offer you prefs for simple UI strings.

Peng wrote:Edit: You know, there's no reason to use + in the Firefox maxVersion anymore.

I prefer keeping the + just for saying that developing versions are included (BTW: 1.6a1 is still an invalid version - see this article).

tjztzu wrote:1. Ability to right click or otherwise directly perform an operation on a saved session or tab rather than having to open the separate window.)

The issue with this request is that it's neither easily discoverable (you have to know that it's there) and that it's not keyboard accessible. I'm open for suggestions, but I won't do it the TBE or TMP way. As for right-clicking on single tabs - what operation would you expect there? Anyway, I prefer not to clutter all possible menus with my entries but just offer a minimal UI impact which you could easily extend (e.g. through MenuManipulator).

tjztzu wrote:2. Numbers for retained items, enterable from keybd. to load selection.

I don't understand this request. Please reformulate or explain it further.

tjztzu wrote:3. A flush/delete all option.

You can delete multiple sessions at once from the dialog and you can clear the "Reopen Closed..." list from the Options dialog. Do you mean anything different here?

tjztzu wrote:And do you have any suggestions for an "easy" way to import sessions from TBE?

Installing both extensions side-by-side and then loading each session from TBE and saving it with SM might work... Otherwise you'll have to ask a kind soul to write a convertor (or do so yourself).

Peng wrote:I have an ishoooo. When I upgraded from SM 0.3.7.3 to 0.3.7.6 just now, including uninstalling it, restarting, installing it, restarting one or two more times, and finally restarting and going back to my normal use, it both used old data for the session I saved before upgrading (not close to my current session, it might've been a copy of my last saved session, actually) and it randomly opened that session the first time I restarted, instead of what I had open when I closed Firefox. WTF?

Please try to reproduce this behavior - if possible on a clean profile - so that I can see the problem for myself. Your description here is unfortunately not really helpful. Obviously I've never encountered such an issue myself (and don't see any code path which could lead to such - but I may be mistaken) and what you describe could just as well be due to an incorrect manipulation on your side (which I'd still be interested in knowing).

SevenSeven wrote:Is it possible to make this work for double-click?

This should now work as expected as of version 0.3.7.7.
Peng
Posts: 778
Joined: November 9th, 2004, 2:31 pm
Location: Central Florida
Contact:

Post by Peng »

zeniko wrote:Isn't there? You can already say where to save form data, cookies and POSTDATA and you can disable POSTDATA saving - which would result in precisely the pref you're advocating.


It doesn't matter to me, I'm okay with cookies and form data being saved. But some people might only want one of them.

zeniko wrote:Sure it does, but Firefox isn't pure JS. Now, if somebody could point me into the right direction for doing this (or even provide the necessary code)...


True. Since no matter how much I want to provide the code to do it, I don't know how, never mind, I guess. *Sigh* (at me, not you)

zeniko wrote:What's wrong with the default name? I'd really prefer not to have to offer you prefs for simple UI strings.


You already have the pref for the default name for when you save sessions. I prefer using YYYY-MM-DD HH:MM (crashed) or something like that, that way the crashed sessions aren't separate from the main list of sessions.

zeniko wrote:Please try to reproduce this behavior - if possible on a clean profile - so that I can see the problem for myself. Your description here is unfortunately not really helpful. Obviously I've never encountered such an issue myself (and don't see any code path which could lead to such - but I may be mistaken) and what you describe could just as well be due to an incorrect manipulation on your side (which I'd still be interested in knowing).


I didn't do anything wrong. I clicked the Session Manager button, clicked 'Save Session' because it automatically has the new name, used TMP's context menu item to close all the tabs except one, and restarted Firefox. I have SM configured to load the '[ Previous Browsing Session ]' session at startup and to back up the current session at shutdown.

We'll see if this happens again when I upgrade to 0.3.7.7.

Edit: I just upgraded to 0.3.7.7. Hah. I saved my session with both Tab Mix Plus's Session Manager and your Session Manager. On the next startup, TMP popped up a dialog saying that its session.rdf was corrupt so it was moving it to session.old and using an empty session.rdf. I am not having luck with the session extensions. :P The Session Manager extension upgrade went completely smoothly, though.
Hug Peng
(aka Matt Nordhoff)
Check out: Adblock Plus | FoxClocks | OpenBook
old zeniko
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Re: Feature request

Post by old zeniko »

tjztzu wrote:1. Ability to right click or otherwise directly perform an operation on a saved session or tab rather than having to open the separate window.)

For all those who really want this, I've prepared some lines to be added to your userChrome.js - get them at the Download section in the first post (just note that that code isn't as well tested and might not be as well supported).
Locked