From f796a720577ed209e709a9c69c2ea054a99f323f Mon Sep 17 00:00:00 2001 From: Devil-of-Chaos Date: Thu, 13 Jan 2022 17:17:45 +0100 Subject: [PATCH] Add Ability to Use Custom Service (#418) * Custom Servive * Custom Service * Update system.py * Update Configuration.md --- docs/Configuration.md | 3 +++ ks_includes/defaults.conf | 1 + panels/system.py | 2 +- screen.py | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/Configuration.md b/docs/Configuration.md index 366cbd6a..7dd57d63 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -33,6 +33,9 @@ language: en # Allows the cursor to be displayed on the screen show_cursor: False + +# Allows to define custom systemctl command for restart like xrdp +service: KlipperScreen ``` ## Printer Options diff --git a/ks_includes/defaults.conf b/ks_includes/defaults.conf index 8983083a..f58147bc 100644 --- a/ks_includes/defaults.conf +++ b/ks_includes/defaults.conf @@ -1,6 +1,7 @@ [main] moonraker_host: 127.0.0.1 moonraker_port: 7125 +service: KlipperScreen [preheat PLA] bed = 40 diff --git a/panels/system.py b/panels/system.py index 2bff8a90..f91ad457 100644 --- a/panels/system.py +++ b/panels/system.py @@ -399,4 +399,4 @@ class SystemPanel(ScreenPanel): self._screen._ws.klippy.restart() def restart_ks(self, widget): - os.system("sudo systemctl restart KlipperScreen") + os.system("sudo systemctl restart %s" % self._config.get_main_config_option('service')) diff --git a/screen.py b/screen.py index d382bf93..ae6525dd 100644 --- a/screen.py +++ b/screen.py @@ -435,7 +435,7 @@ class KlipperScreen(Gtk.Window): def restart_ks(self, widget, response_id): if response_id == Gtk.ResponseType.OK: logging.debug("Restarting") - os.system("sudo systemctl restart KlipperScreen") + os.system("sudo systemctl restart %s" % self._config.get_main_config_option('service')) widget.destroy() def init_style(self):