2424import java .util .Optional ;
2525import java .util .stream .Collectors ;
2626
27- import de .doubleslash .keeptime .common .OS ;
2827import org .slf4j .Logger ;
2928import org .slf4j .LoggerFactory ;
3029import org .springframework .boot .SpringApplication ;
3130import org .springframework .boot .autoconfigure .SpringBootApplication ;
3231import org .springframework .context .ConfigurableApplicationContext ;
3332
3433import de .doubleslash .keeptime .common .FontProvider ;
34+ import de .doubleslash .keeptime .common .OS ;
3535import de .doubleslash .keeptime .common .Resources ;
3636import de .doubleslash .keeptime .common .Resources .RESOURCE ;
3737import de .doubleslash .keeptime .controller .Controller ;
@@ -220,14 +220,6 @@ private void readSettings() {
220220 private void initialisePopupUI (final Stage primaryStage ) throws IOException {
221221 LOG .debug ("Initialising popup UI." );
222222
223-
224- if (!OS .isLinux ()) {
225- globalScreenListener = new GlobalScreenListener ();
226- }
227- if (globalScreenListener !=null ){
228- model .useHotkey .addListener ((a , b , newValue ) -> globalScreenListener .register (newValue ));
229- globalScreenListener .register (model .useHotkey .get ());
230- }
231223 popupViewStage = new Stage ();
232224 popupViewStage .initOwner (primaryStage );
233225 // Load root layout from fxml file.
@@ -245,8 +237,12 @@ private void initialisePopupUI(final Stage primaryStage) throws IOException {
245237 popupViewStage .setAlwaysOnTop (true );
246238 final ViewControllerPopup viewControllerPopupController = loader .getController ();
247239 viewControllerPopupController .setStage (popupViewStage );
248- if (globalScreenListener != null ) {
240+
241+ if (!OS .isLinux ()) {
242+ globalScreenListener = new GlobalScreenListener ();
243+ globalScreenListener .register (model .useHotkey .get ());
249244 globalScreenListener .setViewController (viewControllerPopupController );
245+ model .useHotkey .addListener ((a , b , newValue ) -> globalScreenListener .register (newValue ));
250246 }
251247 }
252248
0 commit comments