Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin Submission : SaveLastSessionLayout Uses Layout to Auto-Save Last session and CWD on Terminal Window Close #654

Closed
vssdeo opened this issue Oct 16, 2022 · 10 comments

Comments

@vssdeo
Copy link
Contributor

vssdeo commented Oct 16, 2022

This is my first major submission so excuse any short comings, I am submitting a Plugin that saves Last Session including Current Working Directory automatically and on next Launch the use can you the Context Menu (Right Click)->Layouts to launch the saved Session.

(1) IMPORTANT: This would require a minor bug fix which I have reported due to which layouts are incorrectly loaded Ref: vssdeo@e7f9c73 If you don't have any other saved Layouts the plugin will still work.

(2) The Plugin uses existing Layout mechanism and uses the name: SaveLastSessionLayout in layouts also visible via "Preferences"->Layouts and behaves naturally. You can override etc.

(3) How to Use
a) Launch ./terminator
b) Go to Preferences->Plugins->SaveLastSessionLayout and (tick to enable)
c) Now you can open new tabs and change directory etc
d) When you close your main window (with all the tabs and others) this layout would be saved.
e) Next launch ./terminator and using Context Menu(right click)->Layouts->SaveLastSessionLayout you can reload the saved session
f) NOTE: the layout of last closed window will be saved for next time so ensure that that window is closed last

(4) On development part there were a few choices:

First one was to use existing event close-term and would not have required touching the main code,which I wanted but in case of single window(terminal) it was causing edge case where I was not able to get the describe_layout section to save. With this option the code would have saved the session for multiple tabs but for a single window(term) it wouldn't have remembered the layout.

Second option was to add single line changes to introduce a pre-close-term event and the behavior would have been consistent.
For now I have chosen the second option but the code for first option is also in but commented.

Since I am new to this, any suggestions would be welcome.

@vssdeo
Copy link
Contributor Author

vssdeo commented Oct 16, 2022

@mattrose
Copy link
Member

This is merged. I'm keeping the bug open now because it doesn't completely work for me.

@vssdeo
Copy link
Contributor Author

vssdeo commented Oct 30, 2022

Hi @mattrose thanks for update. I didn't expect such a quick merge and great support from the team :) so was awaiting any discussion.

Just a note from above comment 3) How To Use point f) NOTE: the layout of last closed window will be saved for next time so ensure that that window is closed last.

a)So when there is a single window and multiple tabs, then config file should be appended appropriately.
b)On next launch you would need to launch and right click and select last saved session.
c)The main confusion (for which I wanted feedback) was if there are multiple windows and one has multiple tabs which you want to save, just ensure that the one with multiple-tabs is closed last.

In any case pls do let me know the steps you are taking to test so I will also cross check on my side.

@vssdeo
Copy link
Contributor Author

vssdeo commented Oct 30, 2022

Hi @mattrose. It was my bad, I just checked, it seems I had not pushed the changes that involved the (second-option) above in first comment of adding an additional signal pre-close-term as I was waiting for someone from team to check.

It was my bad, sorry for the inconvenience. Should work after the pull again.

@mattrose
Copy link
Member

This is fixed by #655

@hamzamerzic
Copy link

Wow, this is amazing - thank you so much for adding this! I would like to enable this in my setup, but am not very familiar with working with terminator plugins. Is there a simple way to include this one in to my existing setup, or would I need to build terminator from scratch? I'm on version 2.1.1. with GNOME Linux.

@vssdeo
Copy link
Contributor Author

vssdeo commented Nov 9, 2022

Hi

Please see the first comment (3) How to Use should be quite simple. Terminator is in python so a clone of master branch and running ./terminator should suffice.

Let me know if anything else.

@hamzamerzic
Copy link

Amazing, thanks for the quick reply! I'll try that. OOC, do you know if it's possible to add this plugin to the existing terminator setup, so that I am not locked into this version of terminator? I would assume terminator allows an option to import plugins.

@vssdeo
Copy link
Contributor Author

vssdeo commented Nov 9, 2022

The issue is that a minor change was brought to the main tree by adding a signal to keep the code change minimal and consistent behavior, (read comment 1). So for the plugin to work you would require a latest code base for terminator.

@hamzamerzic
Copy link

Makes sense - thanks again, really appreciate it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants