Skip to content

Commit 2f7c137

Browse files
committed
Merge branch 'bug/import_export_function_fix_linux' of https://github.com/DavidDamke/KeepTime into DavidDamke-bug/import_export_function_fix_linux
2 parents 4e584cb + 06c28c6 commit 2f7c137

File tree

1 file changed

+14
-7
lines changed
  • src/main/java/de/doubleslash/keeptime

1 file changed

+14
-7
lines changed

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

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

27+
import de.doubleslash.keeptime.common.OS;
2728
import org.slf4j.Logger;
2829
import org.slf4j.LoggerFactory;
2930
import org.springframework.boot.SpringApplication;
@@ -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,14 @@ 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());
224223

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+
}
225231
popupViewStage = new Stage();
226232
popupViewStage.initOwner(primaryStage);
227233
// Load root layout from fxml file.
@@ -239,8 +245,9 @@ private void initialisePopupUI(final Stage primaryStage) throws IOException {
239245
popupViewStage.setAlwaysOnTop(true);
240246
final ViewControllerPopup viewControllerPopupController = loader.getController();
241247
viewControllerPopupController.setStage(popupViewStage);
242-
243-
globalScreenListener.setViewController(viewControllerPopupController);
248+
if (globalScreenListener != null) {
249+
globalScreenListener.setViewController(viewControllerPopupController);
250+
}
244251
}
245252

246253
private void initialiseUI(final Stage primaryStage) throws IOException {

0 commit comments

Comments
 (0)