Skip to content

Commit d3319f7

Browse files
committed
moved globalScreenListener setup to one place
1 parent 2f7c137 commit d3319f7

File tree

1 file changed

+6
-10
lines changed
  • src/main/java/de/doubleslash/keeptime

1 file changed

+6
-10
lines changed

src/main/java/de/doubleslash/keeptime/App.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@
2424
import java.util.Optional;
2525
import java.util.stream.Collectors;
2626

27-
import de.doubleslash.keeptime.common.OS;
2827
import org.slf4j.Logger;
2928
import org.slf4j.LoggerFactory;
3029
import org.springframework.boot.SpringApplication;
3130
import org.springframework.boot.autoconfigure.SpringBootApplication;
3231
import org.springframework.context.ConfigurableApplicationContext;
3332

3433
import de.doubleslash.keeptime.common.FontProvider;
34+
import de.doubleslash.keeptime.common.OS;
3535
import de.doubleslash.keeptime.common.Resources;
3636
import de.doubleslash.keeptime.common.Resources.RESOURCE;
3737
import 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

Comments
 (0)