From 80b3a82963ff1a1501c9d07326814f79f1bb7488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marta=20Marczykowska-G=C3=B3recka?= Date: Thu, 12 Jul 2018 22:47:02 +0200 Subject: [PATCH] Add option to turn off computer after backup to Backup GUI A simple checkbox to turn off the computer after backup finishes successfully. It is off by default and must be switched on every time (unexpected system shutdowns are a huge pain, much more problematic than forgetting to shut down can be). fixes QubesOS/qubes-issues#2039 --- qubesmanager/backup.py | 6 ++++++ ui/backupdlg.ui | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/qubesmanager/backup.py b/qubesmanager/backup.py index 1d4d6a6..83ff05e 100644 --- a/qubesmanager/backup.py +++ b/qubesmanager/backup.py @@ -348,6 +348,12 @@ class BackupVMsWindow(ui_backupdlg.Ui_Backup, multiselectwidget.QtGui.QWizard): self.button(self.FinishButton).setEnabled(True) self.showFileDialog.setEnabled(False) self.cleanup_temporary_files() + + # turn off only when backup was successful + if self.thread_monitor.success and \ + self.turn_off_checkbox.isChecked(): + os.system('systemctl poweroff') + signal.signal(signal.SIGCHLD, old_sigchld_handler) def reject(self): diff --git a/ui/backupdlg.ui b/ui/backupdlg.ui index dc86b73..f4b0a0d 100644 --- a/ui/backupdlg.ui +++ b/ui/backupdlg.ui @@ -310,6 +310,28 @@ + + + + + 0 + 0 + + + + Other + + + + + + Turn computer off after backup is finished + + + + + +