Skip to content

Commit a73fbf1

Browse files
ddamkeddamke
authored andcommitted
stop the initialisation of GlobalScreenListener
1 parent 1fbb90a commit a73fbf1

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,9 @@ private void initialiseApplication(final Stage primaryStage) throws Exception {
168168

169169
primaryStage.setOnHiding(we -> {
170170
popupViewStage.close();
171-
globalScreenListener.shutdown(); // deregister, as this will keep app running
171+
if (globalScreenListener != null) {
172+
globalScreenListener.shutdown(); // deregister, as this will keep app running
173+
}
172174
});
173175

174176
initialiseUI(primaryStage);
@@ -218,8 +220,11 @@ private void readSettings() {
218220
private void initialisePopupUI(final Stage primaryStage) throws IOException {
219221
LOG.debug("Initialising popup UI.");
220222

221-
globalScreenListener = new GlobalScreenListener();
223+
222224
if(!OS.isLinux()) {
225+
globalScreenListener = new GlobalScreenListener();
226+
}
227+
if(globalScreenListener!=null){
223228
model.useHotkey.addListener((a, b, newValue) -> globalScreenListener.register(newValue));
224229
globalScreenListener.register(model.useHotkey.get());
225230
}
@@ -240,8 +245,9 @@ private void initialisePopupUI(final Stage primaryStage) throws IOException {
240245
popupViewStage.setAlwaysOnTop(true);
241246
final ViewControllerPopup viewControllerPopupController = loader.getController();
242247
viewControllerPopupController.setStage(popupViewStage);
243-
244-
globalScreenListener.setViewController(viewControllerPopupController);
248+
if (globalScreenListener != null) {
249+
globalScreenListener.setViewController(viewControllerPopupController);
250+
}
245251
}
246252

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

src/main/java/de/doubleslash/keeptime/viewpopup/GlobalScreenListener.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,11 @@ public class GlobalScreenListener implements NativeKeyListener, NativeMouseMotio
6666
private Point mouseLocation = new Point(0, 0);
6767

6868
public GlobalScreenListener() {
69-
if(!OS.isLinux()) {
69+
7070
disableJNativeHookLogger();
7171

7272
GlobalScreen.addNativeKeyListener(this);
7373
GlobalScreen.addNativeMouseMotionListener(this);
74-
}
7574
}
7675

7776
public void register(final boolean register) {

src/test/java/de/doubleslash/keeptime/common/DateFormatterTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
public class DateFormatterTest {
2929

3030
@Test
31-
@Disabled
3231
public void zeroSecondsBetweenTest() {
3332
final LocalDateTime startDate = LocalDateTime.now();
3433
final LocalDateTime endDate = startDate.plusNanos(10000);

0 commit comments

Comments
 (0)