From b6a4f70ec9512821bc2135f6b449d0e5182eb88b Mon Sep 17 00:00:00 2001 From: En-Jan Chou Date: Tue, 14 Jan 2020 16:39:00 -0500 Subject: [PATCH] Handle close request event for main window When receiving close request event, main window should quit program if there is no system tray available, and just like the close button was clicked. The window close request event happens when user close window by pressing alt-f4 (Gnome) or when receiving WM_DELETE_WINDOW xwindow event. Current behavior is just close the window and let the program keep running, and there is no way to quit program without system tray. --- .../cryptomator/ui/mainwindow/MainWindowTitleController.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main/ui/src/main/java/org/cryptomator/ui/mainwindow/MainWindowTitleController.java b/main/ui/src/main/java/org/cryptomator/ui/mainwindow/MainWindowTitleController.java index 573a835ff..2d08f5d19 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/mainwindow/MainWindowTitleController.java +++ b/main/ui/src/main/java/org/cryptomator/ui/mainwindow/MainWindowTitleController.java @@ -57,6 +57,9 @@ public class MainWindowTitleController implements FxController { window.setX(event.getScreenX() - xOffset); window.setY(event.getScreenY() - yOffset); }); + window.setOnCloseRequest(event -> { + close(); + }); } @FXML