wails/v3/pkg/application
Lea Anthony 3f29158dfa ## Summary
I have successfully implemented the "Start At Login" feature for Wails v3, addressing all the major concerns raised in PR #3910. Here's what was accomplished:

###  **Core Implementation**

1. **Added StartAtLogin option** to `application.Options` struct
2. **Implemented platform-specific methods** for all three platforms:
   - **macOS**: Uses AppleScript with proper escaping to prevent injection attacks
   - **Windows**: Uses Windows Registry with restrictive permissions
   - **Linux**: Uses XDG autostart specification with .desktop files

3. **Added public API methods**:
   - `SetStartAtLogin(enabled bool) error` - Enable/disable start at login
   - `StartsAtLogin() (bool, error)` - Check current status

###  **Security Improvements** (addressing PR comments)

1. **Path validation and sanitization** across all platforms
2. **AppleScript injection protection** on macOS with proper escaping
3. **Registry permissions** restricted to necessary access on Windows  
4. **Executable path validation** with symlink resolution
5. **Input sanitization** for application names and paths

###  **Error Handling & Documentation**

1. **Comprehensive error handling** with descriptive error messages
2. **Complete API documentation** with platform-specific behavior notes
3. **macOS Info.plist requirement** documented (NSAppleEventsUsageDescription)
4. **Cross-platform compatibility** notes and troubleshooting

###  **Example & Testing**

1. **Working example application** demonstrating usage
2. **Comprehensive README** with platform-specific requirements
3. **Runtime toggling capability** implemented
4. **Compilation verified** - the implementation builds successfully

### 🔧 **Technical Details**

- **macOS**: Uses Bundle information and AppleScript with security hardening
- **Windows**: Uses HKEY_CURRENT_USER registry with KEY_SET_VALUE/KEY_QUERY_VALUE permissions
- **Linux**: Creates XDG-compliant .desktop files in ~/.config/autostart/

### 📋 **Key Features**

-  Cross-platform support (macOS, Windows, Linux)
-  Runtime configuration via public API
-  Application startup configuration via Options
-  Security hardening against injection attacks
-  Proper error handling and validation
-  Complete documentation and examples

The implementation is now ready for testing and can be integrated into Wails v3. All major security concerns from the original PR have been addressed, and the feature includes proper documentation for developers.
2025-08-04 20:58:31 +10:00
..
assets/alpha BREAKING CHANGE: wml attributes are now prefixed with data- 2025-01-28 07:37:17 +11:00
internal/tests Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
application.go ## Summary 2025-08-04 20:58:31 +10:00
application_darwin.go ## Summary 2025-08-04 20:58:31 +10:00
application_darwin.h [v3 darwin] Add darwin identifier to all C files of darwin 2023-05-30 16:32:00 +08:00
application_darwin_delegate.h mac deeplink delegate 2025-05-18 16:33:15 -04:00
application_darwin_delegate.m mac deeplink delegate 2025-05-18 16:33:15 -04:00
application_debug.go [v3] allow build with garble (#3192) 2025-01-10 16:36:24 +11:00
application_dev.go [v3] Late service registration and error handling overhaul (#4066) 2025-02-19 09:27:41 +01:00
application_linux.go ## Summary 2025-08-04 20:58:31 +10:00
application_options.go ## Summary 2025-08-04 20:58:31 +10:00
application_production.go Refactor menu functions and streamline devtools toggle across systems 2024-01-21 20:52:32 +11:00
application_windows.go ## Summary 2025-08-04 20:58:31 +10:00
bindings.go [v3] Late service registration and error handling overhaul (#4066) 2025-02-19 09:27:41 +01:00
bindings_test.go [v3] Late service registration and error handling overhaul (#4066) 2025-02-19 09:27:41 +01:00
browser_manager.go feat: Complete App API restructuring with organized manager pattern (#4359) 2025-06-21 19:51:14 +10:00
clipboard.go [linux] support clipboard 2023-10-02 20:47:04 +11:00
clipboard_darwin.go [v3 windows] Add clipboard support 2023-06-10 13:01:10 +10:00
clipboard_linux.go [v3] move linux clipboard logic to linux_cgo 2023-10-02 11:07:12 -05:00
clipboard_manager.go feat: Complete App API restructuring with organized manager pattern (#4359) 2025-06-21 19:51:14 +10:00
clipboard_windows.go [v3 windows] Add clipboard support 2023-06-10 13:01:10 +10:00
context.go Fix build issue 2025-01-17 21:21:32 +11:00
context_application_event.go rename context consts 2025-07-12 19:09:57 -06:00
context_menu_manager.go feat: Complete App API restructuring with organized manager pattern (#4359) 2025-06-21 19:51:14 +10:00
context_window_event.go [windows] Drag-n-drop support 2023-10-21 11:21:10 +11:00
dialog_manager.go feat: Complete App API restructuring with organized manager pattern (#4359) 2025-06-21 19:51:14 +10:00
dialogs.go fix: unhandled error in dialogs.go 2025-03-20 14:46:24 +01:00
dialogs_darwin.go Documentation updates. 2024-12-16 20:00:56 +11:00
dialogs_darwin_delegate.h Fix default index.html serving. 2024-12-14 11:10:07 +11:00
dialogs_darwin_delegate.m Fix default index.html serving. 2024-12-14 11:10:07 +11:00
dialogs_linux.go Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
dialogs_windows.go delete redundant method 2025-04-07 13:35:37 -03:00
dialogs_windows_test.go Create dialogs_windows_test.go 2025-04-09 16:21:59 -03:00
environment.go Update system.Environment 2024-03-19 20:37:03 +11:00
environment_manager.go Added getAccentColor implementation to Env (#4399) 2025-07-15 03:44:34 +00:00
errors.go [v3] Late service registration and error handling overhaul (#4066) 2025-02-19 09:27:41 +01:00
event_manager.go feat: Complete App API restructuring with organized manager pattern (#4359) 2025-06-21 19:51:14 +10:00
events.go [V3] Add docs for event.Sender (#4075) 2025-02-15 07:17:47 +11:00
events_common_darwin.go Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
events_common_linux.go Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
events_common_windows.go Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
events_test.go Refactored Events (#3731) 2024-09-07 16:39:02 +10:00
image.go V3 alpha linux dbus (#2996) 2023-10-21 11:39:46 +11:00
key_binding_manager.go feat: Complete App API restructuring with organized manager pattern (#4359) 2025-06-21 19:51:14 +10:00
keys.go Fix tests 2024-08-04 21:28:15 +10:00
keys_darwin.go merge exp branch 2023-01-18 21:42:49 +11:00
keys_linux.go Linux Keybinds 2023-11-06 10:49:11 -06:00
keys_windows.go Fix modifier processing on windows. 2023-10-15 13:53:31 +11:00
linux_cgo.go Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
linux_purego.go Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
logger_dev.go Standardise and enhance logger service 2025-02-13 03:11:21 +01:00
logger_dev_windows.go Standardise and enhance logger service 2025-02-13 03:11:21 +01:00
logger_prod.go Standardise and enhance logger service 2025-02-13 03:11:21 +01:00
mainthread.go Improved panic handling. Added guide. 2025-01-16 22:08:18 +11:00
mainthread_darwin.go [v3 mac] Better main thread calls 2023-06-16 20:48:57 +10:00
mainthread_linux.go [WIP] refactor CGO methods 2024-03-06 15:43:50 -06:00
mainthread_windows.go [v3] Make Windows window class configurable (#3682) 2024-08-20 18:20:44 +10:00
menu.go Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
menu_darwin.go Fix registration of hidden menuItem [mac] 2025-03-08 11:25:05 +11:00
menu_linux.go Menu improvements (#3492) 2024-05-20 21:15:02 +10:00
menu_manager.go feat: Complete App API restructuring with organized manager pattern (#4359) 2025-06-21 19:51:14 +10:00
menu_test.go Menu improvements (#3492) 2024-05-20 21:15:02 +10:00
menu_windows.go Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
menuitem.go [v3] Late service registration and error handling overhaul (#4066) 2025-02-19 09:27:41 +01:00
menuitem_darwin.go Fix: Disabled menu item callback (#4469) 2025-08-02 20:22:09 +10:00
menuitem_darwin.h Ensure some menuitem methods are run on the main thread. 2025-01-12 15:05:39 +11:00
menuitem_darwin.m [v3 darwin] Add darwin identifier to all C files of darwin 2023-05-30 16:32:00 +08:00
menuitem_dev.go Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
menuitem_linux.go Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
menuitem_production.go Significant updates to mac menu items. More roles. More fixes to come. 2024-09-12 20:51:07 +10:00
menuitem_roles.go Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
menuitem_selectors_darwin.go Fix typos 2025-01-16 20:25:07 +11:00
menuitem_test.go Fix tests 2024-08-04 21:28:15 +10:00
menuitem_windows.go fix: restore hidden menuitem at correct position 2025-04-27 12:00:13 +08:00
messageprocessor.go Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
messageprocessor_application.go [v3] Late service registration and error handling overhaul (#4066) 2025-02-19 09:27:41 +01:00
messageprocessor_browser.go [v3] Late service registration and error handling overhaul (#4066) 2025-02-19 09:27:41 +01:00
messageprocessor_call.go Fix logging bug in call message processor 2025-02-25 03:33:56 +01:00
messageprocessor_clipboard.go feat: Complete App API restructuring with organized manager pattern (#4359) 2025-06-21 19:51:14 +10:00
messageprocessor_contextmenu.go [v3] Late service registration and error handling overhaul (#4066) 2025-02-19 09:27:41 +01:00
messageprocessor_dialog.go Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
messageprocessor_events.go Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
messageprocessor_params.go [v3] Late service registration and error handling overhaul (#4066) 2025-02-19 09:27:41 +01:00
messageprocessor_screens.go Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
messageprocessor_system.go feat: Complete App API restructuring with organized manager pattern (#4359) 2025-06-21 19:51:14 +10:00
messageprocessor_window.go feature: V3 alpha feature/snapassist support (#4463) 2025-08-02 16:59:49 +10:00
panic_handler.go [v3] Late service registration and error handling overhaul (#4066) 2025-02-19 09:27:41 +01:00
path.go *BREAKING CHANGE* move Path and Paths methods into application package. 2025-01-24 08:09:29 +11:00
popupmenu_windows.go Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
roles.go Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
roles_dev.go ToggleDevTools -> OpenDevTools 2024-03-06 11:43:12 -06:00
roles_production.go Refactor menu functions and streamline devtools toggle across systems 2024-01-21 20:52:32 +11:00
screen_darwin.go [v3-Windows] New DIP system for Enhanced High DPI Monitor Support (#3665) 2024-09-22 08:38:30 +10:00
screen_linux.go fix screens 2024-03-06 16:59:13 -06:00
screen_windows.go Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
screenmanager.go Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
screenmanager_test.go feat: Complete App API restructuring with organized manager pattern (#4359) 2025-06-21 19:51:14 +10:00
services.go [v3] Late service registration and error handling overhaul (#4066) 2025-02-19 09:27:41 +01:00
single_instance.go Improved panic handling. Added guide. 2025-01-16 22:08:18 +11:00
single_instance_darwin.go Single Instance feature. 2024-12-30 21:02:43 +11:00
single_instance_linux.go [v3] Late service registration and error handling overhaul (#4066) 2025-02-19 09:27:41 +01:00
single_instance_windows.go [v3] Late service registration and error handling overhaul (#4066) 2025-02-19 09:27:41 +01:00
system_tray_manager.go feat: Complete App API restructuring with organized manager pattern (#4359) 2025-06-21 19:51:14 +10:00
systemtray.go feat: Complete App API restructuring with organized manager pattern (#4359) 2025-06-21 19:51:14 +10:00
systemtray_darwin.go [v3] Late service registration and error handling overhaul (#4066) 2025-02-19 09:27:41 +01:00
systemtray_darwin.h Fix macOS systray DPI scaling and offset. 2024-12-13 23:46:27 +11:00
systemtray_darwin.m Fix macOS systray DPI scaling and offset. 2024-12-13 23:46:27 +11:00
systemtray_linux.go [v3] Late service registration and error handling overhaul (#4066) 2025-02-19 09:27:41 +01:00
systemtray_windows.go Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
TODO.md merge exp branch 2023-01-18 21:42:49 +11:00
webview_window.go feature: V3 alpha feature/snapassist support (#4463) 2025-08-02 16:59:49 +10:00
webview_window_close_darwin.go Refactor Manager API to use singular naming convention (#4367) 2025-06-22 12:19:14 +10:00
webview_window_darwin.go Support allowsBackForwardNavigationGestures (#4453) 2025-08-02 21:02:52 +10:00
webview_window_darwin.h Fix macOS systray DPI scaling and offset. 2024-12-13 23:46:27 +11:00
webview_window_darwin.m fix incorrect window destroy (#4323) 2025-06-18 07:31:55 +10:00
webview_window_darwin_dev.go Add more macOS version checks 2024-06-08 15:16:33 +10:00
webview_window_darwin_drag.h [v3 darwin] Add darwin identifier to all C files of darwin 2023-05-30 16:32:00 +08:00
webview_window_darwin_drag.m [darwin] Refactor events into mac specific files 2023-10-03 08:33:58 +11:00
webview_window_darwin_production.go ToggleDevTools -> OpenDevTools 2024-03-06 11:43:12 -06:00
webview_window_linux.go feature: V3 alpha feature/snapassist support (#4463) 2025-08-02 16:59:49 +10:00
webview_window_linux_dev.go ToggleDevTools -> OpenDevTools 2024-03-06 11:43:12 -06:00
webview_window_linux_production.go ToggleDevTools -> OpenDevTools 2024-03-06 11:43:12 -06:00
webview_window_options.go Custom Windows Webview2 Args (#4467) 2025-08-02 21:03:41 +10:00
webview_window_windows.go Custom Windows Webview2 Args (#4467) 2025-08-02 21:03:41 +10:00
webview_window_windows_devtools.go [v3] Late service registration and error handling overhaul (#4066) 2025-02-19 09:27:41 +01:00
webview_window_windows_production.go [v3] Late service registration and error handling overhaul (#4066) 2025-02-19 09:27:41 +01:00
window.go feature: V3 alpha feature/snapassist support (#4463) 2025-08-02 16:59:49 +10:00
window_manager.go feat: Complete App API restructuring with organized manager pattern (#4359) 2025-06-21 19:51:14 +10:00