Skip to content

Commit

Permalink
WIndows handle
Browse files Browse the repository at this point in the history
  • Loading branch information
Ovenoboyo committed Aug 25, 2024
1 parent 64c97c5 commit 073f3db
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
uses: swatinem/rust-cache@v2
with:
cache-on-failure: true
cache-all-crates: true

- name: install extensions host
# If you don't have `beforeBuildCommand` configured you may want to build your frontend here too.
Expand Down
10 changes: 6 additions & 4 deletions src-tauri/mpris/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ impl MprisHolder {

#[cfg(target_os = "windows")]
let hwnd = {
use windows::Win32::UI::Input::KeyboardAndMouse::GetActiveWindow;
use raw_window_handle::{HasRawWindowHandle, RawWindowHandle};

let console_window = unsafe { GetActiveWindow() };
let hwnd = console_window as *mut c_void;
Some(hwnd)
let handle = match window.raw_window_handle() {
RawWindowHandle::Win32(h) => h,
_ => unreachable!(),
};
Some(handle.hwnd)
};

let config = PlatformConfig {
Expand Down

0 comments on commit 073f3db

Please sign in to comment.