From 44963e8360c6e1807ec26f95d8b69bb6d0ed180c Mon Sep 17 00:00:00 2001 From: Jarred Wilson Date: Fri, 25 Oct 2024 22:26:40 +0000 Subject: [PATCH] feat:[#358] add custom reboot and close commands - add recipe keys for reboot and close commands - call custom commands with subprocess instead hardcoded commands - add recipe keys to example --- recipe.example.json | 2 ++ recipe.json | 2 ++ vanilla_first_setup/views/done.py | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/recipe.example.json b/recipe.example.json index 33294eb2..76a7a090 100644 --- a/recipe.example.json +++ b/recipe.example.json @@ -615,5 +615,7 @@ ] } }, + "close_command": "gnome-session-quit --no-prompt", + "reboot_command": "gnome-session-quit --reboot", "reboot_condition": "false" } \ No newline at end of file diff --git a/recipe.json b/recipe.json index fc9f207b..4beeeb34 100644 --- a/recipe.json +++ b/recipe.json @@ -584,5 +584,7 @@ ] } }, + "close_command": "gnome-session-quit --no-prompt", + "reboot_command": "gnome-session-quit --reboot", "reboot_condition": "false" } diff --git a/vanilla_first_setup/views/done.py b/vanilla_first_setup/views/done.py index 2db90d9a..c0036acb 100644 --- a/vanilla_first_setup/views/done.py +++ b/vanilla_first_setup/views/done.py @@ -98,7 +98,7 @@ def set_result(self, result, terminal=None): self.btn_close.set_visible(True) def __on_reboot_clicked(self, *args): - subprocess.run(["gnome-session-quit", "--reboot"]) + subprocess.run(self.__window.recipe["reboot_command"].split()) def __on_close_clicked(self, *args): if self.__init_mode == 1: @@ -109,7 +109,7 @@ def __on_close_clicked(self, *args): flags=GLib.SpawnFlags.SEARCH_PATH, ) else: - subprocess.run(["gnome-session-quit", "--no-prompt"]) + subprocess.run(self.__window.recipe["close_command"].split()) self.__window.close()