Session Manager [v7.00]  —  Bookmark your environments: locations and/or display (tabsets and layout)

Discuss and share scripts and script files...
FluxTorpedoe
Posts: 855
Joined: 05 Oct 2011 13:15

Re: Session Manager [v6.90]

Post by FluxTorpedoe »

 
#####################
###  Session Manager v6.90  ###
#####################



Hi everyone,

Here’s a new version. Some of its highlights:
— Append another session tabs to the current panes (appended tabs will have a grey background)
      — Either Shift+Click on a session name in Session Manager main session list
      — or Options > Append Tabs of Another Session...
— Session name in button: Session Manager toolbar button can now display the name of the active session
      It will do so only with XYplorer version >= 22.90.0107, and if:
      1. the session has no custom icon defined
      2. the new option "Display Generic Icon (Instead of Session Name)..." is OFF (default setting)
— Blacklist for AutoUpdate All: Sessions can now be excluded from this autoupdate by adding them to a blacklist
      Options > AutoUpdate All: Edit Blacklist of Sessions to Exclude from AutoUpdate...

See full changelog below for more info.

As a sidenote, Session Manager has reached another milestone, with more than 4000 lines of code! ;)

Have a nice day! 8)
   Flux

———————————————————————————

• DOWNLOADS:   Require XYplorer ≥ 19.90.0106 (previous versions available in Changelog)

› Script:
SessionManager.xys
(195.09 KiB) Downloaded 217 times
› Script in UTF-16 LE: (Special version for foreign languages who encounter "invalid character" issues)
SessionManager-UTF16.zip
(47.78 KiB) Downloaded 155 times
› Languages:
   Don’t forget to come back here to check when language files are updated.
   Installation: Just copy the (extracted) language file (eg. SessionManager.it) in the same folder as the script itself (SessionManager.xys).
   Note: All the following files work with Session Manager latest version (untranslated strings will just be displayed in English).
 — Čeština by Hogatyv6.50+
 — Dansk by Regmosv6.50+
 — Italiano by Flora_RMCv6.90+
 — Deutsche by Dean36v6.60
 — Português (Brasil) by SkyFrontierv5.2+
 — Français by pseudozv4.b1+
 — 中文 by Haodeav6.80+

———————————————————————————

• REQUIREMENTS:
 — XYplorer >= 19.90.0106 (Recommended: XYplorer version >= 22.90.0107)

• INSTALLATION » for first-time users:
 — Please refer to first post

• UPDATE » for all users:
 — Overwrite your existing "SessionManager.xys" file with latest version
 — Recommended if updating from < 5.73: Update your layout sessions and default layout (and default toolbar if applicable)
   ☛ Session Manager > "Layout tools" > "Update Default Layout" + "Update Default Toolbar"
   ☛ For each layout session > "Update Session (and Layout)"

• UPDATE » for non-english users:
 — Also download one of the language files and extract it into the same folder as SessionManager.xys (language detection is automatic)

———————————————————————————

• CHANGELOG – v6.90:
+++ Append another session tabs to the current panes (appended tabs will have a grey background)
      — Either Shift+Click on a session name in Session Manager main session list
      — or Options > Append Tabs of Another Session...
      Note: Appended tabs will only load paths (without custom column order or size)
+++ Session name in button: Session Manager toolbar button can now display the name of the active session
      It will do so only with XYplorer version >= 22.90.0107, and if:
      1. the session has no custom icon defined
      2. the new option "Display Generic Icon (Instead of Session Name)..." is OFF (default setting)
      Note: To have the button always display the session name, all custom icons must be removed (see below)
+ New menu entry: Options > Button: Display Generic Icon (Instead of Session Name) If No Custom Icon Defined
+ If session is invalid, button will display an "Invalid Session" text or "?" icon (depending on previous setting)
+ New action: Options > Change Icon of Sessions... > Select This to Remove Icons From All Sessions...
++ Blacklist for AutoUpdate All: Sessions can now be excluded from this autoupdate by adding them to a blacklist
+ New menu entry: Options > AutoUpdate All: Edit Blacklist of Sessions to Exclude from AutoUpdate...
* Unified (and mostly enlarged) size of some dialog windows
! Fixed bug when last session may not be visible in some lists if there was a corruption in panes folder

• CHANGELOG – all versions:
Don’t hesitate to browse the exhaustive changelog (with download links to previous versions) here: • Session Manager Changelog •

———————————————————————————

• TRANSLATORS:
 — New contributions are more than welcome!
 — please head to the dedicated post on the ML forum for the changelog and latest english language file
Last edited by FluxTorpedoe on 19 May 2022 16:05, edited 1 time in total.

autocart
Posts: 1246
Joined: 26 Sep 2013 15:22

Re: Session Manager [v6.90]

Post by autocart »

Thank you, Flux, for the update.
Great ideas! Thank you for your invested time and energy.

If I may give some candid but well meant feedback:

Session's Caption in button
Nice idea. So far, it seems to have some graphical glitches when first loading the new script version and when enabling the option "Button: Display Generic Icon ...". A session change seems necessary to update the button correctly. This is just a small thing, but it is there so I feedback it.

Appending another session's tabs to the current session
Also a very nice idea. Still, after a first test I feel that, although it has real potential, it is not 100 % matured yet. It does not feel really intuitive atm. E.g. the tabs are really only appended, nothing else. No further "smartness" behind it. That is ok, but it should be explained more clearly that there is no connection anymore between those appended or "inserted" tabs and the session where they came from.

And it seems to have unwanted side effects. E.g. I mostly work with just one pane and autosave. When I append another session's tabs, remove them again (which seems it can only be done manually tab by tab) and then append those (or other) tabs again, the 2nd-pane-tabs of the (re-)appended sessions never get removed from the other pane and start accumulating there.

Maybe if only those tabs of the other session that belong to the currently visible panes were appended? I.e. if I have only pane 1 visible, then only pane 1 tabs get appended. Same for pane 2. If I have both panes visible, the tabs of both panes get appended.
Maybe an option for whether such appended tabs get saved with the current session or not would make that feature even better?
Or maybe they never get saved but there could be an option to "transfer" any such "appended tabs" into "normal current session tabs" (then they would change color to normal and also get saved)?


Additional thoughts (beyond the new version feedback)

Loading sessions with catalog items (potentially in a new XY window)
Other than that, I started adding some of my most used sessions to the catalog with the following script in the location field:

Code: Select all

$catalogItemCaption = self("caption");
 $lengthSessionName = strpos($catalogItemCaption, " (+=new window)");
 if ($lengthSessionName >= 0) {
  $sessionName = substr($catalogItemCaption, , $lengthSessionName);
 }
 else {
  $sessionName = $catalogItemCaption
 }

 if (<get "Shift"> == 2) {
  run "<xy> /new /script=""::global $DYN_InpSess = '" . $sessionName . "'; load 'SessionManager.xys', '_Load';""";
 }
 else {
  global $DYN_InpSess = $sessionName;
  load 'SessionManager.xys', '_Load';
 }
With a normal left click it loads the corresponding session in a normal way in the same XY window/instance and a Control-left click (on the catalog item) would open them in a new XY window/instance. The beauty is that the catalog's item's caption is reused for choosing which session to load. Thus, for a new such catalog item loading a different session, all I have to do is duplicate the item and change the item's caption. Done. I also added " (+=new window)" in the catalog's item's caption as a reminder. So each catalog item caption, in the case of this script should either be "SESSIONNAME (+=new window)" or just "SESSIONNAME".
But that append feature might save me from opening some new windows/instances in the future.


A small tiny "bug" with reusing the load function on one's own
When the session name is fed to the load function with wrong captions, e.g. "Project" instead of "project", then it does load fine but the "current session mark/emphasis" in the list of sessions does not work.

And finally, a hint for all SessionManager users - Keyboard shortcut for SessionManager :party:
Adding a new user command "Run Script" with the button's own short script line load "SessionManager.xys"; allows adding a keyboard shortcut and then it will - at the press of a key - always pop-up at the mouse pointer's position.
Probably y'all figured this out many stone ages ago allready. But I just now had this amazing idea. Loving it.

Regards

autocart
Posts: 1246
Joined: 26 Sep 2013 15:22

Re: Session Manager [v6.90]

Post by autocart »

Ran into a problem:
When trying different keyboard shortcuts for SessionManager, I tried Alt+s to open the main menu with load "SessionManager.xys"; and stumbled across this "bug"(?):
A key popped ....png
A key popped ....png (5.64 KiB) Viewed 4831 times
Any ideas?

FluxTorpedoe
Posts: 855
Joined: 05 Oct 2011 13:15

Re: Session Manager [v6.90]

Post by FluxTorpedoe »

Hi autocart,

Thanks for the feedback!

⮞ Session's Caption in button / Button not correctly updated the first time after toggling "Options > Button: Display Generic Icon..."
Damn, I had the fix in place but not updated… 🙈 Will be fixed in next version.

⮞ Appending another session's tabs: ~smartness / Duplicates (especially if appending again)
Preventing duplicates makes sense…
Next version: Only non-duplicate tabs will be appended.

⮞ Appending another session's tabs: ~smartness / To the currently visible pane
Makes sense too!
Next version: Tabs will be appended only to the visible pane(s).

⮞ Appending another session's tabs: Explanations
Next version: The dialog (in Options > Append Tabs…) will start with "Only non-duplicate tabs will be added to the visible pane(s)".

⮞ Appending another session's tabs: Even more ~smartness?
Now, I’m not sure it can/should be much smarter than that. This function is intentionally bare-bones, because tending to "merge" sessions would otherwise lead to too many possibilities (which one is updated, or a new session must be saved, and what if one has a layout but not the other, one in dual pane but not the other, one has deliberately duplicate tabs, etc.)
That being said, if you have a specific idea, I’m all ears! :)

⮞ Externally loading a session using a different case for its name (eg. Project instead of project)
I didn’t see this one coming! Fixed in next version.

Hint
Yep, nice to have Session Manager main menu pop-up wherever you want!
I hope you also know of the "Quick Load" feature, eg. to quickly load your session "Project", press eg. $ then p — and bang you’re done!
(More info in Options > Help: Cheat Sheet… > • Load/Switch sessions via Quick Load dialog)

Dialog "A key popped up… accelerator"
I’m not sure this can be avoided (although someone else might know a way around this behavior).
Alt is Windows default key for accelerators in menus. So with a QWERTY keyboard, assigning Alt+S would display Session Manager main menu and also select "Save Session As..." (the first entry starting with S). So, depending on your keyboard layout (and on the chosen key), XY might think that you're trying to do too many things at once, and will pop up this dialog instead.

WirlyWirly
Posts: 195
Joined: 21 Oct 2020 23:33
Location: Through the Looking-Glass

Re: Session Manager [v6.90]

Post by WirlyWirly »

Not a deal-breaker, but there's a bug that I've been experiencing since I first started using Session Mamager: whenever I go to file|save settings, my current session's tabs are reset.

When I next load that session it will only display a single tab in each pane, as if the tabsets are overwritten by save settings.

To avoid this I need to load the session, file|save settings, and then update session. If I forget to do this then I need to manually re-open the tabs and update session.

Just curious what I might be doing wrong and how to avoid losing my active session whenever I save settings.
Last edited by WirlyWirly on 02 May 2022 20:31, edited 1 time in total.

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: Session Manager [v6.90]

Post by klownboy »

autocart wrote: 02 May 2022 17:14 a hint for all SessionManager users - Keyboard shortcut for SessionManager
Adding a new user command "Run Script" with the button's own short script line load "SessionManager.xys"; allows adding a keyboard shortcut and then it will - at the press of a key - always pop-up at the mouse pointer's position.
If the user is simply running SessionManager's menu and not load a specific session, it's probably easier to use "Load Script file" category in a UDC instead of "Run script". You can put the script file alone in the "Script file" block without the need for SC load. If you are loading a specific session, you'd want to use "Run script" category like global $DYN_InpSess = "Normal"; load "SessionManager.xys", "_Load";

Thanks Flux for another nice update and continuing to work on your script. :tup: :appl:
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

FluxTorpedoe
Posts: 855
Joined: 05 Oct 2011 13:15

Re: Session Manager [v6.90]

Post by FluxTorpedoe »

@Ken
Thanks ;)

—————————

@WirlyWirly
⮞ TL;DR: Have you checked Session Manager menu: Options > AutoUpdate All: Update Every Session on Session Change

⮞ Long version:
Hum… I’m missing some info here.
If I understand correctly, these are the steps:
   1. Load session, eg. MySession
   2. Modify it somehow (eg. add or remove tabs…)
   3. Save XYplorer settings
   4. ?
   5. Reload session MySession ⇒ modifications are lost

• The remaining question is double:
   — Q1. Why reload the session at step 5?
   — Q2. What happens at step 4?

A reason I can think of that answers Q1 & Q2 is that you have loaded another session in step 4, and you expect the XYplorer "Save Settings" to also have updated your original session (eg. "MySession").

• Solutions:
   > If you haven’t loaded another session in step 4, there’s no need to reload your original session. Next time XYplorer is launched, it will resume exactly where it was.
   > If indeed you have loaded another session in step 4, then in Session Manager menu, check the AutoUpdate option that suits you best (don’t hesitate to ask if you have any question)
   > If you do not want to use any kind of autoupdate, but only want to update the active session whenever you use XYplorer Save Settings, add a user script in XYplorer menu User > Manage Commands… > Run Script > New
   type in the following script:
   load "SessionManager.xys", "_Update"; #182;
   and assign a keyboard shortcut (eg. Ctrl+S).
   Next time you press Ctrl+S, the current session will be updated, and XYplorer settings will be saved.

WirlyWirly
Posts: 195
Joined: 21 Oct 2020 23:33
Location: Through the Looking-Glass

Re: Session Manager [v6.90]

Post by WirlyWirly »

FluxTorpedoe wrote: 03 May 2022 15:22 @WirlyWirly
...
No the auto update session option is not enabled.

I'm not making any changes to Session Manager or my current session/tabsets.

If I change an option in the XYPlorer Configuration, edit the toolbar buttons, or adjust any other XYplorer setting and then save those changes using "File|Save Settings" from the main menu, the current session gets reset. The next time I load that session all my tabs are lost. I'm not clicking anything in Session Manager, only using the Main Menu of XY to save settings.

It's like using Save Settings resets the current tabsets that I saved using Session Manager.

autocart
Posts: 1246
Joined: 26 Sep 2013 15:22

Re: Session Manager [v6.90]

Post by autocart »

WirlyWirly wrote: 04 May 2022 01:25
FluxTorpedoe wrote: 03 May 2022 15:22 @WirlyWirly
...
No the auto update session option is not enabled.

I'm not making any changes to Session Manager or my current session/tabsets.

If I change an option in the XYPlorer Configuration, edit the toolbar buttons, or adjust any other XYplorer setting and then save those changes using "File|Save Settings" from the main menu, the current session gets reset. The next time I load that session all my tabs are lost. I'm not clicking anything in Session Manager, only using the Main Menu of XY to save settings.

It's like using Save Settings resets the current tabsets that I saved using Session Manager.
Just as a "help" for bug hunting: I tried to reenact that scenario with a test session but my session does not get reset. All as expected here. Sorry.

FluxTorpedoe
Posts: 855
Joined: 05 Oct 2011 13:15

Re: Session Manager [v6.90]

Post by FluxTorpedoe »

Indeed, I don’t see how clicking XYplorer "File > Save Settings" could _visually_ change anything (apart from the status bar update).

We’re definitely missing step 4…
I tried to understand what could happen, and my guess is that at this step, between the "Save Settings" and the session that gets "reset", you close and reopen XYplorer?
Also, by this "reset", do you mean that all tabs are gone and there’s only a single tab (by pane) opened?

In that case, I think I might have found the culprit(s).
⮞ The two following settings must be checked/enabled (note that they’re ON by default):
Tools > Configuration > General | Startup & Exit > Save Settings |
   — Include most-recently-used lists on save: ON
   — Apply to… > Tabs: ON

FYI, in this same "Apply to…" dialog, "Tabsets" can be either ON or OFF (it’s only related to their MRU, no impact on tabsets data or Session Manager).

——————

Edit:   @WirlyWirly & @all
While trying to figure out what was happening, I discovered a kind of "bug" (say, a discrepancy) in XYplorer, related to tabsets management and Save Settings : Tests made from blank versions of XYplorer behaved differently than with existing versions.

In new versions, closing XYplorer updates the current session! (i.e. Tabsets are now overwritten when settings are saved.)
Which means that Session Manager "Reset Session" doesn’t work anymore after a restart (or a save)…

I finally managed to isolate the problem:
There has been a change in march 2019 with a tweak that preserves the original behavior for updaters (so, everyone using XY before 2019), but enables the new behavior for new users…
Changelog: XYplorer v19.80.0131 - 2019-03-30 13:55 - Tabsets…
More info about this later… (Until I figured out how to take this into account with Session Manager.)

WirlyWirly
Posts: 195
Joined: 21 Oct 2020 23:33
Location: Through the Looking-Glass

Re: Session Manager [v6.90]

Post by WirlyWirly »

@FluxTorpedoe

Yes, when I say reset I meant that there would only be 1 tab per pane, all the others would be lost. I wasn't closing/restarting XY, I was simply clicking Save Settings.

Also, thanks for looking into it, I didn't start using XY until late 2020, so I just checked my .ini and saw that the new tweak from 2019 was disabled in my installation.

I enabled the tweak and it has fixed my issue. When I Save Settings it doesn't reset my tabsets anymore.

Code: Select all

TabsetsCanRevertAcrossSessions=1
I'm not completely sure what the pre-2019 behavior was, so until I notice a negative affect I'll leave this tweak enabled, that way I can use Session Manager as intended.

Thanks again, this has been a long-standing issue for me that I dealt with almost daily. I'm happy to get rid of it :party:

P.S
One thing I did notice is that before enabling the tweak, my startup session was always the one I named "Default". I liked it that way and I thought SessionManager was responsible for that. However, now when I start XY it will open with whatever session I had enabled before I clicked Save Settings. Not a deal breaker, I just have to make sure my "Default" session is loaded before I save settings, but just thought I'd mention it.

FluxTorpedoe
Posts: 855
Joined: 05 Oct 2011 13:15

Re: Session Manager [v6.90]

Post by FluxTorpedoe »

@WirlyWirly
Very glad to know it’s fixed and working well for you now!
And thanks to your feedback, an important piece of info was brought to light…
To try and overcome this issue, I’ll add some code and a dedicated option in the next version of Session Manager.

> I'm not completely sure what the pre-2019 behavior was
Previously, tabsets were only saved when, well, you told them to be saved. ;-)
i.e. via XY menu Tabsets, via scripting (like with Session Manager), commands, etc.
Of course, the active tabsets were still "remembered" when XYplorer was closed and reopened, but they weren’t forcibly updated, so you could still reset them / load their last saved state. Not possible with the new behavior.

> my startup session was always the one I named "Default"
Maybe this is what you’re after (although there may be other ways).
I’ll write it for everyone:

 ———————————————————————————


      •••   Session Manager Missing Manual – Starting XYplorer with a specific session   •••


1. Identify the name of your session, eg "Session Name"
2. Edit and copy this command:

Code: Select all

global $DYN_InpSess = "Session Name"; load "SessionManager.xys", "_Load";
   Now, either:
3a. Tell XYplorer to run this script on exit. (Benefit: it will launch as fast. Drawback: it will be slower to close.)
   or
3b. Tell XYplorer to run this script on startup. (Benefit: it will close as fast. Drawback: it will be slower to fully launch.)

>>>

3a. In XYplorer, menu Tools > Configuration > General | Custom Event Actions > Other Events | Exit
 > Action:   Run Script
 > Script:   global $DYN_InpSess = "Session Name"; load "SessionManager.xys", "_Load";
 > OK

3b. Method 1 (XYplorer >= v23.10.0009): In XYplorer, menu Tools > Configuration > General | Custom Event Actions > Other Events | Startup
 > Action:   Run Script
 > Script:   global $DYN_InpSess = "Session Name"; load "SessionManager.xys", "_Load";
 > OK

3b. Method 2 (All versions): Create a shortcut to XYplorer > Right-click on it > Properties > Tab: Shortcut
 > Target: 

Code: Select all

"<Path To XYplorer>\XYplorer.exe" /script=|::global $DYN_InpSess = "Session Name"; load "SessionManager.xys", "_Load";|
   Important: after   /script=   the whole command is enclosed in pipes "|"

Malarki
Posts: 109
Joined: 03 Dec 2019 02:51

Re: Session Manager [v6.90]   —   Bookmarks of tabs and/or layouts

Post by Malarki »

I run Session Mgr as one of a list of scripts. This list is created by "User | Manage User-Defined Commands | Load Script File". (I do that because I've already got so many under "Run Script").

There are about 8 scripts on this list. SM is in the first position.

This UDF is attached to a toolbar button which has a generic icon "M". So when I hit that button, the list opens, and I can choose SM.

This has worked fine for years. But beginning with SM v6.90 there's a problem. When I open SM and choose a session, the "M" toolbar icon is often permanently replaced by the name of the session eg. "travel". If I open SM and choose "About Current Session", the toolbar icon is usually permanently replaced by "<Invalid Session">. To get the "M" icon back, I have to edit the toolbar button script.

When I revert to a Session Manager v6.80, there is no such problem.

I haven't done exhaustive testing because you may immediately figure out the cause. But if this seems a mystery I can do more on it. For one thing, I frequently update XY and this may be some kind of combo effect of the new SM and a new XY. I don't know when this started because I happened to not need SM for a couple of months and picked up many XY updates in the meantime. Now at 23.30.0100. So I could try earlier XYs, if you see nothing in SM, and maybe narrow it down.

I DO see that SM "Options" has "General: Display Session Name in Titlebar" but I didn't enable that. That sounds like what's happening, though.

Thanks for a great tool!

FluxTorpedoe
Posts: 855
Joined: 05 Oct 2011 13:15

Re: Session Manager [v6.90]   —   Bookmarks of tabs and/or layouts

Post by FluxTorpedoe »

Hi Malarki,

Hmmm, I’d never thought of this possibility: Session Manager being integrated with other scripts in a button that’s not its own!… :lol:

I think I understand pretty well what’s happening : since Session Manager does not have its own button, you’ve most probably not assigned icons to sessions. So —with v6.80 and prior—, the button icon was not updated on session change.
In v6.90, with an update of XYplorer that made it possible to display text as a button icon (and not only label), I introduced a feature that updates the button with the name of the active session (if no custom icon defined).
NB: Clicking on "About" was just performing a maintenance check and updating what should be, so "‹ Invalid Session ›" means that a session is not fully loaded (i.e. at least one tabset of a session is loaded but mixed with another tabset). [NB: I’d already replaced "invalid session" by "tabsets" in v7.00, felt less threatening.]

TLDR;
To prevent this and revert to the button behavior of v6.80, there’s an option in Session Manager menu
"Options > Button: Display Generic Icon (Instead of Session Name) If No Custom Icon Defined"

Note: Tabsets or invalid sessions will still change the icon to a question mark… I definitely hadn’t thought of your case… :ugeek:
I’ll find a way to resolve this elegantly with the upcoming Session Manager v7.00.
Note 2: "General: Display Session Name in Titlebar" is unrelated. But interesting nonetheless! FYI, it displays the session name in XYplorer main titlebar, above its menu. Incidentally, it has the benefit of also displaying it in Windows taskbar (since XYplorer main button displays the start of its titlebar).

———————————————————————————

@all
Indeed, a huge —like, huuuuuuge— update is coming with v7.00!
You can already have a peak at its changelog.
It’s mainly maintenance, to cover extreme case scenarios like this one ;) , but it also includes a few new/updated features.
So if you have bugs, nitpicks, or wishes, don’t hesitate!

Have a nice day, 8)

   Flux

Malarki
Posts: 109
Joined: 03 Dec 2019 02:51

Re: Session Manager [v6.90]   —   Bookmarks of tabs and/or layouts

Post by Malarki »

Thanks - enabling the option mentioned in TLDR (Button: Display Generic Icon) fixed it in v6.90. I had seen that but thought the other option was more germane, for some reason.

Also because I had trouble un-setting some option that I had set, so didn't want to introduce some other issue. I'm sorry that I cant' remember which option gave me trouble in that way. I'd just suggest testing set / unset in your next version.

Thanks for so much work on this. When I do use it, it saves a lot of tedious setup.

Post Reply