diff --git a/Cargo.lock b/Cargo.lock index 81c2b0b8f..cfa9fa6c9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7260,7 +7260,7 @@ dependencies = [ name = "wezterm-open-url" version = "0.1.0" dependencies = [ - "winapi", + "windows-sys 0.61.2", ] [[package]] diff --git a/wezterm-open-url/Cargo.toml b/wezterm-open-url/Cargo.toml index a5759e2ba..08b28f5fa 100644 --- a/wezterm-open-url/Cargo.toml +++ b/wezterm-open-url/Cargo.toml @@ -6,5 +6,8 @@ publish = false # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html -[dependencies] -winapi = {workspace=true, features=["shellapi"]} +[target."cfg(windows)".dependencies] +windows-sys = { workspace = true, features = [ + "Win32_UI_Shell", + "Win32_UI_WindowsAndMessaging", +] } \ No newline at end of file diff --git a/wezterm-open-url/src/lib.rs b/wezterm-open-url/src/lib.rs index 9a61fd947..70354a16e 100644 --- a/wezterm-open-url/src/lib.rs +++ b/wezterm-open-url/src/lib.rs @@ -57,7 +57,9 @@ pub fn open_with(url: &str, app: &str) { #[cfg(windows)] fn shell_execute(url: String, with: Option) { use std::os::windows::ffi::OsStrExt; - use winapi::um::shellapi::ShellExecuteW; + use windows_sys::Win32::UI::Shell::ShellExecuteW; + use windows_sys::Win32::UI::WindowsAndMessaging::SW_SHOW; + /// Convert a rust string to a windows wide string fn wide_string(s: &str) -> Vec { std::ffi::OsStr::new(s) @@ -83,7 +85,7 @@ fn shell_execute(url: String, with: Option) { app, path, std::ptr::null(), - winapi::um::winuser::SW_SHOW, + SW_SHOW, ); } });