From 429b2d47fc0680107f6e2391230671418fb9b2c9 Mon Sep 17 00:00:00 2001 From: YangKeao Date: Wed, 11 Apr 2018 22:12:47 +0800 Subject: [PATCH] app: Add --quit command line option Polari can be quit by either selection "Quit" from the app menu, or by running `gapplication action org.gnome.Polari quit`. As the former is inconvenient when polari is running in the background, make the latter more accessible by exposing it as `polari --quit`. https://gitlab.gnome.org/GNOME/polari/issues/20 --- src/application.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/application.js b/src/application.js index 300d099d..ed985dbb 100644 --- a/src/application.js +++ b/src/application.js @@ -51,6 +51,9 @@ var Application = GObject.registerClass({ this.add_main_option('version', 0, GLib.OptionFlags.NONE, GLib.OptionArg.NONE, _("Print version and exit"), null); + this.add_main_option('quit', 0, + GLib.OptionFlags.NONE, GLib.OptionArg.NONE, + _("Quit Polari"), null) this.connect('handle-local-options', (o, dict) => { let v = dict.lookup_value('test-instance', null); if (v && v.get_boolean()) @@ -74,6 +77,12 @@ var Application = GObject.registerClass({ return 0; } + v = dict.lookup_value('quit', null); + if (v && v.get_boolean()) { + this.activate_action('quit', null); + return 0; + } + return -1; }); } -- GitLab