Merge pull request #844 from vssdeo/843-Plugin-SaveLastSessionLayout-not-saving-layout-when-user-logs-out-or-shutdown-or-restart

[bug 843] 843-Plugin-SaveLastSessionLayout-not-saving-layout-when-use…
This commit is contained in:
Matt Rose 2024-02-17 10:19:03 -05:00 committed by GitHub
commit 67e9f3c5c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,4 +1,5 @@
import os
import signal
import sys
# Fix imports when testing this file directly
@ -44,9 +45,21 @@ class SaveLastSessionLayout(plugin.Plugin):
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)