Skip to content

Commit

Permalink
[bug 843] 843-Plugin-SaveLastSessionLayout-not-saving-layout-when-use…
Browse files Browse the repository at this point in the history
…r-logs-out-or-shutdown-or-restart #843

- fixed Plugin SaveLastSessionLayout not saving layout when user logs out or shutdown or restart
- signals added
  • Loading branch information
vssdeo committed Oct 17, 2023
1 parent 6d225c7 commit 9000327
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions terminatorlib/plugins/save_last_session_layout.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import signal
import sys

# Fix imports when testing this file directly
Expand Down Expand Up @@ -44,9 +45,21 @@ def save_session_layout(self, debugtab=False, widget=None, cwd=None, metadata=No
r = config.add_layout("SaveLastSessionLayout", current_layout)
config.save()
return True

def signal_handler(self,signum, frame):

signame = signal.Signals(signum).name
dbg('signal handler called:signal %s (%s)' %
(signame, signum))
self.save_session_layout()

def connect_signals(self):
dbg("SaveLastSessionLayout connect_signals")

signal.signal(signal.SIGTERM, self.signal_handler)
signal.signal(signal.SIGCHLD, self.signal_handler)
signal.signal(signal.SIGHUP, self.signal_handler)

n = 0
for term in Terminator().terminals:
dbg("SaveLastSessionLayout connect_signals to term num:(%d)" % n)
Expand Down

0 comments on commit 9000327

Please sign in to comment.