Skip to content

Commit

Permalink
feat:[#358] add custom reboot and close commands
Browse files Browse the repository at this point in the history
- add recipe keys for reboot and close commands
- call custom commands with subprocess instead hardcoded commands
- add recipe keys to example
  • Loading branch information
jardon committed Oct 27, 2024
1 parent 2e5726a commit dd866df
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions recipe.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -615,5 +615,7 @@
]
}
},
"close_command": "gnome-session-quit --no-prompt",
"reboot_command": "gnome-session-quit --reboot",
"reboot_condition": "false"
}
2 changes: 2 additions & 0 deletions recipe.json
Original file line number Diff line number Diff line change
Expand Up @@ -584,5 +584,7 @@
]
}
},
"close_command": "gnome-session-quit --no-prompt",
"reboot_command": "gnome-session-quit --reboot",
"reboot_condition": "false"
}
4 changes: 2 additions & 2 deletions vanilla_first_setup/views/done.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,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:
Expand All @@ -113,7 +113,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()

Expand Down

0 comments on commit dd866df

Please sign in to comment.