diff --git a/src/main/java/musicplayer/PlayerGUI.java b/src/main/java/musicplayer/PlayerGUI.java index d3eda46..fa78262 100644 --- a/src/main/java/musicplayer/PlayerGUI.java +++ b/src/main/java/musicplayer/PlayerGUI.java @@ -70,6 +70,8 @@ public class PlayerGUI implements PlayerCallbackInterface, LibraryCallbackInterf try { GlobalKeyboardHook keyboardHook = new GlobalKeyboardHook(); keyboardHook.addKeyListener(new GlobalKeyboardShortcuts()); + Thread hookShutdown = new Thread(keyboardHook::shutdownHook); + Runtime.getRuntime().addShutdownHook(hookShutdown); } catch(RuntimeException | UnsatisfiedLinkError ex){ System.out.println("Keyboard hook failed, global shortcuts will not work this session."); System.out.println(ex.getMessage());