ZIm/crates/zed
张小白 3c53832141
windows: Implement single instance (#15371)
This PR implements a single instance mechanism using the `CreateEventW`
function to create a mutex. If the identifier name begins with `Local`,
the single instance applies only to processes under the same user. If
the identifier begins with `Global`, it applies to all users.

Additionally, I was thinking that perhaps we should integrate the single
instance functionality into `gpui`. I believe applications developed
using `gpui` would benefit from this feature. Furthermore, incorporating
the single instance implementation into `gpui` would facilitate the
`set_dock_menu` functionality. As I mentioned in #12068, the
implementation of `set_dock_menu` on Windows depends on the single
instance feature. When a user clicks the "dock menu", Windows will open
a new application instance. To achieve behavior similar to macOS, we
need to prevent the new instance from launching and instead pass the
parameters to the existing instance.

Any advice and suggestions are welcome.




https://github.com/user-attachments/assets/c46f7e92-4411-4fa9-830e-383798a9dd93



Release Notes:

- N/A
2024-08-28 19:26:24 -07:00
..
contents Fix bundle script 2023-11-17 17:44:41 -08:00
resources Update zed.desktop.in to include the MimeType for empty files by default (#15623) 2024-08-13 16:56:44 +03:00
src windows: Implement single instance (#15371) 2024-08-28 19:26:24 -07:00
build.rs windows: Fix executable display name (#13091) 2024-06-17 13:02:09 -06:00
Cargo.toml windows: Implement single instance (#15371) 2024-08-28 19:26:24 -07:00
LICENSE-GPL chore: Change AGPL-licensed crates to GPL (except for collab) (#4231) 2024-01-24 00:26:58 +01:00
RELEASE_CHANNEL Put release channel back to dev 2023-11-17 14:31:49 -08:00