flutter_alone 4.0.4
flutter_alone: ^4.0.4 copied to clipboard
A robust Flutter plugin designed to ensure only a single instance of your desktop application runs at a time, offering customizable messages, cross-user detection, and enhanced window management for W [...]
4.0.4 #
- Bug Fixes
- macOS: Fixed hidden and Dock-minimized windows not being restored when a duplicate instance is launched.
bringWindowsToFront()was called from the second instance's process context, makingNSApplication.shared.windowsrefer to the second instance rather than the first — it has been removed.- Added
app.unhide()before activation so apps hidden via Cmd+H are properly restored. - Replaced
app.activate(options:)withNSWorkspace.shared.open(bundleURL), which sends the standardapplicationShouldHandleReopenevent to the running instance and correctly restores Dock-minimized windows — analogous to theIsWindowVisiblefix applied to Windows in v4.0.2.
- macOS: Fixed hidden and Dock-minimized windows not being restored when a duplicate instance is launched.
4.0.3 #
- Bug Fixes
- Windows: Fixed build failure in consumer projects on Korean (and other non-UTF-8 default codepage) Windows where MSVC read source files as CP949 and rejected em-dash (
—, U+2014) characters in the newly added comments ofwindow_utils.cppandflutter_alone_plugin.cpp(C4819 promoted to C2220 via/WX). All non-ASCII punctuation in plugin source comments has been replaced with ASCII equivalents.
- Windows: Fixed build failure in consumer projects on Korean (and other non-UTF-8 default codepage) Windows where MSVC read source files as CP949 and rejected em-dash (
4.0.2 #
- Bug Fixes
- Windows: Fixed hidden main windows (e.g., minimized to the system tray via
SW_HIDE) not being found by PID-based lookup. TheIsWindowVisiblefilter inEnumWindowsCallbackwas preventing restoration of tray-hidden instances; it has been replaced with aGetWindow(..., GW_OWNER) == NULLtop-level check, so hidden main windows remain findable while tooltip/popup helper windows are still excluded. - Windows: Replaced the
FindWindowW-based title fallback inCheckRunningInstancewith a newWindowUtils::FindWindowByTitleAndPathhelper that enumerates all top-level windows with a matching title and picks the one whose owning process matches the current executable path. This fixes a scenario where two builds of the same app (e.g., installed and portable) share the same window title — previouslyFindWindowWwould return only the first title match, and path verification would silently fail, leaving the intended instance unreachable. - Linux (Wayland): Removed
--onlyvisiblefrom thexdotoolsearch arguments inactivate_window_waylandso tray-minimized / hidden windows can still be activated by the fallback path. Added--limit 1as a safety bound against activating multiple helper windows that share the PID.
- Windows: Fixed hidden main windows (e.g., minimized to the system tray via
4.0.1 #
- Bug Fixes
- Windows: Fixed build failure in consumer projects caused by missing
<flutter/encodable_value.h>include influtter_alone_plugin.h. The header referencedflutter::EncodableMapwithout including the defining header, which only compiled when transitively pulled in by other Flutter headers depending on include order. - Windows: Renamed
MessageUtils::GetMessage/GetTitle/GetKoreanMessage/GetEnglishMessagetoGetMessageText/GetTitleText/GetKoreanMessageText/GetEnglishMessageTextto avoid collision with theGetMessagepreprocessor macro fromwindows.h(expands toGetMessageWunder UNICODE), which causedC2039: 'GetMessageW' is not a member of 'MessageUtils'compile errors.
- Windows: Fixed build failure in consumer projects caused by missing
4.0.0 #
-
New Features
- Added full Linux platform support with X11 and Wayland window activation.
- Added
LinuxConfigfor lock file configuration on Linux.
-
Security
- Windows: Replaced null DACL with minimal-rights SDDL DACL (Everyone gets SYNCHRONIZE only, Creator/Owner gets full access) to prevent mutex squatting.
- Windows: Added mutex name validation (length, embedded backslash rejection) and
FindWindowWtitle-spoofing defense via process identity verification. - Linux: Replaced
system()calls withposix_spawnp()to eliminate command injection risk in Wayland window activation. - Linux/macOS: Implemented
flock()-based advisory locking to eliminate TOCTOU race conditions. Lock files are automatically released by the kernel on process death. - Linux/macOS: Added
O_NOFOLLOWflag to prevent symlink attacks on lock files. - Linux: Added process identity verification via
/proc/<pid>/exeto prevent PID reuse false positives. - macOS: Added bundle ID verification to prevent PID reuse false positives.
- Linux/macOS: Handle
errno == EPERMfromkill(pid, 0)for cross-user process detection. - All platforms: Added
lockFileName/mutexNameinput validation with path traversal defense (.,.., null bytes, path separators). - Windows: Guarded all
OutputDebugStringWcalls with#ifdef _DEBUGto prevent information leakage in release builds.
-
Improvements
- Windows: Fixed
GetLastError()being called afterCleanupResources(), capturing the error code immediately afterCreateMutexW. - Windows: Added null-pointer guard for method call arguments and replaced
std::get<>withstd::get_if<>for type-safe argument extraction. - Windows: Removed all dead code (unused
MutexConfig,GetMutexName,StringToWideString/WideStringToString,GetCurrentProcessInfo,GetLastErrorMessage,DestroyAppIcon,GetCurrentWindowTitle,WideToUtf8). - Windows: Consolidated icon handling (removed duplicate
ProcessUtils::GetExecutableIcon, using onlyIconUtils::GetAppIcon). - Windows: Fixed CBT hook
CallNextHookExreceiving staleNULLhandle after self-unhook. - Windows: Added explicit
Advapi32andSecur32to CMaketarget_link_libraries. - macOS: Fixed
currentLockFilePathdouble-assignment bug that could delete another instance's lock file on dispose. - macOS: Added proper error logging for all file operations (
NSLog). - macOS: Fixed bundle ID guard logic (now requires both IDs to be present and match).
- macOS: Fixed podspec placeholder metadata (version, description, homepage, author).
- Linux: Fixed X11
_NET_WM_PIDcasting fromunsigned long*touint32_tviamemcpyfor LP64 correctness. - Linux: Extracted
release_lock(),notify_already_running(), andhandle_check_and_run()helpers to reduce complexity. - Linux: Fixed flock-fail PID read to use already-opened fd (
read_pid_from_fd) instead of re-opening the file (TOCTOU fix). - Linux: Added
posix_spawn_file_actions_addopenreturn value checking.
- Windows: Fixed
-
Breaking Changes
MacOSConfigandLinuxConfigconstructors are no longerconst(validation now usesthrow ArgumentErrorinstead ofassert).CustomWindowsMutexConfigconstructor is no longerconst(same reason).FlutterAloneConfig.toMap()now throwsStateErrorin release mode when platform config is missing (previously silent in release).FlutterAlonePlatform.checkAndRun()anddispose()are now abstract methods (previously had defaultthrow UnimplementedErrorbodies).
-
Dart
- Replaced
assertwiththrow ArgumentErrorinLinuxConfig,MacOSConfig, andCustomWindowsMutexConfigfor release-mode enforcement. - Replaced
assert+ null-guard withthrow StateErrorinFlutterAloneConfig.toMap(). - Removed unnecessary
removeWherecall in method channel. - Removed unnecessary
try/catch/rethrowinFlutterAlone.checkAndRun()anddispose(). - Improved
AloneException.toString()to includedetails. - Extracted
typeStringgetter inMessageConfigbase class to deduplicatetoMap(). - Extracted
_globalPrefixand_mutexNameKeyconstants inWindowsMutexConfig. - Promoted
toMap()to base class inWindowsMutexConfig.
- Replaced
3.2.4 #
- Maintenance
- Maintenance release.
3.2.3 #
- Documentation
- Updated
README.md.
- Updated
3.2.2 #
- Documentation
- Updated
pubspec.yamldescription and keywords. - Updated
README.md.
- Updated
3.2.1 #
- Documentation
- Updated
README.mdto reflect the latest changes and improvements.
- Updated
3.2.0 #
-
New Features
- Added customizable lockfile name for macOS (
MacOSConfig.lockFileName).
- Added customizable lockfile name for macOS (
-
Improvements
- Enhanced macOS window activation logic when a duplicate instance is detected, ensuring hidden or minimized windows are brought to front.
- Refactored macOS lockfile path management to use native temporary directory API, removing
path_providerdependency for lockfile handling.
3.1.3 #
- Update
- update license
3.1.2 #
- Update
- update license
3.1.1 #
-
Documentation
- Added critical setup guide for window_manager compatibility
- Documented window title conflict resolution
- Added FAQ and troubleshooting sections
-
Improvements
- Enhanced debug logging for window detection
- Improved error diagnostics for title conflicts
3.1.0 #
-
New Features
- Added
CustomMutexConfigfor direct mutex name specification - Refactored mutex configuration to support multiple naming strategies
- Simplified mutex name handling across platform boundaries
- Enhanced code organization with better abstraction
- Added
-
Breaking Changes
MutexConfigis now an abstract class with implementations:DefaultMutexConfig(backward compatible with existing approach)CustomMutexConfig(new approach with direct mutex name specification)
-
Improvements
- Moved mutex name generation logic to Dart side for better flexibility
- Streamlined native code interfaces
- Improved test coverage for various mutex configuration scenarios
- Enhanced example application with both configuration approaches
3.0.0 #
-
Breaking Changes
- Redesigned configuration system with introduction of
FlutterAloneConfig - Replaced
messageConfigparameter with unifiedconfigparameter - Separated configuration objects by concern:
MutexConfig,WindowConfig,DuplicateCheckConfig,MessageConfig
- Redesigned configuration system with introduction of
-
Improvements
- Enhanced configuration value access in native code
- Added null checks for all configuration values
- Implemented safe parameter reference handling
- Strengthened type verification
- Improved error handling and messages
- Better code organization through modularized configuration structure
- Enhanced configuration value access in native code
2.3.4 #
- Maintenance
- Maintenance release.
2.3.1 #
- Improvements
- Applied consistent code formatting throughout the project
- Fixed code style issues according to Dart formatting guidelines
2.3.0 #
-
Breaking Changes
- Simplified
checkAndRun()method API - now uses onlymessageConfigparameter - Made
packageIdandappNamerequired parameters inMessageConfigclass - Improved API consistency by removing duplicate parameters
- Simplified
-
Improvements
- Enhanced documentation for message configuration
- Optimized automatic package information detection logic
- General code base cleanup and refactoring
2.2.0 #
-
New Features
- Added window title parameter for better window identification
- Improved window detection for system tray applications
- Enhanced same-user window activation and focusing
- Added system tray example implementation to demonstration project
-
Improvements
- Better window management for minimized or hidden windows
- Optimized cross-user and same-user application instance detection
- Enhanced error handling for window activation failures
2.1.0 #
-
New Features
- Added customizable mutex name configuration
- Added package ID and app name parameters for fine-grained mutex control
- Added optional mutex suffix parameter
- Added automatic application information detection using package_info_plus
-
Improvements
- Enhanced mutex name generation with sanitization and validation
- Improved error handling for invalid mutex names
- Added comprehensive documentation for mutex customization
- Optimized mutex resource management
2.0.2 #
- New Features
- Added debug mode configuration option
- Added
enableInDebugModeflag to control duplicate checks in debug mode - Automatically skips duplicate checks in debug mode by default
2.0.1 #
- Enhancements
- Improved MessageBox taskbar icon display
- Added application icon management system
- Enhanced MessageBox window hook implementation
- Optimized taskbar visual identification
2.0.0 #
-
Breaking Changes
- Restructured platform implementation for better stability
- Redesigned message configuration system
-
New Features
- Added process information model with detailed system data
- Enhanced Windows mutex handling
- Improved window management (restore, focus, bring to front)
- Added comprehensive test coverage (unit, integration, method channel)
- Added detailed process utilities for Windows
-
Improvements
- Enhanced error handling with custom exceptions
- Improved resource cleanup
- Better cross-user detection
- Added documentation and examples
1.1.1 #
- Fixed Korean text encoding issues in message box
- Improved message configuration architecture
- Enhanced type safety with dedicated message config classes
- Added template support for custom messages
1.1.0 #
- Added message configuration (English/Korean/Custom)
- Added message box display control option
- Enhanced process information model
- Improved code structure and stability
1.0.0 #
- Implemented duplicate execution prevention for Windows
- Added system-level duplicate detection using global mutex
- Added multi-user account support