diff --git a/src/main.cpp b/src/main.cpp index d9756d9..ed446ff 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -122,6 +122,11 @@ int main(int argc, char* argv[]) return 1; } + //Add PlayPause Hotkey + if (!RegisterHotKey(g_hWnd, 1, 0, VK_MEDIA_PLAY_PAUSE)) { + AppendToCrashLog(L"[BOOT]: Failed to register hotkey!"); + } + // Scale Values with DPI ScaleWithDPI(); LoadCustomMenuFont(); diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index 78efcff..04b63bb 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -391,6 +391,15 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) } break; } + case WM_HOTKEY: + { + // PlayPause Hotkey + if (wParam == 1) { + std::vector args = {"cycle", "pause"}; + HandleMpvCommand(args); + } + break; + } case WM_SETTINGCHANGE: { UpdateTheme(hWnd); diff --git a/src/utils/crashlog.cpp b/src/utils/crashlog.cpp index 83fd9aa..3049de7 100644 --- a/src/utils/crashlog.cpp +++ b/src/utils/crashlog.cpp @@ -67,4 +67,6 @@ void Cleanup() } Discord_Shutdown(); + + UnregisterHotKey(g_hWnd, 1); }