3131import org .springframework .context .ConfigurableApplicationContext ;
3232
3333import de .doubleslash .keeptime .common .FontProvider ;
34+ import de .doubleslash .keeptime .common .OS ;
3435import de .doubleslash .keeptime .common .Resources ;
3536import de .doubleslash .keeptime .common .Resources .RESOURCE ;
3637import de .doubleslash .keeptime .controller .Controller ;
@@ -167,7 +168,9 @@ private void initialiseApplication(final Stage primaryStage) throws Exception {
167168
168169 primaryStage .setOnHiding (we -> {
169170 popupViewStage .close ();
170- globalScreenListener .shutdown (); // deregister, as this will keep app running
171+ if (globalScreenListener != null ) {
172+ globalScreenListener .shutdown (); // deregister, as this will keep app running
173+ }
171174 });
172175
173176 initialiseUI (primaryStage );
@@ -217,11 +220,6 @@ private void readSettings() {
217220 private void initialisePopupUI (final Stage primaryStage ) throws IOException {
218221 LOG .debug ("Initialising popup UI." );
219222
220- globalScreenListener = new GlobalScreenListener ();
221-
222- model .useHotkey .addListener ((a , b , newValue ) -> globalScreenListener .register (newValue ));
223- globalScreenListener .register (model .useHotkey .get ());
224-
225223 popupViewStage = new Stage ();
226224 popupViewStage .initOwner (primaryStage );
227225 // Load root layout from fxml file.
@@ -240,7 +238,12 @@ private void initialisePopupUI(final Stage primaryStage) throws IOException {
240238 final ViewControllerPopup viewControllerPopupController = loader .getController ();
241239 viewControllerPopupController .setStage (popupViewStage );
242240
243- globalScreenListener .setViewController (viewControllerPopupController );
241+ if (!OS .isLinux ()) {
242+ globalScreenListener = new GlobalScreenListener ();
243+ globalScreenListener .register (model .useHotkey .get ());
244+ globalScreenListener .setViewController (viewControllerPopupController );
245+ model .useHotkey .addListener ((a , b , newValue ) -> globalScreenListener .register (newValue ));
246+ }
244247 }
245248
246249 private void initialiseUI (final Stage primaryStage ) throws IOException {
0 commit comments