From 47a22311bbbb0c6e6f0e85e94a8335e1fb3d6614 Mon Sep 17 00:00:00 2001 From: cyberarm Date: Wed, 22 Dec 2021 18:35:41 -0600 Subject: [PATCH] Show confirmation dialog when trying to close window when the app manager is #busy? --- lib/window.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/window.rb b/lib/window.rb index 01025e0..f66b0a7 100644 --- a/lib/window.rb +++ b/lib/window.rb @@ -38,7 +38,19 @@ class W3DHub def close Store.settings.save_settings - super if Store.application_manager.idle? + current_state_options = current_state&.instance_variable_get(:@options) + + if Store.application_manager.idle? || current_state_options&.dig(:tag_as) == :closer + super + else + push_state( + States::ConfirmDialog, + tag_as: :closer, + title: I18n.t(:app_name), + message: "An application management task is currently running, are you sure you want to exit?", + accept_callback: method(:close!) + ) + end end def manage_update_interval