mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-09-22 21:30:44 +02:00
Merge branch 'v2' into v3
This commit is contained in:
@@ -8,6 +8,10 @@
|
||||
|
||||
- Upgraded to `deep-link@3.0.0-alpha.0`
|
||||
|
||||
## [2.4.5]
|
||||
|
||||
- [`67cd25a1`](https://github.com/tauri-apps/plugins-workspace/commit/67cd25a10ce3deb1b935e725228e528766f24ad7) ([#3592](https://github.com/tauri-apps/plugins-workspace/pull/3592)) On Windows, the second instance now allows the first instance to bring its window to the front before exiting, so focusing a window from the callback no longer gets refused by Windows.
|
||||
|
||||
## [2.4.4]
|
||||
|
||||
- [`f8053e65`](https://github.com/tauri-apps/plugins-workspace/commit/f8053e659e4ccd85c1f52833411ff8417cbc5e69) ([#3527](https://github.com/tauri-apps/plugins-workspace/pull/3527) by [@Legend-Master](https://github.com/tauri-apps/plugins-workspace/../../Legend-Master)) Documented Cargo feature flags in each plugin's crate-level documentation.
|
||||
|
||||
@@ -19,10 +19,11 @@ use windows_sys::Win32::{
|
||||
Threading::{CreateMutexW, ReleaseMutex},
|
||||
},
|
||||
UI::WindowsAndMessaging::{
|
||||
self as w32wm, CreateWindowExW, DefWindowProcW, DestroyWindow, FindWindowW,
|
||||
RegisterClassExW, SendMessageW, CREATESTRUCTW, GWLP_USERDATA, GWL_STYLE,
|
||||
WINDOW_LONG_PTR_INDEX, WM_COPYDATA, WM_CREATE, WM_DESTROY, WNDCLASSEXW, WS_EX_LAYERED,
|
||||
WS_EX_NOACTIVATE, WS_EX_TOOLWINDOW, WS_EX_TRANSPARENT, WS_OVERLAPPED, WS_POPUP, WS_VISIBLE,
|
||||
self as w32wm, AllowSetForegroundWindow, CreateWindowExW, DefWindowProcW, DestroyWindow,
|
||||
FindWindowW, GetWindowThreadProcessId, RegisterClassExW, SendMessageW, CREATESTRUCTW,
|
||||
GWLP_USERDATA, GWL_STYLE, WINDOW_LONG_PTR_INDEX, WM_COPYDATA, WM_CREATE, WM_DESTROY,
|
||||
WNDCLASSEXW, WS_EX_LAYERED, WS_EX_NOACTIVATE, WS_EX_TOOLWINDOW, WS_EX_TRANSPARENT,
|
||||
WS_OVERLAPPED, WS_POPUP, WS_VISIBLE,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -74,6 +75,16 @@ pub fn init<R: Runtime>(callback: Box<SingleInstanceCallback<R>>) -> TauriPlugin
|
||||
let hwnd = FindWindowW(class_name.as_ptr(), window_name.as_ptr());
|
||||
|
||||
if !hwnd.is_null() {
|
||||
// Windows lets us bring a window to the front, but not the first
|
||||
// instance. Hand that right over before we exit, so focusing a window
|
||||
// from the callback works. Windows takes it back if the user switches
|
||||
// to another app in the meantime.
|
||||
let mut pid = 0;
|
||||
GetWindowThreadProcessId(hwnd, &mut pid);
|
||||
if pid != 0 {
|
||||
AllowSetForegroundWindow(pid);
|
||||
}
|
||||
|
||||
let cwd = std::env::current_dir().unwrap_or_default();
|
||||
let cwd = cwd.to_str().unwrap_or_default();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user