diff options
-rw-r--r-- | src/redshift-gtk/statusicon.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/redshift-gtk/statusicon.py b/src/redshift-gtk/statusicon.py index 8bcc572..c4cc70e 100644 --- a/src/redshift-gtk/statusicon.py +++ b/src/redshift-gtk/statusicon.py @@ -52,8 +52,9 @@ class RedshiftStatusIcon(object): self._period = 'Unknown' self._location = (0.0, 0.0) - # Install TERM signal handler + # Install TERM/INT signal handler signal.signal(signal.SIGTERM, sigterm_handler) + signal.signal(signal.SIGINT, sigterm_handler) # Start redshift with arguments args.insert(0, os.path.join(defs.BINDIR, 'redshift')) @@ -183,6 +184,12 @@ class RedshiftStatusIcon(object): GLib.io_add_watch(self.process[3], GLib.PRIORITY_DEFAULT, GLib.IO_IN, self.child_data_cb, (False, self.error_buffer)) + # Signal handler to relay USR1 signal to redshift process + def relay_signal_handler(signal, frame): + os.kill(self.process[0], signal) + + signal.signal(signal.SIGUSR1, relay_signal_handler) + # Notify desktop that startup is complete Gdk.notify_startup_complete() |