Skip to content

Commit 46abbe7

Browse files
authored
Merge pull request #109 from DavidDamke/bug/import_export_function_fix_linux
import and export works with jnativehook version 2.1.0
2 parents 4e584cb + d3319f7 commit 46abbe7

File tree

1 file changed

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

1 file changed

+10
-7
lines changed

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

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.springframework.context.ConfigurableApplicationContext;
3232

3333
import de.doubleslash.keeptime.common.FontProvider;
34+
import de.doubleslash.keeptime.common.OS;
3435
import de.doubleslash.keeptime.common.Resources;
3536
import de.doubleslash.keeptime.common.Resources.RESOURCE;
3637
import 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

Comments
 (0)