Program will now still run if global keyboard hooks fail to initialise.

This commit is contained in:
neviyn 2016-03-09 02:30:38 +00:00
parent 7dc4019785
commit ddd5934ae1
2 changed files with 9 additions and 3 deletions

View File

@ -88,7 +88,7 @@
<dependency> <dependency>
<groupId>lc.kra.system</groupId> <groupId>lc.kra.system</groupId>
<artifactId>system-hook</artifactId> <artifactId>system-hook</artifactId>
<version>2.1</version> <version>2.2</version>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -60,8 +60,14 @@ public class PlayerGUI implements PlayerCallbackInterface, LibraryCallbackInterf
} }
}, "seekbar"); }, "seekbar");
seekBarUpdater.start(); seekBarUpdater.start();
try {
GlobalKeyboardHook keyboardHook = new GlobalKeyboardHook(); GlobalKeyboardHook keyboardHook = new GlobalKeyboardHook();
keyboardHook.addKeyListener(new GlobalKeyboardShortcuts()); keyboardHook.addKeyListener(new GlobalKeyboardShortcuts());
} catch(RuntimeException ex){
System.out.println("Keyboard hook failed, global shortcuts will not work this session.");
System.out.println(ex.getMessage());
System.out.println(Arrays.toString(ex.getStackTrace()));
}
refreshLibrary(); refreshLibrary();
} }