├── .github ├── FUNDING.yml └── workflows │ ├── build.yml │ └── lint.yml ├── .gitignore ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README-ZH.md ├── README.md ├── analysis_options.yaml ├── dart_dependency_validator.yaml ├── example ├── .gitignore ├── .metadata ├── README.md ├── analysis_options.yaml ├── lib │ ├── main.dart │ └── pages │ │ └── home.dart ├── linux │ ├── .gitignore │ ├── CMakeLists.txt │ ├── flutter │ │ ├── CMakeLists.txt │ │ ├── generated_plugin_registrant.cc │ │ ├── generated_plugin_registrant.h │ │ └── generated_plugins.cmake │ ├── main.cc │ ├── my_application.cc │ └── my_application.h ├── macos │ ├── .gitignore │ ├── Flutter │ │ ├── Flutter-Debug.xcconfig │ │ ├── Flutter-Release.xcconfig │ │ └── GeneratedPluginRegistrant.swift │ ├── Podfile │ ├── Podfile.lock │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── xcshareddata │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ └── swiftpm │ │ │ │ └── Package.resolved │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── swiftpm │ │ │ └── Package.resolved │ └── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── app_icon_1024.png │ │ │ ├── app_icon_128.png │ │ │ ├── app_icon_16.png │ │ │ ├── app_icon_256.png │ │ │ ├── app_icon_32.png │ │ │ ├── app_icon_512.png │ │ │ └── app_icon_64.png │ │ ├── Base.lproj │ │ └── MainMenu.xib │ │ ├── Configs │ │ ├── AppInfo.xcconfig │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── Warnings.xcconfig │ │ ├── DebugProfile.entitlements │ │ ├── Info.plist │ │ ├── MainFlutterWindow.swift │ │ └── Release.entitlements ├── pubspec.lock ├── pubspec.yaml ├── web │ ├── favicon.png │ ├── icons │ │ ├── Icon-192.png │ │ ├── Icon-512.png │ │ ├── Icon-maskable-192.png │ │ └── Icon-maskable-512.png │ ├── index.html │ └── manifest.json └── windows │ ├── .gitignore │ ├── CMakeLists.txt │ ├── flutter │ ├── CMakeLists.txt │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ └── generated_plugins.cmake │ └── runner │ ├── CMakeLists.txt │ ├── Runner.rc │ ├── flutter_window.cpp │ ├── flutter_window.h │ ├── main.cpp │ ├── resource.h │ ├── resources │ └── app_icon.ico │ ├── runner.exe.manifest │ ├── utils.cpp │ ├── utils.h │ ├── win32_window.cpp │ └── win32_window.h ├── lib ├── launch_at_startup.dart └── src │ ├── app_auto_launcher.dart │ ├── app_auto_launcher_impl_linux.dart │ ├── app_auto_launcher_impl_macos.dart │ ├── app_auto_launcher_impl_noop.dart │ ├── app_auto_launcher_impl_windows.dart │ ├── app_auto_launcher_impl_windows_noop.dart │ └── launch_at_startup.dart └── pubspec.yaml /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: lijy91 2 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: build 2 | 3 | on: 4 | push: 5 | branches: [main] 6 | pull_request: 7 | branches: [main] 8 | 9 | jobs: 10 | build-linux: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v2 14 | - uses: subosito/flutter-action@v2 15 | with: 16 | channel: stable 17 | flutter-version: 3.29.1 18 | - run: | 19 | sudo apt-get update -y 20 | sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev 21 | - run: flutter build linux -v 22 | working-directory: example 23 | 24 | # build-macos: 25 | # runs-on: macos-latest 26 | # steps: 27 | # - uses: actions/checkout@v2 28 | # - uses: subosito/flutter-action@v2 29 | # - run: flutter config --enable-macos-desktop 30 | # - run: cd example && flutter build macos -v 31 | 32 | build-windows: 33 | runs-on: windows-latest 34 | steps: 35 | - uses: actions/checkout@v2 36 | - uses: subosito/flutter-action@v2 37 | with: 38 | channel: stable 39 | flutter-version: 3.29.1 40 | - run: flutter build windows -v 41 | working-directory: example 42 | 43 | build-web: 44 | runs-on: ubuntu-latest 45 | steps: 46 | - uses: actions/checkout@v2 47 | - uses: subosito/flutter-action@v2 48 | with: 49 | channel: stable 50 | flutter-version: 3.29.1 51 | - run: flutter build web -v 52 | working-directory: example 53 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | name: lint 2 | 3 | on: 4 | push: 5 | branches: [main] 6 | pull_request: 7 | branches: [main] 8 | 9 | jobs: 10 | analyze: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v3 14 | - uses: subosito/flutter-action@v2 15 | with: 16 | channel: "stable" 17 | flutter-version: 3.29.1 18 | - run: flutter analyze --fatal-infos 19 | 20 | format: 21 | runs-on: ubuntu-latest 22 | steps: 23 | - uses: actions/checkout@v3 24 | - uses: subosito/flutter-action@v2 25 | with: 26 | channel: "stable" 27 | flutter-version: 3.29.1 28 | - run: dart format . --set-exit-if-changed 29 | 30 | dependency_validator: 31 | runs-on: ubuntu-latest 32 | steps: 33 | - uses: actions/checkout@v3 34 | - uses: subosito/flutter-action@v2 35 | with: 36 | channel: "stable" 37 | flutter-version: 3.29.1 38 | - run: flutter pub get 39 | - run: flutter pub run dependency_validator 40 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. 26 | /pubspec.lock 27 | **/doc/api/ 28 | .dart_tool/ 29 | .packages 30 | build/ 31 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 3595343e20a61ff16d14e8ecc25f364276bb1b8b 8 | channel: stable 9 | 10 | project_type: plugin 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.5.1 2 | 3 | - MSIX support args #37 4 | 5 | ## 0.4.0 6 | 7 | - Update plugin to use win32_registry version 2.0.0 #33 8 | 9 | ## 0.3.1 10 | 11 | - fix: web build error. 12 | 13 | ## 0.3.0 14 | 15 | * [windows] Add MSIX app support 16 | * [windows] fix: detect disabled/enabled register (#26) 17 | * [macos] macOS support API change to allow App Sandbox mode #27 18 | 19 | ## 0.2.2 20 | 21 | * add startup args for linux (#19) 22 | 23 | ## 0.2.1 24 | 25 | * feat: add interactive process type to MacOS #16 26 | 27 | ## 0.2.0 28 | 29 | - fix: web compile error #14 30 | 31 | ## 0.1.9 32 | 33 | - bump win32_registry to 1.0.2 #12 34 | 35 | ## 0.1.8 36 | 37 | - [windows] Fix incorrect setting/checking of registry value #10 38 | 39 | ## 0.1.7 40 | 41 | - [windows] Replace `win32` with `win32_registry` 42 | 43 | ## 0.1.6 44 | 45 | - [windows] fix: use correct max length of registry key # 46 | 47 | ## 0.1.5 48 | 49 | - [linux] Fixed wrong app name when writing .desktop file. #4 50 | 51 | ## 0.1.4 52 | 53 | - `pubspec.yaml` adds platforms field. 54 | 55 | ## 0.1.3 56 | 57 | - #3 Fix No such file or directory error. 58 | 59 | ## 0.1.2 60 | 61 | - #2 Fixed build web error. 62 | 63 | ## 0.1.1 64 | 65 | - Supported `linux` platform. 66 | 67 | ## 0.1.0 68 | 69 | - First release. 70 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023-present LiJianying 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README-ZH.md: -------------------------------------------------------------------------------- 1 | > **🚀 快速发布您的应用**: 试试 [Fastforge](https://fastforge.dev) - 构建、打包和分发您的 Flutter 应用最简单的方式。 2 | 3 | # launch_at_startup 4 | 5 | [![pub version][pub-image]][pub-url] [![][discord-image]][discord-url] ![][visits-count-image] 6 | 7 | [pub-image]: https://img.shields.io/pub/v/launch_at_startup.svg 8 | [pub-url]: https://pub.dev/packages/launch_at_startup 9 | [discord-image]: https://img.shields.io/discord/884679008049037342.svg 10 | [discord-url]: https://discord.gg/zPa6EZ2jqb 11 | [visits-count-image]: https://img.shields.io/badge/dynamic/json?label=Visits%20Count&query=value&url=https://api.countapi.xyz/hit/leanflutter.launch_at_startup/visits 12 | 13 | 这个插件允许 Flutter 桌面应用在启动/登录时自动启动。 14 | 15 | --- 16 | 17 | [English](./README.md) | 简体中文 18 | 19 | --- 20 | 21 | 22 | 23 | 24 | - [平台支持](#%E5%B9%B3%E5%8F%B0%E6%94%AF%E6%8C%81) 25 | - [快速开始](#%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8B) 26 | - [安装](#%E5%AE%89%E8%A3%85) 27 | - [用法](#%E7%94%A8%E6%B3%95) 28 | - [macOS 支持](#macos-%E6%94%AF%E6%8C%81) 29 | - [设置](#%E8%AE%BE%E7%BD%AE) 30 | - [要求](#%E8%A6%81%E6%B1%82) 31 | - [安装](#%E5%AE%89%E8%A3%85-1) 32 | - [用法](#%E7%94%A8%E6%B3%95-1) 33 | - [谁在用使用它?](#%E8%B0%81%E5%9C%A8%E7%94%A8%E4%BD%BF%E7%94%A8%E5%AE%83) 34 | - [许可证](#%E8%AE%B8%E5%8F%AF%E8%AF%81) 35 | 36 | 37 | 38 | ## 平台支持 39 | 40 | | Linux | macOS\* | Windows | 41 | | :---: | :-----: | :-----: | 42 | | ✔️ | ✔️ | ✔️ | 43 | 44 | > \*所需的 MACOS 支持安装说明 45 | 46 | ## 快速开始 47 | 48 | ### 安装 49 | 50 | 将此添加到你的软件包的 pubspec.yaml 文件: 51 | 52 | ```yaml 53 | dependencies: 54 | launch_at_startup: ^0.5.1 55 | ``` 56 | 57 | 或 58 | 59 | ```yaml 60 | dependencies: 61 | launch_at_startup: 62 | git: 63 | url: https://github.com/leanflutter/launch_at_startup.git 64 | ref: main 65 | ``` 66 | 67 | ### 用法 68 | 69 | ```dart 70 | import 'dart:io'; 71 | 72 | import 'package:launch_at_startup/launch_at_startup.dart'; 73 | import 'package:package_info_plus/package_info_plus.dart'; 74 | 75 | void main() async { 76 | WidgetsFlutterBinding.ensureInitialized(); 77 | 78 | PackageInfo packageInfo = await PackageInfo.fromPlatform(); 79 | 80 | launchAtStartup.setup( 81 | appName: packageInfo.appName, 82 | appPath: Platform.resolvedExecutable, 83 | // 设置 packageName 参数以支持 MSIX。 84 | packageName: 'dev.leanflutter.examples.launchatstartupexample', 85 | ); 86 | 87 | await launchAtStartup.enable(); 88 | await launchAtStartup.disable(); 89 | bool isEnabled = await launchAtStartup.isEnabled(); 90 | 91 | runApp(const MyApp()); 92 | } 93 | 94 | // ... 95 | 96 | ``` 97 | 98 | > 请看这个插件的示例应用,以了解完整的例子。 99 | 100 | ## macOS 支持 101 | 102 | ### 设置 103 | 104 | 将平台通道代码添加到您的 `macos/Runner/MainFlutterWindow.swift` 文件。 105 | 106 | ```swift 107 | import Cocoa 108 | import FlutterMacOS 109 | // Add the LaunchAtLogin module 110 | import LaunchAtLogin 111 | // 112 | 113 | class MainFlutterWindow: NSWindow { 114 | override func awakeFromNib() { 115 | let flutterViewController = FlutterViewController.init() 116 | let windowFrame = self.frame 117 | self.contentViewController = flutterViewController 118 | self.setFrame(windowFrame, display: true) 119 | 120 | // Add FlutterMethodChannel platform code 121 | FlutterMethodChannel( 122 | name: "launch_at_startup", binaryMessenger: flutterViewController.engine.binaryMessenger 123 | ) 124 | .setMethodCallHandler { (_ call: FlutterMethodCall, result: @escaping FlutterResult) in 125 | switch call.method { 126 | case "launchAtStartupIsEnabled": 127 | result(LaunchAtLogin.isEnabled) 128 | case "launchAtStartupSetEnabled": 129 | if let arguments = call.arguments as? [String: Any] { 130 | LaunchAtLogin.isEnabled = arguments["setEnabledValue"] as! Bool 131 | } 132 | result(nil) 133 | default: 134 | result(FlutterMethodNotImplemented) 135 | } 136 | } 137 | // 138 | 139 | RegisterGeneratedPlugins(registry: flutterViewController) 140 | 141 | super.awakeFromNib() 142 | } 143 | } 144 | 145 | ``` 146 | 147 | 然后在 Xcode 中打开`macos/`文件夹,然后执行以下操作: 148 | 149 | > 引用的说明 ["LaunchAtLogin" 软件包存储库](https://github.com/sindresorhus/LaunchAtLogin). 阅读以获取更多详细信息和常见问题解答。 150 | 151 | ### 要求 152 | 153 | macOS 10.13+ 154 | 155 | ### 安装 156 | 157 | 添加 `https://github.com/sindresorhus/LaunchAtLogin` 在里面 [“Swift Package Manager” XCode 中的选项卡](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app). 158 | 159 | ### 用法 160 | 161 | **如果您的应用程序将 MACOS 13 或更高版本定为目标,则跳过此步骤。** 162 | 163 | 添加一个新[“Run Script Phase”](http://stackoverflow.com/a/39633955/64949) **以下** (不进入)“Copy Bundle Resources” 在 “Build Phases” 与以下内容: 164 | 165 | ```sh 166 | "${BUILT_PRODUCTS_DIR}/LaunchAtLogin_LaunchAtLogin.bundle/Contents/Resources/copy-helper-swiftpm.sh" 167 | ``` 168 | 169 | 并取消选中“Based on dependency analysis”. 170 | 171 | 构建阶段无法运行"User Script Sandboxing"启用。使用 XCode 15 或默认情况下启用 XCode 15,请禁用"User Script Sandboxing"在构建设置中。 172 | 173 | _(它需要一些额外的作品才能让我们的脚本符合构建相位沙箱。)_ 174 | _(我会命名运行脚本`Copy “Launch at Login Helper”`)_ 175 | 176 | ## 谁在用使用它? 177 | 178 | - [Biyi (比译)](https://biyidev.com/) - 一个便捷的翻译和词典应用程序。 179 | 180 | ## 许可证 181 | 182 | [MIT](./LICENSE) 183 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > **🚀 Ship Your App Faster**: Try [Fastforge](https://fastforge.dev) - The simplest way to build, package and distribute your Flutter apps. 2 | 3 | # launch_at_startup 4 | 5 | [![pub version][pub-image]][pub-url] [![][discord-image]][discord-url] ![][visits-count-image] 6 | 7 | [pub-image]: https://img.shields.io/pub/v/launch_at_startup.svg 8 | [pub-url]: https://pub.dev/packages/launch_at_startup 9 | [discord-image]: https://img.shields.io/discord/884679008049037342.svg 10 | [discord-url]: https://discord.gg/zPa6EZ2jqb 11 | [visits-count-image]: https://img.shields.io/badge/dynamic/json?label=Visits%20Count&query=value&url=https://api.countapi.xyz/hit/leanflutter.launch_at_startup/visits 12 | 13 | This plugin allows Flutter desktop apps to Auto launch on startup / login. 14 | 15 | --- 16 | 17 | English | [简体中文](./README-ZH.md) 18 | 19 | --- 20 | 21 | 22 | 23 | 24 | - [Platform Support](#platform-support) 25 | - [Quick Start](#quick-start) 26 | - [Installation](#installation) 27 | - [Usage](#usage) 28 | - [MacOS Support](#macos-support) 29 | - [Setup](#setup) 30 | - [Requirements](#requirements) 31 | - [Install](#install) 32 | - [Usage](#usage-1) 33 | - [Who's using it?](#whos-using-it) 34 | - [License](#license) 35 | 36 | 37 | 38 | ## Platform Support 39 | 40 | | Linux | macOS\* | Windows | 41 | | :---: | :-----: | :-----: | 42 | | ✔️ | ✔️ | ✔️ | 43 | 44 | > \*Required macOS support installation instructions below 45 | 46 | ## Quick Start 47 | 48 | ### Installation 49 | 50 | Add this to your package's pubspec.yaml file: 51 | 52 | ```yaml 53 | dependencies: 54 | launch_at_startup: ^0.5.1 55 | ``` 56 | 57 | Or 58 | 59 | ```yaml 60 | dependencies: 61 | launch_at_startup: 62 | git: 63 | url: https://github.com/leanflutter/launch_at_startup.git 64 | ref: main 65 | ``` 66 | 67 | ### Usage 68 | 69 | ```dart 70 | import 'dart:io'; 71 | 72 | import 'package:launch_at_startup/launch_at_startup.dart'; 73 | import 'package:package_info_plus/package_info_plus.dart'; 74 | 75 | void main() async { 76 | WidgetsFlutterBinding.ensureInitialized(); 77 | 78 | PackageInfo packageInfo = await PackageInfo.fromPlatform(); 79 | 80 | launchAtStartup.setup( 81 | appName: packageInfo.appName, 82 | appPath: Platform.resolvedExecutable, 83 | // Set packageName parameter to support MSIX. 84 | packageName: 'dev.leanflutter.examples.launchatstartupexample', 85 | ); 86 | 87 | await launchAtStartup.enable(); 88 | await launchAtStartup.disable(); 89 | bool isEnabled = await launchAtStartup.isEnabled(); 90 | 91 | runApp(const MyApp()); 92 | } 93 | 94 | // ... 95 | 96 | ``` 97 | 98 | > Please see the example app of this plugin for a full example. 99 | 100 | ## macOS Support 101 | 102 | ### Setup 103 | 104 | Add platform channel code to your `macos/Runner/MainFlutterWindow.swift` file. 105 | 106 | ```swift 107 | import Cocoa 108 | import FlutterMacOS 109 | // Add the LaunchAtLogin module 110 | import LaunchAtLogin 111 | // 112 | 113 | class MainFlutterWindow: NSWindow { 114 | override func awakeFromNib() { 115 | let flutterViewController = FlutterViewController.init() 116 | let windowFrame = self.frame 117 | self.contentViewController = flutterViewController 118 | self.setFrame(windowFrame, display: true) 119 | 120 | // Add FlutterMethodChannel platform code 121 | FlutterMethodChannel( 122 | name: "launch_at_startup", binaryMessenger: flutterViewController.engine.binaryMessenger 123 | ) 124 | .setMethodCallHandler { (_ call: FlutterMethodCall, result: @escaping FlutterResult) in 125 | switch call.method { 126 | case "launchAtStartupIsEnabled": 127 | result(LaunchAtLogin.isEnabled) 128 | case "launchAtStartupSetEnabled": 129 | if let arguments = call.arguments as? [String: Any] { 130 | LaunchAtLogin.isEnabled = arguments["setEnabledValue"] as! Bool 131 | } 132 | result(nil) 133 | default: 134 | result(FlutterMethodNotImplemented) 135 | } 136 | } 137 | // 138 | 139 | RegisterGeneratedPlugins(registry: flutterViewController) 140 | 141 | super.awakeFromNib() 142 | } 143 | } 144 | 145 | ``` 146 | 147 | then open your `macos/` folder in Xcode and do the following: 148 | 149 | > Instructions referenced from ["LaunchAtLogin" package repository](https://github.com/sindresorhus/LaunchAtLogin). Read for more details and FAQ's. 150 | 151 | ### Requirements 152 | 153 | macOS 10.13+ 154 | 155 | ### Install 156 | 157 | Add `https://github.com/sindresorhus/LaunchAtLogin` in the [“Swift Package Manager” tab in Xcode](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app). 158 | 159 | ### Usage 160 | 161 | **Skip this step if your app targets macOS 13 or later.** 162 | 163 | Add a new [“Run Script Phase”](http://stackoverflow.com/a/39633955/64949) **below** (not into) “Copy Bundle Resources” in “Build Phases” with the following: 164 | 165 | ```sh 166 | "${BUILT_PRODUCTS_DIR}/LaunchAtLogin_LaunchAtLogin.bundle/Contents/Resources/copy-helper-swiftpm.sh" 167 | ``` 168 | 169 | And uncheck “Based on dependency analysis”. 170 | 171 | The build phase cannot run with "User Script Sandboxing" enabled. With Xcode 15 or newer where it is enabled by default, disable "User Script Sandboxing" in build settings. 172 | 173 | _(It needs some extra works to have our script to comply with the build phase sandbox.)_ 174 | _(I would name the run script `Copy “Launch at Login Helper”`)_ 175 | 176 | ## Who's using it? 177 | 178 | - [Biyi (比译)](https://biyidev.com/) - A convenient translation and dictionary app. 179 | 180 | ## License 181 | 182 | [MIT](./LICENSE) 183 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:mostly_reasonable_lints/analysis_options.yaml 2 | -------------------------------------------------------------------------------- /dart_dependency_validator.yaml: -------------------------------------------------------------------------------- 1 | exclude: 2 | - "example/**" 3 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .build/ 9 | .buildlog/ 10 | .history 11 | .svn/ 12 | .swiftpm/ 13 | migrate_working_dir/ 14 | 15 | # IntelliJ related 16 | *.iml 17 | *.ipr 18 | *.iws 19 | .idea/ 20 | 21 | # The .vscode folder contains launch configuration and tasks you configure in 22 | # VS Code which you may wish to be included in version control, so this line 23 | # is commented out by default. 24 | #.vscode/ 25 | 26 | # Flutter/Dart/Pub related 27 | **/doc/api/ 28 | **/ios/Flutter/.last_build_id 29 | .dart_tool/ 30 | .flutter-plugins 31 | .flutter-plugins-dependencies 32 | .packages 33 | .pub-cache/ 34 | .pub/ 35 | /build/ 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Android Studio will place build artifacts here 44 | /android/app/debug 45 | /android/app/profile 46 | /android/app/release 47 | -------------------------------------------------------------------------------- /example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: "761747bfc538b5af34aa0d3fac380f1bc331ec49" 8 | channel: "stable" 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 17 | base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 18 | - platform: web 19 | create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 20 | base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 21 | 22 | # User provided section 23 | 24 | # List of Local paths (relative to this file) that should be 25 | # ignored by the migrate tool. 26 | # 27 | # Files that are not part of the templates will be ignored by default. 28 | unmanaged_files: 29 | - 'lib/main.dart' 30 | - 'ios/Runner.xcodeproj/project.pbxproj' 31 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # launch_at_startup_example 2 | 3 | Demonstrates how to use the launch_at_startup plugin. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:mostly_reasonable_lints/analysis_options.yaml 2 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:bot_toast/bot_toast.dart'; 4 | import 'package:flutter/foundation.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:launch_at_startup/launch_at_startup.dart'; 7 | import 'package:package_info_plus/package_info_plus.dart'; 8 | 9 | Future main() async { 10 | WidgetsFlutterBinding.ensureInitialized(); 11 | 12 | if (!kIsWeb) { 13 | PackageInfo packageInfo = await PackageInfo.fromPlatform(); 14 | launchAtStartup.setup( 15 | appName: packageInfo.appName, 16 | appPath: Platform.resolvedExecutable, 17 | packageName: 'dev.leanflutter.examples.launchatstartupexample', 18 | ); 19 | } 20 | 21 | runApp(const MyApp()); 22 | } 23 | 24 | class MyApp extends StatefulWidget { 25 | const MyApp({super.key}); 26 | 27 | @override 28 | State createState() => _MyAppState(); 29 | } 30 | 31 | class _MyAppState extends State { 32 | @override 33 | Widget build(BuildContext context) { 34 | return MaterialApp( 35 | builder: BotToastInit(), 36 | navigatorObservers: [BotToastNavigatorObserver()], 37 | home: const HomePage(), 38 | ); 39 | } 40 | } 41 | 42 | class HomePage extends StatefulWidget { 43 | const HomePage({super.key}); 44 | 45 | @override 46 | State createState() => _HomePageState(); 47 | } 48 | 49 | class _HomePageState extends State { 50 | bool _isEnabled = false; 51 | 52 | @override 53 | void initState() { 54 | super.initState(); 55 | _init(); 56 | } 57 | 58 | _init() async { 59 | _isEnabled = await launchAtStartup.isEnabled(); 60 | setState(() {}); 61 | } 62 | 63 | _handleEnable() async { 64 | await launchAtStartup.enable(); 65 | await _init(); 66 | } 67 | 68 | _handleDisable() async { 69 | await launchAtStartup.disable(); 70 | await _init(); 71 | } 72 | 73 | Widget _buildBody(BuildContext context) { 74 | return ListView( 75 | children: [ 76 | ListTile( 77 | title: const Text('enable'), 78 | onTap: _handleEnable, 79 | ), 80 | ListTile( 81 | title: const Text('disable'), 82 | onTap: _handleDisable, 83 | ), 84 | ListTile( 85 | title: const Text('isEnabled'), 86 | trailing: Text('$_isEnabled'), 87 | ), 88 | ], 89 | ); 90 | } 91 | 92 | @override 93 | Widget build(BuildContext context) { 94 | return Scaffold( 95 | appBar: AppBar( 96 | title: const Text('Plugin example app'), 97 | ), 98 | body: _buildBody(context), 99 | ); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /example/lib/pages/home.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:bot_toast/bot_toast.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:launch_at_startup/launch_at_startup.dart'; 6 | import 'package:package_info_plus/package_info_plus.dart'; 7 | import 'package:preference_list/preference_list.dart'; 8 | 9 | class HomePage extends StatefulWidget { 10 | const HomePage({super.key}); 11 | 12 | @override 13 | State createState() => _HomePageState(); 14 | } 15 | 16 | class _HomePageState extends State { 17 | PackageInfo? _packageInfo; 18 | bool _isEnabled = false; 19 | 20 | @override 21 | void initState() { 22 | super.initState(); 23 | _init(); 24 | } 25 | 26 | _init() async { 27 | _packageInfo = await PackageInfo.fromPlatform(); 28 | _isEnabled = await launchAtStartup.isEnabled(); 29 | setState(() {}); 30 | } 31 | 32 | _handleEnable() async { 33 | try { 34 | await launchAtStartup.enable(); 35 | } catch (error) { 36 | BotToast.showText(text: error.toString()); 37 | } 38 | await _init(); 39 | } 40 | 41 | _handleDisable() async { 42 | try { 43 | await launchAtStartup.disable(); 44 | } catch (error) { 45 | BotToast.showText(text: error.toString()); 46 | } 47 | await _init(); 48 | } 49 | 50 | Widget _buildBody(BuildContext context) { 51 | return PreferenceList( 52 | children: [ 53 | PreferenceListSection( 54 | children: [ 55 | PreferenceListItem( 56 | title: Text('App name: ${_packageInfo?.appName}'), 57 | ), 58 | PreferenceListItem( 59 | title: Text('App path: ${Platform.resolvedExecutable}'), 60 | ), 61 | PreferenceListItem( 62 | title: Text('Version: ${_packageInfo?.version}'), 63 | ), 64 | PreferenceListItem( 65 | title: Text('Build number: ${_packageInfo?.buildNumber}'), 66 | ), 67 | ], 68 | ), 69 | PreferenceListSection( 70 | title: const Text('Methods'), 71 | children: [ 72 | PreferenceListItem( 73 | title: const Text('enable'), 74 | onTap: _handleEnable, 75 | ), 76 | PreferenceListItem( 77 | title: const Text('disable'), 78 | onTap: _handleDisable, 79 | ), 80 | PreferenceListItem( 81 | title: const Text('isEnabled'), 82 | accessoryView: Text('$_isEnabled'), 83 | ), 84 | ], 85 | ), 86 | ], 87 | ); 88 | } 89 | 90 | @override 91 | Widget build(BuildContext context) { 92 | return Scaffold( 93 | appBar: AppBar( 94 | title: const Text('Plugin example app'), 95 | ), 96 | body: _buildBody(context), 97 | ); 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /example/linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /example/linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | project(runner LANGUAGES CXX) 3 | 4 | set(BINARY_NAME "example") 5 | set(APPLICATION_ID "com.example.example") 6 | 7 | cmake_policy(SET CMP0063 NEW) 8 | 9 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 10 | 11 | # Root filesystem for cross-building. 12 | if(FLUTTER_TARGET_PLATFORM_SYSROOT) 13 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) 14 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) 15 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 16 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 17 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 18 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 19 | endif() 20 | 21 | # Configure build options. 22 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 23 | set(CMAKE_BUILD_TYPE "Debug" CACHE 24 | STRING "Flutter build mode" FORCE) 25 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 26 | "Debug" "Profile" "Release") 27 | endif() 28 | 29 | # Compilation settings that should be applied to most targets. 30 | function(APPLY_STANDARD_SETTINGS TARGET) 31 | target_compile_features(${TARGET} PUBLIC cxx_std_14) 32 | target_compile_options(${TARGET} PRIVATE -Wall -Werror) 33 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") 34 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") 35 | endfunction() 36 | 37 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 38 | 39 | # Flutter library and tool build rules. 40 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 41 | 42 | # System-level dependencies. 43 | find_package(PkgConfig REQUIRED) 44 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 45 | 46 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") 47 | 48 | # Application build 49 | add_executable(${BINARY_NAME} 50 | "main.cc" 51 | "my_application.cc" 52 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 53 | ) 54 | apply_standard_settings(${BINARY_NAME}) 55 | target_link_libraries(${BINARY_NAME} PRIVATE flutter) 56 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) 57 | add_dependencies(${BINARY_NAME} flutter_assemble) 58 | # Only the install-generated bundle's copy of the executable will launch 59 | # correctly, since the resources must in the right relative locations. To avoid 60 | # people trying to run the unbundled copy, put it in a subdirectory instead of 61 | # the default top-level location. 62 | set_target_properties(${BINARY_NAME} 63 | PROPERTIES 64 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" 65 | ) 66 | 67 | # Generated plugin build rules, which manage building the plugins and adding 68 | # them to the application. 69 | include(flutter/generated_plugins.cmake) 70 | 71 | 72 | # === Installation === 73 | # By default, "installing" just makes a relocatable bundle in the build 74 | # directory. 75 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") 76 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 77 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 78 | endif() 79 | 80 | # Start with a clean build bundle directory every time. 81 | install(CODE " 82 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") 83 | " COMPONENT Runtime) 84 | 85 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 86 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") 87 | 88 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 89 | COMPONENT Runtime) 90 | 91 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 92 | COMPONENT Runtime) 93 | 94 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 95 | COMPONENT Runtime) 96 | 97 | if(PLUGIN_BUNDLED_LIBRARIES) 98 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 99 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 100 | COMPONENT Runtime) 101 | endif() 102 | 103 | # Fully re-copy the assets directory on each build to avoid having stale files 104 | # from a previous install. 105 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 106 | install(CODE " 107 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 108 | " COMPONENT Runtime) 109 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 110 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 111 | 112 | # Install the AOT library on non-Debug builds only. 113 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") 114 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 115 | COMPONENT Runtime) 116 | endif() 117 | -------------------------------------------------------------------------------- /example/linux/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | 3 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 4 | 5 | # Configuration provided via flutter tool. 6 | include(${EPHEMERAL_DIR}/generated_config.cmake) 7 | 8 | # TODO: Move the rest of this into files in ephemeral. See 9 | # https://github.com/flutter/flutter/issues/57146. 10 | 11 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...), 12 | # which isn't available in 3.10. 13 | function(list_prepend LIST_NAME PREFIX) 14 | set(NEW_LIST "") 15 | foreach(element ${${LIST_NAME}}) 16 | list(APPEND NEW_LIST "${PREFIX}${element}") 17 | endforeach(element) 18 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) 19 | endfunction() 20 | 21 | # === Flutter Library === 22 | # System-level dependencies. 23 | find_package(PkgConfig REQUIRED) 24 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 25 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) 26 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) 27 | 28 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") 29 | 30 | # Published to parent scope for install step. 31 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 32 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 33 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 34 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) 35 | 36 | list(APPEND FLUTTER_LIBRARY_HEADERS 37 | "fl_basic_message_channel.h" 38 | "fl_binary_codec.h" 39 | "fl_binary_messenger.h" 40 | "fl_dart_project.h" 41 | "fl_engine.h" 42 | "fl_json_message_codec.h" 43 | "fl_json_method_codec.h" 44 | "fl_message_codec.h" 45 | "fl_method_call.h" 46 | "fl_method_channel.h" 47 | "fl_method_codec.h" 48 | "fl_method_response.h" 49 | "fl_plugin_registrar.h" 50 | "fl_plugin_registry.h" 51 | "fl_standard_message_codec.h" 52 | "fl_standard_method_codec.h" 53 | "fl_string_codec.h" 54 | "fl_value.h" 55 | "fl_view.h" 56 | "flutter_linux.h" 57 | ) 58 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") 59 | add_library(flutter INTERFACE) 60 | target_include_directories(flutter INTERFACE 61 | "${EPHEMERAL_DIR}" 62 | ) 63 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") 64 | target_link_libraries(flutter INTERFACE 65 | PkgConfig::GTK 66 | PkgConfig::GLIB 67 | PkgConfig::GIO 68 | ) 69 | add_dependencies(flutter flutter_assemble) 70 | 71 | # === Flutter tool backend === 72 | # _phony_ is a non-existent file to force this command to run every time, 73 | # since currently there's no way to get a full input/output list from the 74 | # flutter tool. 75 | add_custom_command( 76 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 77 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_ 78 | COMMAND ${CMAKE_COMMAND} -E env 79 | ${FLUTTER_TOOL_ENVIRONMENT} 80 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" 81 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} 82 | VERBATIM 83 | ) 84 | add_custom_target(flutter_assemble DEPENDS 85 | "${FLUTTER_LIBRARY}" 86 | ${FLUTTER_LIBRARY_HEADERS} 87 | ) 88 | -------------------------------------------------------------------------------- /example/linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void fl_register_plugins(FlPluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /example/linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /example/linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /example/linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /example/linux/my_application.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | #include 4 | #ifdef GDK_WINDOWING_X11 5 | #include 6 | #endif 7 | 8 | #include "flutter/generated_plugin_registrant.h" 9 | 10 | struct _MyApplication { 11 | GtkApplication parent_instance; 12 | char** dart_entrypoint_arguments; 13 | }; 14 | 15 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) 16 | 17 | // Implements GApplication::activate. 18 | static void my_application_activate(GApplication* application) { 19 | MyApplication* self = MY_APPLICATION(application); 20 | GtkWindow* window = 21 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); 22 | 23 | // Use a header bar when running in GNOME as this is the common style used 24 | // by applications and is the setup most users will be using (e.g. Ubuntu 25 | // desktop). 26 | // If running on X and not using GNOME then just use a traditional title bar 27 | // in case the window manager does more exotic layout, e.g. tiling. 28 | // If running on Wayland assume the header bar will work (may need changing 29 | // if future cases occur). 30 | gboolean use_header_bar = TRUE; 31 | #ifdef GDK_WINDOWING_X11 32 | GdkScreen* screen = gtk_window_get_screen(window); 33 | if (GDK_IS_X11_SCREEN(screen)) { 34 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); 35 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) { 36 | use_header_bar = FALSE; 37 | } 38 | } 39 | #endif 40 | if (use_header_bar) { 41 | GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); 42 | gtk_widget_show(GTK_WIDGET(header_bar)); 43 | gtk_header_bar_set_title(header_bar, "example"); 44 | gtk_header_bar_set_show_close_button(header_bar, TRUE); 45 | gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); 46 | } else { 47 | gtk_window_set_title(window, "example"); 48 | } 49 | 50 | gtk_window_set_default_size(window, 1280, 720); 51 | gtk_widget_show(GTK_WIDGET(window)); 52 | 53 | g_autoptr(FlDartProject) project = fl_dart_project_new(); 54 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); 55 | 56 | FlView* view = fl_view_new(project); 57 | gtk_widget_show(GTK_WIDGET(view)); 58 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); 59 | 60 | fl_register_plugins(FL_PLUGIN_REGISTRY(view)); 61 | 62 | gtk_widget_grab_focus(GTK_WIDGET(view)); 63 | } 64 | 65 | // Implements GApplication::local_command_line. 66 | static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { 67 | MyApplication* self = MY_APPLICATION(application); 68 | // Strip out the first argument as it is the binary name. 69 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); 70 | 71 | g_autoptr(GError) error = nullptr; 72 | if (!g_application_register(application, nullptr, &error)) { 73 | g_warning("Failed to register: %s", error->message); 74 | *exit_status = 1; 75 | return TRUE; 76 | } 77 | 78 | g_application_activate(application); 79 | *exit_status = 0; 80 | 81 | return TRUE; 82 | } 83 | 84 | // Implements GObject::dispose. 85 | static void my_application_dispose(GObject* object) { 86 | MyApplication* self = MY_APPLICATION(object); 87 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); 88 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object); 89 | } 90 | 91 | static void my_application_class_init(MyApplicationClass* klass) { 92 | G_APPLICATION_CLASS(klass)->activate = my_application_activate; 93 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; 94 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose; 95 | } 96 | 97 | static void my_application_init(MyApplication* self) {} 98 | 99 | MyApplication* my_application_new() { 100 | return MY_APPLICATION(g_object_new(my_application_get_type(), 101 | "application-id", APPLICATION_ID, 102 | "flags", G_APPLICATION_NON_UNIQUE, 103 | nullptr)); 104 | } 105 | -------------------------------------------------------------------------------- /example/linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /example/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /example/macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import package_info_plus 9 | 10 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 11 | FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) 12 | } 13 | -------------------------------------------------------------------------------- /example/macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.14' 2 | 3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 5 | 6 | project 'Runner', { 7 | 'Debug' => :debug, 8 | 'Profile' => :release, 9 | 'Release' => :release, 10 | } 11 | 12 | def flutter_root 13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) 14 | unless File.exist?(generated_xcode_build_settings_path) 15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" 16 | end 17 | 18 | File.foreach(generated_xcode_build_settings_path) do |line| 19 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 20 | return matches[1].strip if matches 21 | end 22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" 23 | end 24 | 25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 26 | 27 | flutter_macos_podfile_setup 28 | 29 | target 'Runner' do 30 | use_frameworks! 31 | use_modular_headers! 32 | 33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) 34 | end 35 | 36 | post_install do |installer| 37 | installer.pods_project.targets.each do |target| 38 | flutter_additional_macos_build_settings(target) 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /example/macos/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - FlutterMacOS (1.0.0) 3 | - package_info_plus (0.0.1): 4 | - FlutterMacOS 5 | 6 | DEPENDENCIES: 7 | - FlutterMacOS (from `Flutter/ephemeral`) 8 | - package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`) 9 | 10 | EXTERNAL SOURCES: 11 | FlutterMacOS: 12 | :path: Flutter/ephemeral 13 | package_info_plus: 14 | :path: Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos 15 | 16 | SPEC CHECKSUMS: 17 | FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 18 | package_info_plus: fa739dd842b393193c5ca93c26798dff6e3d0e0c 19 | 20 | PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7 21 | 22 | COCOAPODS: 1.14.3 23 | -------------------------------------------------------------------------------- /example/macos/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 54; 7 | objects = { 8 | 9 | /* Begin PBXAggregateTarget section */ 10 | 33CC111A2044C6BA0003C045 /* Flutter Assemble */ = { 11 | isa = PBXAggregateTarget; 12 | buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */; 13 | buildPhases = ( 14 | 33CC111E2044C6BF0003C045 /* ShellScript */, 15 | ); 16 | dependencies = ( 17 | ); 18 | name = "Flutter Assemble"; 19 | productName = FLX; 20 | }; 21 | /* End PBXAggregateTarget section */ 22 | 23 | /* Begin PBXBuildFile section */ 24 | 08CD13E96159E0EA9FB010F1 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA21E982C1D5D63D85D7F64A /* Pods_Runner.framework */; }; 25 | 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; 26 | 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; 27 | 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; 28 | 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 29 | 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; 30 | 600D5DF32BC6A289005DE406 /* LaunchAtLogin in Frameworks */ = {isa = PBXBuildFile; productRef = 600D5DF22BC6A289005DE406 /* LaunchAtLogin */; }; 31 | /* End PBXBuildFile section */ 32 | 33 | /* Begin PBXContainerItemProxy section */ 34 | 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = { 35 | isa = PBXContainerItemProxy; 36 | containerPortal = 33CC10E52044A3C60003C045 /* Project object */; 37 | proxyType = 1; 38 | remoteGlobalIDString = 33CC111A2044C6BA0003C045; 39 | remoteInfo = FLX; 40 | }; 41 | /* End PBXContainerItemProxy section */ 42 | 43 | /* Begin PBXCopyFilesBuildPhase section */ 44 | 33CC110E2044A8840003C045 /* Bundle Framework */ = { 45 | isa = PBXCopyFilesBuildPhase; 46 | buildActionMask = 2147483647; 47 | dstPath = ""; 48 | dstSubfolderSpec = 10; 49 | files = ( 50 | ); 51 | name = "Bundle Framework"; 52 | runOnlyForDeploymentPostprocessing = 0; 53 | }; 54 | /* End PBXCopyFilesBuildPhase section */ 55 | 56 | /* Begin PBXFileReference section */ 57 | 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; 58 | 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; 59 | 33CC10ED2044A3C60003C045 /* launch_at_startup_example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = launch_at_startup_example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 60 | 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 61 | 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; 62 | 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; 63 | 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = ""; }; 64 | 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = ""; }; 65 | 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; }; 66 | 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; }; 67 | 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; }; 68 | 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; 69 | 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; 70 | 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; 71 | 463B6A5B683CEDB996943497 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 72 | 4773F8714300635FFECB3173 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 73 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; 74 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; 75 | AA21E982C1D5D63D85D7F64A /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 76 | D4E94FD8D3B69D7F3A271EF0 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 77 | /* End PBXFileReference section */ 78 | 79 | /* Begin PBXFrameworksBuildPhase section */ 80 | 33CC10EA2044A3C60003C045 /* Frameworks */ = { 81 | isa = PBXFrameworksBuildPhase; 82 | buildActionMask = 2147483647; 83 | files = ( 84 | 600D5DF32BC6A289005DE406 /* LaunchAtLogin in Frameworks */, 85 | 08CD13E96159E0EA9FB010F1 /* Pods_Runner.framework in Frameworks */, 86 | ); 87 | runOnlyForDeploymentPostprocessing = 0; 88 | }; 89 | /* End PBXFrameworksBuildPhase section */ 90 | 91 | /* Begin PBXGroup section */ 92 | 33BA886A226E78AF003329D5 /* Configs */ = { 93 | isa = PBXGroup; 94 | children = ( 95 | 33E5194F232828860026EE4D /* AppInfo.xcconfig */, 96 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 97 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 98 | 333000ED22D3DE5D00554162 /* Warnings.xcconfig */, 99 | ); 100 | path = Configs; 101 | sourceTree = ""; 102 | }; 103 | 33CC10E42044A3C60003C045 = { 104 | isa = PBXGroup; 105 | children = ( 106 | 33FAB671232836740065AC1E /* Runner */, 107 | 33CEB47122A05771004F2AC0 /* Flutter */, 108 | 33CC10EE2044A3C60003C045 /* Products */, 109 | D73912EC22F37F3D000D13A0 /* Frameworks */, 110 | A0D7482C5B8765CB7CAD5A24 /* Pods */, 111 | ); 112 | sourceTree = ""; 113 | }; 114 | 33CC10EE2044A3C60003C045 /* Products */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | 33CC10ED2044A3C60003C045 /* launch_at_startup_example.app */, 118 | ); 119 | name = Products; 120 | sourceTree = ""; 121 | }; 122 | 33CC11242044D66E0003C045 /* Resources */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | 33CC10F22044A3C60003C045 /* Assets.xcassets */, 126 | 33CC10F42044A3C60003C045 /* MainMenu.xib */, 127 | 33CC10F72044A3C60003C045 /* Info.plist */, 128 | ); 129 | name = Resources; 130 | path = ..; 131 | sourceTree = ""; 132 | }; 133 | 33CEB47122A05771004F2AC0 /* Flutter */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */, 137 | 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, 138 | 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, 139 | 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, 140 | ); 141 | path = Flutter; 142 | sourceTree = ""; 143 | }; 144 | 33FAB671232836740065AC1E /* Runner */ = { 145 | isa = PBXGroup; 146 | children = ( 147 | 33CC10F02044A3C60003C045 /* AppDelegate.swift */, 148 | 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */, 149 | 33E51913231747F40026EE4D /* DebugProfile.entitlements */, 150 | 33E51914231749380026EE4D /* Release.entitlements */, 151 | 33CC11242044D66E0003C045 /* Resources */, 152 | 33BA886A226E78AF003329D5 /* Configs */, 153 | ); 154 | path = Runner; 155 | sourceTree = ""; 156 | }; 157 | A0D7482C5B8765CB7CAD5A24 /* Pods */ = { 158 | isa = PBXGroup; 159 | children = ( 160 | D4E94FD8D3B69D7F3A271EF0 /* Pods-Runner.debug.xcconfig */, 161 | 4773F8714300635FFECB3173 /* Pods-Runner.release.xcconfig */, 162 | 463B6A5B683CEDB996943497 /* Pods-Runner.profile.xcconfig */, 163 | ); 164 | path = Pods; 165 | sourceTree = ""; 166 | }; 167 | D73912EC22F37F3D000D13A0 /* Frameworks */ = { 168 | isa = PBXGroup; 169 | children = ( 170 | AA21E982C1D5D63D85D7F64A /* Pods_Runner.framework */, 171 | ); 172 | name = Frameworks; 173 | sourceTree = ""; 174 | }; 175 | /* End PBXGroup section */ 176 | 177 | /* Begin PBXNativeTarget section */ 178 | 33CC10EC2044A3C60003C045 /* Runner */ = { 179 | isa = PBXNativeTarget; 180 | buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; 181 | buildPhases = ( 182 | EF76E9F0F6E408348B5E8084 /* [CP] Check Pods Manifest.lock */, 183 | 33CC10E92044A3C60003C045 /* Sources */, 184 | 33CC10EA2044A3C60003C045 /* Frameworks */, 185 | 33CC10EB2044A3C60003C045 /* Resources */, 186 | 600D5DF42BC6A2AF005DE406 /* Copy "Launch at Login Helper" */, 187 | 33CC110E2044A8840003C045 /* Bundle Framework */, 188 | 3399D490228B24CF009A79C7 /* ShellScript */, 189 | 8B970F693470FFEC9D43232F /* [CP] Embed Pods Frameworks */, 190 | ); 191 | buildRules = ( 192 | ); 193 | dependencies = ( 194 | 33CC11202044C79F0003C045 /* PBXTargetDependency */, 195 | ); 196 | name = Runner; 197 | packageProductDependencies = ( 198 | 600D5DF22BC6A289005DE406 /* LaunchAtLogin */, 199 | ); 200 | productName = Runner; 201 | productReference = 33CC10ED2044A3C60003C045 /* launch_at_startup_example.app */; 202 | productType = "com.apple.product-type.application"; 203 | }; 204 | /* End PBXNativeTarget section */ 205 | 206 | /* Begin PBXProject section */ 207 | 33CC10E52044A3C60003C045 /* Project object */ = { 208 | isa = PBXProject; 209 | attributes = { 210 | LastSwiftUpdateCheck = 0920; 211 | LastUpgradeCheck = 1510; 212 | ORGANIZATIONNAME = ""; 213 | TargetAttributes = { 214 | 33CC10EC2044A3C60003C045 = { 215 | CreatedOnToolsVersion = 9.2; 216 | LastSwiftMigration = 1100; 217 | ProvisioningStyle = Automatic; 218 | SystemCapabilities = { 219 | com.apple.Sandbox = { 220 | enabled = 1; 221 | }; 222 | }; 223 | }; 224 | 33CC111A2044C6BA0003C045 = { 225 | CreatedOnToolsVersion = 9.2; 226 | ProvisioningStyle = Manual; 227 | }; 228 | }; 229 | }; 230 | buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; 231 | compatibilityVersion = "Xcode 9.3"; 232 | developmentRegion = en; 233 | hasScannedForEncodings = 0; 234 | knownRegions = ( 235 | en, 236 | Base, 237 | ); 238 | mainGroup = 33CC10E42044A3C60003C045; 239 | packageReferences = ( 240 | 600D5DF12BC6A289005DE406 /* XCRemoteSwiftPackageReference "LaunchAtLogin" */, 241 | ); 242 | productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; 243 | projectDirPath = ""; 244 | projectRoot = ""; 245 | targets = ( 246 | 33CC10EC2044A3C60003C045 /* Runner */, 247 | 33CC111A2044C6BA0003C045 /* Flutter Assemble */, 248 | ); 249 | }; 250 | /* End PBXProject section */ 251 | 252 | /* Begin PBXResourcesBuildPhase section */ 253 | 33CC10EB2044A3C60003C045 /* Resources */ = { 254 | isa = PBXResourcesBuildPhase; 255 | buildActionMask = 2147483647; 256 | files = ( 257 | 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, 258 | 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, 259 | ); 260 | runOnlyForDeploymentPostprocessing = 0; 261 | }; 262 | /* End PBXResourcesBuildPhase section */ 263 | 264 | /* Begin PBXShellScriptBuildPhase section */ 265 | 3399D490228B24CF009A79C7 /* ShellScript */ = { 266 | isa = PBXShellScriptBuildPhase; 267 | alwaysOutOfDate = 1; 268 | buildActionMask = 2147483647; 269 | files = ( 270 | ); 271 | inputFileListPaths = ( 272 | ); 273 | inputPaths = ( 274 | ); 275 | outputFileListPaths = ( 276 | ); 277 | outputPaths = ( 278 | ); 279 | runOnlyForDeploymentPostprocessing = 0; 280 | shellPath = /bin/sh; 281 | shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; 282 | }; 283 | 33CC111E2044C6BF0003C045 /* ShellScript */ = { 284 | isa = PBXShellScriptBuildPhase; 285 | buildActionMask = 2147483647; 286 | files = ( 287 | ); 288 | inputFileListPaths = ( 289 | Flutter/ephemeral/FlutterInputs.xcfilelist, 290 | ); 291 | inputPaths = ( 292 | Flutter/ephemeral/tripwire, 293 | ); 294 | outputFileListPaths = ( 295 | Flutter/ephemeral/FlutterOutputs.xcfilelist, 296 | ); 297 | outputPaths = ( 298 | ); 299 | runOnlyForDeploymentPostprocessing = 0; 300 | shellPath = /bin/sh; 301 | shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; 302 | }; 303 | 600D5DF42BC6A2AF005DE406 /* Copy "Launch at Login Helper" */ = { 304 | isa = PBXShellScriptBuildPhase; 305 | alwaysOutOfDate = 1; 306 | buildActionMask = 2147483647; 307 | files = ( 308 | ); 309 | inputFileListPaths = ( 310 | ); 311 | inputPaths = ( 312 | ); 313 | name = "Copy \"Launch at Login Helper\""; 314 | outputFileListPaths = ( 315 | ); 316 | outputPaths = ( 317 | ); 318 | runOnlyForDeploymentPostprocessing = 0; 319 | shellPath = /bin/sh; 320 | shellScript = "\"${BUILT_PRODUCTS_DIR}/LaunchAtLogin_LaunchAtLogin.bundle/Contents/Resources/copy-helper-swiftpm.sh\"\n"; 321 | }; 322 | 8B970F693470FFEC9D43232F /* [CP] Embed Pods Frameworks */ = { 323 | isa = PBXShellScriptBuildPhase; 324 | buildActionMask = 2147483647; 325 | files = ( 326 | ); 327 | inputFileListPaths = ( 328 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", 329 | ); 330 | name = "[CP] Embed Pods Frameworks"; 331 | outputFileListPaths = ( 332 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", 333 | ); 334 | runOnlyForDeploymentPostprocessing = 0; 335 | shellPath = /bin/sh; 336 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; 337 | showEnvVarsInLog = 0; 338 | }; 339 | EF76E9F0F6E408348B5E8084 /* [CP] Check Pods Manifest.lock */ = { 340 | isa = PBXShellScriptBuildPhase; 341 | buildActionMask = 2147483647; 342 | files = ( 343 | ); 344 | inputFileListPaths = ( 345 | ); 346 | inputPaths = ( 347 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 348 | "${PODS_ROOT}/Manifest.lock", 349 | ); 350 | name = "[CP] Check Pods Manifest.lock"; 351 | outputFileListPaths = ( 352 | ); 353 | outputPaths = ( 354 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", 355 | ); 356 | runOnlyForDeploymentPostprocessing = 0; 357 | shellPath = /bin/sh; 358 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 359 | showEnvVarsInLog = 0; 360 | }; 361 | /* End PBXShellScriptBuildPhase section */ 362 | 363 | /* Begin PBXSourcesBuildPhase section */ 364 | 33CC10E92044A3C60003C045 /* Sources */ = { 365 | isa = PBXSourcesBuildPhase; 366 | buildActionMask = 2147483647; 367 | files = ( 368 | 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */, 369 | 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */, 370 | 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */, 371 | ); 372 | runOnlyForDeploymentPostprocessing = 0; 373 | }; 374 | /* End PBXSourcesBuildPhase section */ 375 | 376 | /* Begin PBXTargetDependency section */ 377 | 33CC11202044C79F0003C045 /* PBXTargetDependency */ = { 378 | isa = PBXTargetDependency; 379 | target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */; 380 | targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */; 381 | }; 382 | /* End PBXTargetDependency section */ 383 | 384 | /* Begin PBXVariantGroup section */ 385 | 33CC10F42044A3C60003C045 /* MainMenu.xib */ = { 386 | isa = PBXVariantGroup; 387 | children = ( 388 | 33CC10F52044A3C60003C045 /* Base */, 389 | ); 390 | name = MainMenu.xib; 391 | path = Runner; 392 | sourceTree = ""; 393 | }; 394 | /* End PBXVariantGroup section */ 395 | 396 | /* Begin XCBuildConfiguration section */ 397 | 338D0CE9231458BD00FA5F75 /* Profile */ = { 398 | isa = XCBuildConfiguration; 399 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 400 | buildSettings = { 401 | ALWAYS_SEARCH_USER_PATHS = NO; 402 | CLANG_ANALYZER_NONNULL = YES; 403 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 404 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 405 | CLANG_CXX_LIBRARY = "libc++"; 406 | CLANG_ENABLE_MODULES = YES; 407 | CLANG_ENABLE_OBJC_ARC = YES; 408 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 409 | CLANG_WARN_BOOL_CONVERSION = YES; 410 | CLANG_WARN_CONSTANT_CONVERSION = YES; 411 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 412 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 413 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 414 | CLANG_WARN_EMPTY_BODY = YES; 415 | CLANG_WARN_ENUM_CONVERSION = YES; 416 | CLANG_WARN_INFINITE_RECURSION = YES; 417 | CLANG_WARN_INT_CONVERSION = YES; 418 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 419 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 420 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 421 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 422 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 423 | CODE_SIGN_IDENTITY = "-"; 424 | COPY_PHASE_STRIP = NO; 425 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 426 | ENABLE_NS_ASSERTIONS = NO; 427 | ENABLE_STRICT_OBJC_MSGSEND = YES; 428 | GCC_C_LANGUAGE_STANDARD = gnu11; 429 | GCC_NO_COMMON_BLOCKS = YES; 430 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 431 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 432 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 433 | GCC_WARN_UNUSED_FUNCTION = YES; 434 | GCC_WARN_UNUSED_VARIABLE = YES; 435 | MACOSX_DEPLOYMENT_TARGET = 10.14; 436 | MTL_ENABLE_DEBUG_INFO = NO; 437 | SDKROOT = macosx; 438 | SWIFT_COMPILATION_MODE = wholemodule; 439 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 440 | }; 441 | name = Profile; 442 | }; 443 | 338D0CEA231458BD00FA5F75 /* Profile */ = { 444 | isa = XCBuildConfiguration; 445 | baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; 446 | buildSettings = { 447 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 448 | CLANG_ENABLE_MODULES = YES; 449 | CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; 450 | CODE_SIGN_STYLE = Automatic; 451 | COMBINE_HIDPI_IMAGES = YES; 452 | INFOPLIST_FILE = Runner/Info.plist; 453 | LD_RUNPATH_SEARCH_PATHS = ( 454 | "$(inherited)", 455 | "@executable_path/../Frameworks", 456 | ); 457 | PROVISIONING_PROFILE_SPECIFIER = ""; 458 | SWIFT_VERSION = 5.0; 459 | }; 460 | name = Profile; 461 | }; 462 | 338D0CEB231458BD00FA5F75 /* Profile */ = { 463 | isa = XCBuildConfiguration; 464 | buildSettings = { 465 | CODE_SIGN_STYLE = Manual; 466 | PRODUCT_NAME = "$(TARGET_NAME)"; 467 | }; 468 | name = Profile; 469 | }; 470 | 33CC10F92044A3C60003C045 /* Debug */ = { 471 | isa = XCBuildConfiguration; 472 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 473 | buildSettings = { 474 | ALWAYS_SEARCH_USER_PATHS = NO; 475 | CLANG_ANALYZER_NONNULL = YES; 476 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 477 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 478 | CLANG_CXX_LIBRARY = "libc++"; 479 | CLANG_ENABLE_MODULES = YES; 480 | CLANG_ENABLE_OBJC_ARC = YES; 481 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 482 | CLANG_WARN_BOOL_CONVERSION = YES; 483 | CLANG_WARN_CONSTANT_CONVERSION = YES; 484 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 485 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 486 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 487 | CLANG_WARN_EMPTY_BODY = YES; 488 | CLANG_WARN_ENUM_CONVERSION = YES; 489 | CLANG_WARN_INFINITE_RECURSION = YES; 490 | CLANG_WARN_INT_CONVERSION = YES; 491 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 492 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 493 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 494 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 495 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 496 | CODE_SIGN_IDENTITY = "-"; 497 | COPY_PHASE_STRIP = NO; 498 | DEBUG_INFORMATION_FORMAT = dwarf; 499 | ENABLE_STRICT_OBJC_MSGSEND = YES; 500 | ENABLE_TESTABILITY = YES; 501 | GCC_C_LANGUAGE_STANDARD = gnu11; 502 | GCC_DYNAMIC_NO_PIC = NO; 503 | GCC_NO_COMMON_BLOCKS = YES; 504 | GCC_OPTIMIZATION_LEVEL = 0; 505 | GCC_PREPROCESSOR_DEFINITIONS = ( 506 | "DEBUG=1", 507 | "$(inherited)", 508 | ); 509 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 510 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 511 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 512 | GCC_WARN_UNUSED_FUNCTION = YES; 513 | GCC_WARN_UNUSED_VARIABLE = YES; 514 | MACOSX_DEPLOYMENT_TARGET = 10.14; 515 | MTL_ENABLE_DEBUG_INFO = YES; 516 | ONLY_ACTIVE_ARCH = YES; 517 | SDKROOT = macosx; 518 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 519 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 520 | }; 521 | name = Debug; 522 | }; 523 | 33CC10FA2044A3C60003C045 /* Release */ = { 524 | isa = XCBuildConfiguration; 525 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 526 | buildSettings = { 527 | ALWAYS_SEARCH_USER_PATHS = NO; 528 | CLANG_ANALYZER_NONNULL = YES; 529 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 530 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 531 | CLANG_CXX_LIBRARY = "libc++"; 532 | CLANG_ENABLE_MODULES = YES; 533 | CLANG_ENABLE_OBJC_ARC = YES; 534 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 535 | CLANG_WARN_BOOL_CONVERSION = YES; 536 | CLANG_WARN_CONSTANT_CONVERSION = YES; 537 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 538 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 539 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 540 | CLANG_WARN_EMPTY_BODY = YES; 541 | CLANG_WARN_ENUM_CONVERSION = YES; 542 | CLANG_WARN_INFINITE_RECURSION = YES; 543 | CLANG_WARN_INT_CONVERSION = YES; 544 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 545 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 546 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 547 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 548 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 549 | CODE_SIGN_IDENTITY = "-"; 550 | COPY_PHASE_STRIP = NO; 551 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 552 | ENABLE_NS_ASSERTIONS = NO; 553 | ENABLE_STRICT_OBJC_MSGSEND = YES; 554 | GCC_C_LANGUAGE_STANDARD = gnu11; 555 | GCC_NO_COMMON_BLOCKS = YES; 556 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 557 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 558 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 559 | GCC_WARN_UNUSED_FUNCTION = YES; 560 | GCC_WARN_UNUSED_VARIABLE = YES; 561 | MACOSX_DEPLOYMENT_TARGET = 10.14; 562 | MTL_ENABLE_DEBUG_INFO = NO; 563 | SDKROOT = macosx; 564 | SWIFT_COMPILATION_MODE = wholemodule; 565 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 566 | }; 567 | name = Release; 568 | }; 569 | 33CC10FC2044A3C60003C045 /* Debug */ = { 570 | isa = XCBuildConfiguration; 571 | baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; 572 | buildSettings = { 573 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 574 | CLANG_ENABLE_MODULES = YES; 575 | CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; 576 | CODE_SIGN_STYLE = Automatic; 577 | COMBINE_HIDPI_IMAGES = YES; 578 | INFOPLIST_FILE = Runner/Info.plist; 579 | LD_RUNPATH_SEARCH_PATHS = ( 580 | "$(inherited)", 581 | "@executable_path/../Frameworks", 582 | ); 583 | PROVISIONING_PROFILE_SPECIFIER = ""; 584 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 585 | SWIFT_VERSION = 5.0; 586 | }; 587 | name = Debug; 588 | }; 589 | 33CC10FD2044A3C60003C045 /* Release */ = { 590 | isa = XCBuildConfiguration; 591 | baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; 592 | buildSettings = { 593 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 594 | CLANG_ENABLE_MODULES = YES; 595 | CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; 596 | CODE_SIGN_STYLE = Automatic; 597 | COMBINE_HIDPI_IMAGES = YES; 598 | INFOPLIST_FILE = Runner/Info.plist; 599 | LD_RUNPATH_SEARCH_PATHS = ( 600 | "$(inherited)", 601 | "@executable_path/../Frameworks", 602 | ); 603 | PROVISIONING_PROFILE_SPECIFIER = ""; 604 | SWIFT_VERSION = 5.0; 605 | }; 606 | name = Release; 607 | }; 608 | 33CC111C2044C6BA0003C045 /* Debug */ = { 609 | isa = XCBuildConfiguration; 610 | buildSettings = { 611 | CODE_SIGN_STYLE = Manual; 612 | PRODUCT_NAME = "$(TARGET_NAME)"; 613 | }; 614 | name = Debug; 615 | }; 616 | 33CC111D2044C6BA0003C045 /* Release */ = { 617 | isa = XCBuildConfiguration; 618 | buildSettings = { 619 | CODE_SIGN_STYLE = Automatic; 620 | PRODUCT_NAME = "$(TARGET_NAME)"; 621 | }; 622 | name = Release; 623 | }; 624 | /* End XCBuildConfiguration section */ 625 | 626 | /* Begin XCConfigurationList section */ 627 | 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = { 628 | isa = XCConfigurationList; 629 | buildConfigurations = ( 630 | 33CC10F92044A3C60003C045 /* Debug */, 631 | 33CC10FA2044A3C60003C045 /* Release */, 632 | 338D0CE9231458BD00FA5F75 /* Profile */, 633 | ); 634 | defaultConfigurationIsVisible = 0; 635 | defaultConfigurationName = Release; 636 | }; 637 | 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = { 638 | isa = XCConfigurationList; 639 | buildConfigurations = ( 640 | 33CC10FC2044A3C60003C045 /* Debug */, 641 | 33CC10FD2044A3C60003C045 /* Release */, 642 | 338D0CEA231458BD00FA5F75 /* Profile */, 643 | ); 644 | defaultConfigurationIsVisible = 0; 645 | defaultConfigurationName = Release; 646 | }; 647 | 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = { 648 | isa = XCConfigurationList; 649 | buildConfigurations = ( 650 | 33CC111C2044C6BA0003C045 /* Debug */, 651 | 33CC111D2044C6BA0003C045 /* Release */, 652 | 338D0CEB231458BD00FA5F75 /* Profile */, 653 | ); 654 | defaultConfigurationIsVisible = 0; 655 | defaultConfigurationName = Release; 656 | }; 657 | /* End XCConfigurationList section */ 658 | 659 | /* Begin XCRemoteSwiftPackageReference section */ 660 | 600D5DF12BC6A289005DE406 /* XCRemoteSwiftPackageReference "LaunchAtLogin" */ = { 661 | isa = XCRemoteSwiftPackageReference; 662 | repositoryURL = "https://github.com/sindresorhus/LaunchAtLogin"; 663 | requirement = { 664 | branch = main; 665 | kind = branch; 666 | }; 667 | }; 668 | /* End XCRemoteSwiftPackageReference section */ 669 | 670 | /* Begin XCSwiftPackageProductDependency section */ 671 | 600D5DF22BC6A289005DE406 /* LaunchAtLogin */ = { 672 | isa = XCSwiftPackageProductDependency; 673 | package = 600D5DF12BC6A289005DE406 /* XCRemoteSwiftPackageReference "LaunchAtLogin" */; 674 | productName = LaunchAtLogin; 675 | }; 676 | /* End XCSwiftPackageProductDependency section */ 677 | }; 678 | rootObject = 33CC10E52044A3C60003C045 /* Project object */; 679 | } 680 | -------------------------------------------------------------------------------- /example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved: -------------------------------------------------------------------------------- 1 | { 2 | "originHash" : "4ffd020922d5cb1e4bad73064b0d31b058749aa71ce2bf650dc9871b0d3d582e", 3 | "pins" : [ 4 | { 5 | "identity" : "launchatlogin", 6 | "kind" : "remoteSourceControl", 7 | "location" : "https://github.com/sindresorhus/LaunchAtLogin", 8 | "state" : { 9 | "branch" : "main", 10 | "revision" : "22923d335429bfd38c52435505b06a10bcc520fd" 11 | } 12 | } 13 | ], 14 | "version" : 3 15 | } 16 | -------------------------------------------------------------------------------- /example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 53 | 55 | 61 | 62 | 63 | 64 | 70 | 72 | 78 | 79 | 80 | 81 | 83 | 84 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /example/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/macos/Runner.xcworkspace/xcshareddata/swiftpm/Package.resolved: -------------------------------------------------------------------------------- 1 | { 2 | "originHash" : "4ffd020922d5cb1e4bad73064b0d31b058749aa71ce2bf650dc9871b0d3d582e", 3 | "pins" : [ 4 | { 5 | "identity" : "launchatlogin", 6 | "kind" : "remoteSourceControl", 7 | "location" : "https://github.com/sindresorhus/LaunchAtLogin", 8 | "state" : { 9 | "branch" : "main", 10 | "revision" : "22923d335429bfd38c52435505b06a10bcc520fd" 11 | } 12 | } 13 | ], 14 | "version" : 3 15 | } 16 | -------------------------------------------------------------------------------- /example/macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @main 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | 10 | override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { 11 | return true 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leanflutter/launch_at_startup/fb71126d8c45ed80235a88283c5c76ebca9ea171/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leanflutter/launch_at_startup/fb71126d8c45ed80235a88283c5c76ebca9ea171/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leanflutter/launch_at_startup/fb71126d8c45ed80235a88283c5c76ebca9ea171/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leanflutter/launch_at_startup/fb71126d8c45ed80235a88283c5c76ebca9ea171/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leanflutter/launch_at_startup/fb71126d8c45ed80235a88283c5c76ebca9ea171/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leanflutter/launch_at_startup/fb71126d8c45ed80235a88283c5c76ebca9ea171/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leanflutter/launch_at_startup/fb71126d8c45ed80235a88283c5c76ebca9ea171/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /example/macos/Runner/Base.lproj/MainMenu.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = launch_at_startup_example 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = org.leanflutter.plugins.launchAtStartupExample 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2021 org.leanflutter.plugins. All rights reserved. 15 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /example/macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /example/macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /example/macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | // Add the LaunchAtLogin module 4 | import LaunchAtLogin 5 | 6 | // 7 | 8 | class MainFlutterWindow: NSWindow { 9 | override func awakeFromNib() { 10 | let flutterViewController = FlutterViewController.init() 11 | let windowFrame = self.frame 12 | self.contentViewController = flutterViewController 13 | self.setFrame(windowFrame, display: true) 14 | 15 | // Add FlutterMethodChannel platform code 16 | FlutterMethodChannel( 17 | name: "launch_at_startup", binaryMessenger: flutterViewController.engine.binaryMessenger 18 | ) 19 | .setMethodCallHandler { (_ call: FlutterMethodCall, result: @escaping FlutterResult) in 20 | switch call.method { 21 | case "launchAtStartupIsEnabled": 22 | result(LaunchAtLogin.isEnabled) 23 | case "launchAtStartupSetEnabled": 24 | if let arguments = call.arguments as? [String: Any] { 25 | LaunchAtLogin.isEnabled = arguments["setEnabledValue"] as! Bool 26 | } 27 | result(nil) 28 | default: 29 | result(FlutterMethodNotImplemented) 30 | } 31 | } 32 | // 33 | 34 | RegisterGeneratedPlugins(registry: flutterViewController) 35 | 36 | super.awakeFromNib() 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /example/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | archive: 5 | dependency: transitive 6 | description: 7 | name: archive 8 | sha256: ecf4273855368121b1caed0d10d4513c7241dfc813f7d3c8933b36622ae9b265 9 | url: "https://pub.dev" 10 | source: hosted 11 | version: "3.5.1" 12 | args: 13 | dependency: transitive 14 | description: 15 | name: args 16 | sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a" 17 | url: "https://pub.dev" 18 | source: hosted 19 | version: "2.5.0" 20 | async: 21 | dependency: transitive 22 | description: 23 | name: async 24 | sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63 25 | url: "https://pub.dev" 26 | source: hosted 27 | version: "2.12.0" 28 | boolean_selector: 29 | dependency: transitive 30 | description: 31 | name: boolean_selector 32 | sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" 33 | url: "https://pub.dev" 34 | source: hosted 35 | version: "2.1.2" 36 | bot_toast: 37 | dependency: "direct main" 38 | description: 39 | name: bot_toast 40 | sha256: "6b93030a99a98335b8827ecd83021e92e885ffc61d261d3825ffdecdd17f3bdf" 41 | url: "https://pub.dev" 42 | source: hosted 43 | version: "4.1.3" 44 | characters: 45 | dependency: transitive 46 | description: 47 | name: characters 48 | sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 49 | url: "https://pub.dev" 50 | source: hosted 51 | version: "1.4.0" 52 | cli_util: 53 | dependency: transitive 54 | description: 55 | name: cli_util 56 | sha256: c05b7406fdabc7a49a3929d4af76bcaccbbffcbcdcf185b082e1ae07da323d19 57 | url: "https://pub.dev" 58 | source: hosted 59 | version: "0.4.1" 60 | clock: 61 | dependency: transitive 62 | description: 63 | name: clock 64 | sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b 65 | url: "https://pub.dev" 66 | source: hosted 67 | version: "1.1.2" 68 | collection: 69 | dependency: transitive 70 | description: 71 | name: collection 72 | sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" 73 | url: "https://pub.dev" 74 | source: hosted 75 | version: "1.19.1" 76 | console: 77 | dependency: transitive 78 | description: 79 | name: console 80 | sha256: e04e7824384c5b39389acdd6dc7d33f3efe6b232f6f16d7626f194f6a01ad69a 81 | url: "https://pub.dev" 82 | source: hosted 83 | version: "4.1.0" 84 | crypto: 85 | dependency: transitive 86 | description: 87 | name: crypto 88 | sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab 89 | url: "https://pub.dev" 90 | source: hosted 91 | version: "3.0.3" 92 | cupertino_icons: 93 | dependency: "direct main" 94 | description: 95 | name: cupertino_icons 96 | sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d 97 | url: "https://pub.dev" 98 | source: hosted 99 | version: "1.0.6" 100 | fake_async: 101 | dependency: transitive 102 | description: 103 | name: fake_async 104 | sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc" 105 | url: "https://pub.dev" 106 | source: hosted 107 | version: "1.3.2" 108 | ffi: 109 | dependency: transitive 110 | description: 111 | name: ffi 112 | sha256: "289279317b4b16eb2bb7e271abccd4bf84ec9bdcbe999e278a94b804f5630418" 113 | url: "https://pub.dev" 114 | source: hosted 115 | version: "2.1.4" 116 | flutter: 117 | dependency: "direct main" 118 | description: flutter 119 | source: sdk 120 | version: "0.0.0" 121 | flutter_test: 122 | dependency: "direct dev" 123 | description: flutter 124 | source: sdk 125 | version: "0.0.0" 126 | flutter_web_plugins: 127 | dependency: transitive 128 | description: flutter 129 | source: sdk 130 | version: "0.0.0" 131 | get_it: 132 | dependency: transitive 133 | description: 134 | name: get_it 135 | sha256: d85128a5dae4ea777324730dc65edd9c9f43155c109d5cc0a69cab74139fbac1 136 | url: "https://pub.dev" 137 | source: hosted 138 | version: "7.7.0" 139 | http: 140 | dependency: transitive 141 | description: 142 | name: http 143 | sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938" 144 | url: "https://pub.dev" 145 | source: hosted 146 | version: "1.2.1" 147 | http_parser: 148 | dependency: transitive 149 | description: 150 | name: http_parser 151 | sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" 152 | url: "https://pub.dev" 153 | source: hosted 154 | version: "4.0.2" 155 | image: 156 | dependency: transitive 157 | description: 158 | name: image 159 | sha256: "4c68bfd5ae83e700b5204c1e74451e7bf3cf750e6843c6e158289cf56bda018e" 160 | url: "https://pub.dev" 161 | source: hosted 162 | version: "4.1.7" 163 | launch_at_startup: 164 | dependency: "direct main" 165 | description: 166 | path: ".." 167 | relative: true 168 | source: path 169 | version: "0.4.0" 170 | leak_tracker: 171 | dependency: transitive 172 | description: 173 | name: leak_tracker 174 | sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec 175 | url: "https://pub.dev" 176 | source: hosted 177 | version: "10.0.8" 178 | leak_tracker_flutter_testing: 179 | dependency: transitive 180 | description: 181 | name: leak_tracker_flutter_testing 182 | sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 183 | url: "https://pub.dev" 184 | source: hosted 185 | version: "3.0.9" 186 | leak_tracker_testing: 187 | dependency: transitive 188 | description: 189 | name: leak_tracker_testing 190 | sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" 191 | url: "https://pub.dev" 192 | source: hosted 193 | version: "3.0.1" 194 | lints: 195 | dependency: transitive 196 | description: 197 | name: lints 198 | sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235" 199 | url: "https://pub.dev" 200 | source: hosted 201 | version: "4.0.0" 202 | matcher: 203 | dependency: transitive 204 | description: 205 | name: matcher 206 | sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 207 | url: "https://pub.dev" 208 | source: hosted 209 | version: "0.12.17" 210 | material_color_utilities: 211 | dependency: transitive 212 | description: 213 | name: material_color_utilities 214 | sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec 215 | url: "https://pub.dev" 216 | source: hosted 217 | version: "0.11.1" 218 | meta: 219 | dependency: transitive 220 | description: 221 | name: meta 222 | sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c 223 | url: "https://pub.dev" 224 | source: hosted 225 | version: "1.16.0" 226 | mostly_reasonable_lints: 227 | dependency: "direct dev" 228 | description: 229 | name: mostly_reasonable_lints 230 | sha256: e19fec63536866ba307b3dfbc258b4bce9b3745129f038006b56b4067c6293d8 231 | url: "https://pub.dev" 232 | source: hosted 233 | version: "0.1.2" 234 | msix: 235 | dependency: "direct dev" 236 | description: 237 | name: msix 238 | sha256: "519b183d15dc9f9c594f247e2d2339d855cf0eaacc30e19b128e14f3ecc62047" 239 | url: "https://pub.dev" 240 | source: hosted 241 | version: "3.16.7" 242 | package_config: 243 | dependency: transitive 244 | description: 245 | name: package_config 246 | sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" 247 | url: "https://pub.dev" 248 | source: hosted 249 | version: "2.1.0" 250 | package_info_plus: 251 | dependency: "direct main" 252 | description: 253 | name: package_info_plus 254 | sha256: b93d8b4d624b4ea19b0a5a208b2d6eff06004bc3ce74c06040b120eeadd00ce0 255 | url: "https://pub.dev" 256 | source: hosted 257 | version: "8.0.0" 258 | package_info_plus_platform_interface: 259 | dependency: transitive 260 | description: 261 | name: package_info_plus_platform_interface 262 | sha256: f49918f3433a3146047372f9d4f1f847511f2acd5cd030e1f44fe5a50036b70e 263 | url: "https://pub.dev" 264 | source: hosted 265 | version: "3.0.0" 266 | path: 267 | dependency: transitive 268 | description: 269 | name: path 270 | sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" 271 | url: "https://pub.dev" 272 | source: hosted 273 | version: "1.9.1" 274 | petitparser: 275 | dependency: transitive 276 | description: 277 | name: petitparser 278 | sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 279 | url: "https://pub.dev" 280 | source: hosted 281 | version: "6.0.2" 282 | plugin_platform_interface: 283 | dependency: transitive 284 | description: 285 | name: plugin_platform_interface 286 | sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" 287 | url: "https://pub.dev" 288 | source: hosted 289 | version: "2.1.8" 290 | preference_list: 291 | dependency: "direct main" 292 | description: 293 | name: preference_list 294 | sha256: "1429f8fe03605d5eaf6dc333208d7bbf028bae707c3c1c32386939e4d7f58154" 295 | url: "https://pub.dev" 296 | source: hosted 297 | version: "0.0.2" 298 | pub_semver: 299 | dependency: transitive 300 | description: 301 | name: pub_semver 302 | sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" 303 | url: "https://pub.dev" 304 | source: hosted 305 | version: "2.1.4" 306 | sky_engine: 307 | dependency: transitive 308 | description: flutter 309 | source: sdk 310 | version: "0.0.0" 311 | source_span: 312 | dependency: transitive 313 | description: 314 | name: source_span 315 | sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" 316 | url: "https://pub.dev" 317 | source: hosted 318 | version: "1.10.1" 319 | stack_trace: 320 | dependency: transitive 321 | description: 322 | name: stack_trace 323 | sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" 324 | url: "https://pub.dev" 325 | source: hosted 326 | version: "1.12.1" 327 | stream_channel: 328 | dependency: transitive 329 | description: 330 | name: stream_channel 331 | sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" 332 | url: "https://pub.dev" 333 | source: hosted 334 | version: "2.1.4" 335 | string_scanner: 336 | dependency: transitive 337 | description: 338 | name: string_scanner 339 | sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" 340 | url: "https://pub.dev" 341 | source: hosted 342 | version: "1.4.1" 343 | term_glyph: 344 | dependency: transitive 345 | description: 346 | name: term_glyph 347 | sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" 348 | url: "https://pub.dev" 349 | source: hosted 350 | version: "1.2.2" 351 | test_api: 352 | dependency: transitive 353 | description: 354 | name: test_api 355 | sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd 356 | url: "https://pub.dev" 357 | source: hosted 358 | version: "0.7.4" 359 | typed_data: 360 | dependency: transitive 361 | description: 362 | name: typed_data 363 | sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c 364 | url: "https://pub.dev" 365 | source: hosted 366 | version: "1.3.2" 367 | vector_math: 368 | dependency: transitive 369 | description: 370 | name: vector_math 371 | sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" 372 | url: "https://pub.dev" 373 | source: hosted 374 | version: "2.1.4" 375 | vm_service: 376 | dependency: transitive 377 | description: 378 | name: vm_service 379 | sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14" 380 | url: "https://pub.dev" 381 | source: hosted 382 | version: "14.3.1" 383 | web: 384 | dependency: transitive 385 | description: 386 | name: web 387 | sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" 388 | url: "https://pub.dev" 389 | source: hosted 390 | version: "0.5.1" 391 | win32: 392 | dependency: transitive 393 | description: 394 | name: win32 395 | sha256: b89e6e24d1454e149ab20fbb225af58660f0c0bf4475544650700d8e2da54aef 396 | url: "https://pub.dev" 397 | source: hosted 398 | version: "5.11.0" 399 | win32_registry: 400 | dependency: transitive 401 | description: 402 | name: win32_registry 403 | sha256: "6f1b564492d0147b330dd794fee8f512cec4977957f310f9951b5f9d83618dae" 404 | url: "https://pub.dev" 405 | source: hosted 406 | version: "2.1.0" 407 | xml: 408 | dependency: transitive 409 | description: 410 | name: xml 411 | sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 412 | url: "https://pub.dev" 413 | source: hosted 414 | version: "6.5.0" 415 | yaml: 416 | dependency: transitive 417 | description: 418 | name: yaml 419 | sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" 420 | url: "https://pub.dev" 421 | source: hosted 422 | version: "3.1.2" 423 | sdks: 424 | dart: ">=3.7.0 <4.0.0" 425 | flutter: ">=3.19.0" 426 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: launch_at_startup_example 2 | description: Demonstrates how to use the launch_at_startup plugin. 3 | publish_to: "none" 4 | 5 | environment: 6 | sdk: ">=3.0.0 <4.0.0" 7 | 8 | dependencies: 9 | bot_toast: ^4.1.3 10 | cupertino_icons: ^1.0.2 11 | flutter: 12 | sdk: flutter 13 | launch_at_startup: 14 | path: ../ 15 | package_info_plus: ^8.0.0 16 | preference_list: ^0.0.2 17 | 18 | dev_dependencies: 19 | flutter_test: 20 | sdk: flutter 21 | mostly_reasonable_lints: ^0.1.2 22 | msix: ^3.16.7 23 | 24 | flutter: 25 | uses-material-design: true 26 | 27 | msix_config: 28 | display_name: launch_at_startup_example 29 | publisher_display_name: LeanFlutter 30 | identity_name: dev.leanflutter.examples.launchatstartupexample 31 | msix_version: 1.0.0.0 32 | 33 | -------------------------------------------------------------------------------- /example/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leanflutter/launch_at_startup/fb71126d8c45ed80235a88283c5c76ebca9ea171/example/web/favicon.png -------------------------------------------------------------------------------- /example/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leanflutter/launch_at_startup/fb71126d8c45ed80235a88283c5c76ebca9ea171/example/web/icons/Icon-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leanflutter/launch_at_startup/fb71126d8c45ed80235a88283c5c76ebca9ea171/example/web/icons/Icon-512.png -------------------------------------------------------------------------------- /example/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leanflutter/launch_at_startup/fb71126d8c45ed80235a88283c5c76ebca9ea171/example/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leanflutter/launch_at_startup/fb71126d8c45ed80235a88283c5c76ebca9ea171/example/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /example/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | example 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /example/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "short_name": "example", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /example/windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /example/windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(launch_at_startup_example LANGUAGES CXX) 3 | 4 | set(BINARY_NAME "launch_at_startup_example") 5 | 6 | cmake_policy(SET CMP0063 NEW) 7 | 8 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 9 | 10 | # Configure build options. 11 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 12 | if(IS_MULTICONFIG) 13 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 14 | CACHE STRING "" FORCE) 15 | else() 16 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 17 | set(CMAKE_BUILD_TYPE "Debug" CACHE 18 | STRING "Flutter build mode" FORCE) 19 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 20 | "Debug" "Profile" "Release") 21 | endif() 22 | endif() 23 | 24 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 25 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 26 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 27 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 28 | 29 | # Use Unicode for all projects. 30 | add_definitions(-DUNICODE -D_UNICODE) 31 | 32 | # Compilation settings that should be applied to most targets. 33 | function(APPLY_STANDARD_SETTINGS TARGET) 34 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 35 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 36 | target_compile_options(${TARGET} PRIVATE /EHsc) 37 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 38 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 39 | endfunction() 40 | 41 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 42 | 43 | # Flutter library and tool build rules. 44 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 45 | 46 | # Application build 47 | add_subdirectory("runner") 48 | 49 | # Generated plugin build rules, which manage building the plugins and adding 50 | # them to the application. 51 | include(flutter/generated_plugins.cmake) 52 | 53 | 54 | # === Installation === 55 | # Support files are copied into place next to the executable, so that it can 56 | # run in place. This is done instead of making a separate bundle (as on Linux) 57 | # so that building and running from within Visual Studio will work. 58 | set(BUILD_BUNDLE_DIR "$") 59 | # Make the "install" step default, as it's required to run. 60 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 61 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 62 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 63 | endif() 64 | 65 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 66 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 67 | 68 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 69 | COMPONENT Runtime) 70 | 71 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 72 | COMPONENT Runtime) 73 | 74 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 75 | COMPONENT Runtime) 76 | 77 | if(PLUGIN_BUNDLED_LIBRARIES) 78 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 79 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 80 | COMPONENT Runtime) 81 | endif() 82 | 83 | # Fully re-copy the assets directory on each build to avoid having stale files 84 | # from a previous install. 85 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 86 | install(CODE " 87 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 88 | " COMPONENT Runtime) 89 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 90 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 91 | 92 | # Install the AOT library on non-Debug builds only. 93 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 94 | CONFIGURATIONS Profile;Release 95 | COMPONENT Runtime) 96 | -------------------------------------------------------------------------------- /example/windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | 3 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 4 | 5 | # Configuration provided via flutter tool. 6 | include(${EPHEMERAL_DIR}/generated_config.cmake) 7 | 8 | # TODO: Move the rest of this into files in ephemeral. See 9 | # https://github.com/flutter/flutter/issues/57146. 10 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 11 | 12 | # Set fallback configurations for older versions of the flutter tool. 13 | if (NOT DEFINED FLUTTER_TARGET_PLATFORM) 14 | set(FLUTTER_TARGET_PLATFORM "windows-x64") 15 | endif() 16 | 17 | # === Flutter Library === 18 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 19 | 20 | # Published to parent scope for install step. 21 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 22 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 23 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 24 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 25 | 26 | list(APPEND FLUTTER_LIBRARY_HEADERS 27 | "flutter_export.h" 28 | "flutter_windows.h" 29 | "flutter_messenger.h" 30 | "flutter_plugin_registrar.h" 31 | "flutter_texture_registrar.h" 32 | ) 33 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 34 | add_library(flutter INTERFACE) 35 | target_include_directories(flutter INTERFACE 36 | "${EPHEMERAL_DIR}" 37 | ) 38 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 39 | add_dependencies(flutter flutter_assemble) 40 | 41 | # === Wrapper === 42 | list(APPEND CPP_WRAPPER_SOURCES_CORE 43 | "core_implementations.cc" 44 | "standard_codec.cc" 45 | ) 46 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 47 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 48 | "plugin_registrar.cc" 49 | ) 50 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 51 | list(APPEND CPP_WRAPPER_SOURCES_APP 52 | "flutter_engine.cc" 53 | "flutter_view_controller.cc" 54 | ) 55 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 56 | 57 | # Wrapper sources needed for a plugin. 58 | add_library(flutter_wrapper_plugin STATIC 59 | ${CPP_WRAPPER_SOURCES_CORE} 60 | ${CPP_WRAPPER_SOURCES_PLUGIN} 61 | ) 62 | apply_standard_settings(flutter_wrapper_plugin) 63 | set_target_properties(flutter_wrapper_plugin PROPERTIES 64 | POSITION_INDEPENDENT_CODE ON) 65 | set_target_properties(flutter_wrapper_plugin PROPERTIES 66 | CXX_VISIBILITY_PRESET hidden) 67 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 68 | target_include_directories(flutter_wrapper_plugin PUBLIC 69 | "${WRAPPER_ROOT}/include" 70 | ) 71 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 72 | 73 | # Wrapper sources needed for the runner. 74 | add_library(flutter_wrapper_app STATIC 75 | ${CPP_WRAPPER_SOURCES_CORE} 76 | ${CPP_WRAPPER_SOURCES_APP} 77 | ) 78 | apply_standard_settings(flutter_wrapper_app) 79 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 80 | target_include_directories(flutter_wrapper_app PUBLIC 81 | "${WRAPPER_ROOT}/include" 82 | ) 83 | add_dependencies(flutter_wrapper_app flutter_assemble) 84 | 85 | # === Flutter tool backend === 86 | # _phony_ is a non-existent file to force this command to run every time, 87 | # since currently there's no way to get a full input/output list from the 88 | # flutter tool. 89 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 90 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 91 | add_custom_command( 92 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 93 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 94 | ${CPP_WRAPPER_SOURCES_APP} 95 | ${PHONY_OUTPUT} 96 | COMMAND ${CMAKE_COMMAND} -E env 97 | ${FLUTTER_TOOL_ENVIRONMENT} 98 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 99 | ${FLUTTER_TARGET_PLATFORM} $ 100 | VERBATIM 101 | ) 102 | add_custom_target(flutter_assemble DEPENDS 103 | "${FLUTTER_LIBRARY}" 104 | ${FLUTTER_LIBRARY_HEADERS} 105 | ${CPP_WRAPPER_SOURCES_CORE} 106 | ${CPP_WRAPPER_SOURCES_PLUGIN} 107 | ${CPP_WRAPPER_SOURCES_APP} 108 | ) 109 | -------------------------------------------------------------------------------- /example/windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void RegisterPlugins(flutter::PluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /example/windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /example/windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /example/windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | add_executable(${BINARY_NAME} WIN32 5 | "flutter_window.cpp" 6 | "main.cpp" 7 | "utils.cpp" 8 | "win32_window.cpp" 9 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 10 | "Runner.rc" 11 | "runner.exe.manifest" 12 | ) 13 | apply_standard_settings(${BINARY_NAME}) 14 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 15 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 16 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 17 | add_dependencies(${BINARY_NAME} flutter_assemble) 18 | -------------------------------------------------------------------------------- /example/windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) 64 | #define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0,0 67 | #endif 68 | 69 | #if defined(FLUTTER_VERSION) 70 | #define VERSION_AS_STRING FLUTTER_VERSION 71 | #else 72 | #define VERSION_AS_STRING "1.0.0" 73 | #endif 74 | 75 | VS_VERSION_INFO VERSIONINFO 76 | FILEVERSION VERSION_AS_NUMBER 77 | PRODUCTVERSION VERSION_AS_NUMBER 78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 79 | #ifdef _DEBUG 80 | FILEFLAGS VS_FF_DEBUG 81 | #else 82 | FILEFLAGS 0x0L 83 | #endif 84 | FILEOS VOS__WINDOWS32 85 | FILETYPE VFT_APP 86 | FILESUBTYPE 0x0L 87 | BEGIN 88 | BLOCK "StringFileInfo" 89 | BEGIN 90 | BLOCK "040904e4" 91 | BEGIN 92 | VALUE "CompanyName", "com.example" "\0" 93 | VALUE "FileDescription", "Demonstrates how to use the launch_at_startup plugin." "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "launch_at_startup_example" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2021 com.example. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "launch_at_startup_example.exe" "\0" 98 | VALUE "ProductName", "launch_at_startup_example" "\0" 99 | VALUE "ProductVersion", VERSION_AS_STRING "\0" 100 | END 101 | END 102 | BLOCK "VarFileInfo" 103 | BEGIN 104 | VALUE "Translation", 0x409, 1252 105 | END 106 | END 107 | 108 | #endif // English (United States) resources 109 | ///////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | 113 | #ifndef APSTUDIO_INVOKED 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // Generated from the TEXTINCLUDE 3 resource. 117 | // 118 | 119 | 120 | ///////////////////////////////////////////////////////////////////////////// 121 | #endif // not APSTUDIO_INVOKED 122 | -------------------------------------------------------------------------------- /example/windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | return true; 30 | } 31 | 32 | void FlutterWindow::OnDestroy() { 33 | if (flutter_controller_) { 34 | flutter_controller_ = nullptr; 35 | } 36 | 37 | Win32Window::OnDestroy(); 38 | } 39 | 40 | LRESULT 41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 42 | WPARAM const wparam, 43 | LPARAM const lparam) noexcept { 44 | // Give Flutter, including plugins, an opportunity to handle window messages. 45 | if (flutter_controller_) { 46 | std::optional result = 47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 48 | lparam); 49 | if (result) { 50 | return *result; 51 | } 52 | } 53 | 54 | switch (message) { 55 | case WM_FONTCHANGE: 56 | flutter_controller_->engine()->ReloadSystemFonts(); 57 | break; 58 | } 59 | 60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 61 | } 62 | -------------------------------------------------------------------------------- /example/windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /example/windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.CreateAndShow(L"launch_at_startup_example", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /example/windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /example/windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leanflutter/launch_at_startup/fb71126d8c45ed80235a88283c5c76ebca9ea171/example/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /example/windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /example/windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr); 51 | if (target_length == 0) { 52 | return std::string(); 53 | } 54 | std::string utf8_string; 55 | utf8_string.resize(target_length); 56 | int converted_length = ::WideCharToMultiByte( 57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 58 | -1, utf8_string.data(), 59 | target_length, nullptr, nullptr); 60 | if (converted_length == 0) { 61 | return std::string(); 62 | } 63 | return utf8_string; 64 | } 65 | -------------------------------------------------------------------------------- /example/windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /example/windows/runner/win32_window.cpp: -------------------------------------------------------------------------------- 1 | #include "win32_window.h" 2 | 3 | #include 4 | 5 | #include "resource.h" 6 | 7 | namespace { 8 | 9 | constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; 10 | 11 | // The number of Win32Window objects that currently exist. 12 | static int g_active_window_count = 0; 13 | 14 | using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); 15 | 16 | // Scale helper to convert logical scaler values to physical using passed in 17 | // scale factor 18 | int Scale(int source, double scale_factor) { 19 | return static_cast(source * scale_factor); 20 | } 21 | 22 | // Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. 23 | // This API is only needed for PerMonitor V1 awareness mode. 24 | void EnableFullDpiSupportIfAvailable(HWND hwnd) { 25 | HMODULE user32_module = LoadLibraryA("User32.dll"); 26 | if (!user32_module) { 27 | return; 28 | } 29 | auto enable_non_client_dpi_scaling = 30 | reinterpret_cast( 31 | GetProcAddress(user32_module, "EnableNonClientDpiScaling")); 32 | if (enable_non_client_dpi_scaling != nullptr) { 33 | enable_non_client_dpi_scaling(hwnd); 34 | FreeLibrary(user32_module); 35 | } 36 | } 37 | 38 | } // namespace 39 | 40 | // Manages the Win32Window's window class registration. 41 | class WindowClassRegistrar { 42 | public: 43 | ~WindowClassRegistrar() = default; 44 | 45 | // Returns the singleton registar instance. 46 | static WindowClassRegistrar* GetInstance() { 47 | if (!instance_) { 48 | instance_ = new WindowClassRegistrar(); 49 | } 50 | return instance_; 51 | } 52 | 53 | // Returns the name of the window class, registering the class if it hasn't 54 | // previously been registered. 55 | const wchar_t* GetWindowClass(); 56 | 57 | // Unregisters the window class. Should only be called if there are no 58 | // instances of the window. 59 | void UnregisterWindowClass(); 60 | 61 | private: 62 | WindowClassRegistrar() = default; 63 | 64 | static WindowClassRegistrar* instance_; 65 | 66 | bool class_registered_ = false; 67 | }; 68 | 69 | WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; 70 | 71 | const wchar_t* WindowClassRegistrar::GetWindowClass() { 72 | if (!class_registered_) { 73 | WNDCLASS window_class{}; 74 | window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); 75 | window_class.lpszClassName = kWindowClassName; 76 | window_class.style = CS_HREDRAW | CS_VREDRAW; 77 | window_class.cbClsExtra = 0; 78 | window_class.cbWndExtra = 0; 79 | window_class.hInstance = GetModuleHandle(nullptr); 80 | window_class.hIcon = 81 | LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); 82 | window_class.hbrBackground = 0; 83 | window_class.lpszMenuName = nullptr; 84 | window_class.lpfnWndProc = Win32Window::WndProc; 85 | RegisterClass(&window_class); 86 | class_registered_ = true; 87 | } 88 | return kWindowClassName; 89 | } 90 | 91 | void WindowClassRegistrar::UnregisterWindowClass() { 92 | UnregisterClass(kWindowClassName, nullptr); 93 | class_registered_ = false; 94 | } 95 | 96 | Win32Window::Win32Window() { 97 | ++g_active_window_count; 98 | } 99 | 100 | Win32Window::~Win32Window() { 101 | --g_active_window_count; 102 | Destroy(); 103 | } 104 | 105 | bool Win32Window::CreateAndShow(const std::wstring& title, 106 | const Point& origin, 107 | const Size& size) { 108 | Destroy(); 109 | 110 | const wchar_t* window_class = 111 | WindowClassRegistrar::GetInstance()->GetWindowClass(); 112 | 113 | const POINT target_point = {static_cast(origin.x), 114 | static_cast(origin.y)}; 115 | HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); 116 | UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); 117 | double scale_factor = dpi / 96.0; 118 | 119 | HWND window = CreateWindow( 120 | window_class, title.c_str(), WS_OVERLAPPEDWINDOW | WS_VISIBLE, 121 | Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), 122 | Scale(size.width, scale_factor), Scale(size.height, scale_factor), 123 | nullptr, nullptr, GetModuleHandle(nullptr), this); 124 | 125 | if (!window) { 126 | return false; 127 | } 128 | 129 | return OnCreate(); 130 | } 131 | 132 | // static 133 | LRESULT CALLBACK Win32Window::WndProc(HWND const window, 134 | UINT const message, 135 | WPARAM const wparam, 136 | LPARAM const lparam) noexcept { 137 | if (message == WM_NCCREATE) { 138 | auto window_struct = reinterpret_cast(lparam); 139 | SetWindowLongPtr(window, GWLP_USERDATA, 140 | reinterpret_cast(window_struct->lpCreateParams)); 141 | 142 | auto that = static_cast(window_struct->lpCreateParams); 143 | EnableFullDpiSupportIfAvailable(window); 144 | that->window_handle_ = window; 145 | } else if (Win32Window* that = GetThisFromHandle(window)) { 146 | return that->MessageHandler(window, message, wparam, lparam); 147 | } 148 | 149 | return DefWindowProc(window, message, wparam, lparam); 150 | } 151 | 152 | LRESULT 153 | Win32Window::MessageHandler(HWND hwnd, 154 | UINT const message, 155 | WPARAM const wparam, 156 | LPARAM const lparam) noexcept { 157 | switch (message) { 158 | case WM_DESTROY: 159 | window_handle_ = nullptr; 160 | Destroy(); 161 | if (quit_on_close_) { 162 | PostQuitMessage(0); 163 | } 164 | return 0; 165 | 166 | case WM_DPICHANGED: { 167 | auto newRectSize = reinterpret_cast(lparam); 168 | LONG newWidth = newRectSize->right - newRectSize->left; 169 | LONG newHeight = newRectSize->bottom - newRectSize->top; 170 | 171 | SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, 172 | newHeight, SWP_NOZORDER | SWP_NOACTIVATE); 173 | 174 | return 0; 175 | } 176 | case WM_SIZE: { 177 | RECT rect = GetClientArea(); 178 | if (child_content_ != nullptr) { 179 | // Size and position the child window. 180 | MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, 181 | rect.bottom - rect.top, TRUE); 182 | } 183 | return 0; 184 | } 185 | 186 | case WM_ACTIVATE: 187 | if (child_content_ != nullptr) { 188 | SetFocus(child_content_); 189 | } 190 | return 0; 191 | } 192 | 193 | return DefWindowProc(window_handle_, message, wparam, lparam); 194 | } 195 | 196 | void Win32Window::Destroy() { 197 | OnDestroy(); 198 | 199 | if (window_handle_) { 200 | DestroyWindow(window_handle_); 201 | window_handle_ = nullptr; 202 | } 203 | if (g_active_window_count == 0) { 204 | WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); 205 | } 206 | } 207 | 208 | Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { 209 | return reinterpret_cast( 210 | GetWindowLongPtr(window, GWLP_USERDATA)); 211 | } 212 | 213 | void Win32Window::SetChildContent(HWND content) { 214 | child_content_ = content; 215 | SetParent(content, window_handle_); 216 | RECT frame = GetClientArea(); 217 | 218 | MoveWindow(content, frame.left, frame.top, frame.right - frame.left, 219 | frame.bottom - frame.top, true); 220 | 221 | SetFocus(child_content_); 222 | } 223 | 224 | RECT Win32Window::GetClientArea() { 225 | RECT frame; 226 | GetClientRect(window_handle_, &frame); 227 | return frame; 228 | } 229 | 230 | HWND Win32Window::GetHandle() { 231 | return window_handle_; 232 | } 233 | 234 | void Win32Window::SetQuitOnClose(bool quit_on_close) { 235 | quit_on_close_ = quit_on_close; 236 | } 237 | 238 | bool Win32Window::OnCreate() { 239 | // No-op; provided for subclasses. 240 | return true; 241 | } 242 | 243 | void Win32Window::OnDestroy() { 244 | // No-op; provided for subclasses. 245 | } 246 | -------------------------------------------------------------------------------- /example/windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates and shows a win32 window with |title| and position and size using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size to will treat the width height passed in to this function 35 | // as logical pixels and scale to appropriate for the default monitor. Returns 36 | // true if the window was created successfully. 37 | bool CreateAndShow(const std::wstring& title, 38 | const Point& origin, 39 | const Size& size); 40 | 41 | // Release OS resources associated with window. 42 | void Destroy(); 43 | 44 | // Inserts |content| into the window tree. 45 | void SetChildContent(HWND content); 46 | 47 | // Returns the backing Window handle to enable clients to set icon and other 48 | // window properties. Returns nullptr if the window has been destroyed. 49 | HWND GetHandle(); 50 | 51 | // If true, closing this window will quit the application. 52 | void SetQuitOnClose(bool quit_on_close); 53 | 54 | // Return a RECT representing the bounds of the current client area. 55 | RECT GetClientArea(); 56 | 57 | protected: 58 | // Processes and route salient window messages for mouse handling, 59 | // size change and DPI. Delegates handling of these to member overloads that 60 | // inheriting classes can handle. 61 | virtual LRESULT MessageHandler(HWND window, 62 | UINT const message, 63 | WPARAM const wparam, 64 | LPARAM const lparam) noexcept; 65 | 66 | // Called when CreateAndShow is called, allowing subclass window-related 67 | // setup. Subclasses should return false if setup fails. 68 | virtual bool OnCreate(); 69 | 70 | // Called when Destroy is called. 71 | virtual void OnDestroy(); 72 | 73 | private: 74 | friend class WindowClassRegistrar; 75 | 76 | // OS callback called by message pump. Handles the WM_NCCREATE message which 77 | // is passed when the non-client area is being created and enables automatic 78 | // non-client DPI scaling so that the non-client area automatically 79 | // responsponds to changes in DPI. All other messages are handled by 80 | // MessageHandler. 81 | static LRESULT CALLBACK WndProc(HWND const window, 82 | UINT const message, 83 | WPARAM const wparam, 84 | LPARAM const lparam) noexcept; 85 | 86 | // Retrieves a class instance pointer for |window| 87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 88 | 89 | bool quit_on_close_ = false; 90 | 91 | // window handle for top level window. 92 | HWND window_handle_ = nullptr; 93 | 94 | // window handle for hosted content. 95 | HWND child_content_ = nullptr; 96 | }; 97 | 98 | #endif // RUNNER_WIN32_WINDOW_H_ 99 | -------------------------------------------------------------------------------- /lib/launch_at_startup.dart: -------------------------------------------------------------------------------- 1 | library launch_at_startup; 2 | 3 | export 'src/launch_at_startup.dart'; 4 | -------------------------------------------------------------------------------- /lib/src/app_auto_launcher.dart: -------------------------------------------------------------------------------- 1 | class AppAutoLauncher { 2 | AppAutoLauncher({ 3 | required this.appName, 4 | required this.appPath, 5 | this.args = const [], 6 | }); 7 | 8 | final String appName; 9 | final String appPath; 10 | final List args; 11 | 12 | Future isEnabled() { 13 | throw UnimplementedError(); 14 | } 15 | 16 | Future enable() { 17 | throw UnimplementedError(); 18 | } 19 | 20 | Future disable() { 21 | throw UnimplementedError(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/src/app_auto_launcher_impl_linux.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:launch_at_startup/src/app_auto_launcher.dart'; 4 | 5 | class AppAutoLauncherImplLinux extends AppAutoLauncher { 6 | AppAutoLauncherImplLinux({ 7 | required super.appName, 8 | required super.appPath, 9 | super.args, 10 | }); 11 | 12 | File get _desktopFile { 13 | return File( 14 | '${Platform.environment['HOME']}/.config/autostart/$appName.desktop', 15 | ); 16 | } 17 | 18 | @override 19 | Future isEnabled() async { 20 | return _desktopFile.existsSync(); 21 | } 22 | 23 | @override 24 | Future enable() async { 25 | String contents = ''' 26 | [Desktop Entry] 27 | Type=Application 28 | Name=$appName 29 | Comment=$appName startup script 30 | Exec=${args.isEmpty ? appPath : '$appPath ${args.join(' ')}'} 31 | StartupNotify=false 32 | Terminal=false 33 | '''; 34 | if (!_desktopFile.parent.existsSync()) { 35 | _desktopFile.parent.createSync(recursive: true); 36 | } 37 | _desktopFile.writeAsStringSync(contents); 38 | return true; 39 | } 40 | 41 | @override 42 | Future disable() async { 43 | if (_desktopFile.existsSync()) { 44 | _desktopFile.deleteSync(); 45 | } 46 | return true; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lib/src/app_auto_launcher_impl_macos.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/services.dart'; 4 | import 'package:launch_at_startup/src/app_auto_launcher.dart'; 5 | 6 | class AppAutoLauncherImplMacOS extends AppAutoLauncher { 7 | AppAutoLauncherImplMacOS({ 8 | required super.appName, 9 | required super.appPath, 10 | super.args, 11 | }); 12 | 13 | static const platform = MethodChannel('launch_at_startup'); 14 | 15 | @override 16 | Future isEnabled() async { 17 | final isEnabled = 18 | await platform.invokeMethod('launchAtStartupIsEnabled'); 19 | if (isEnabled == null) { 20 | throw Exception( 21 | 'WARNING: AppAutoLauncherImplMacOS.isEnabled null response! platform.invokeMethod("launchAtStartupIsEnabled") returned a null response when checking if app is set to launch at startup.', 22 | ); 23 | } else { 24 | return isEnabled; 25 | } 26 | } 27 | 28 | @override 29 | Future enable() async { 30 | if (!await isEnabled()) { 31 | await platform 32 | .invokeMethod('launchAtStartupSetEnabled', {'setEnabledValue': true}); 33 | } 34 | return true; 35 | } 36 | 37 | @override 38 | Future disable() async { 39 | if (await isEnabled()) { 40 | await platform.invokeMethod( 41 | 'launchAtStartupSetEnabled', 42 | {'setEnabledValue': false}, 43 | ); 44 | } 45 | return true; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /lib/src/app_auto_launcher_impl_noop.dart: -------------------------------------------------------------------------------- 1 | import 'package:launch_at_startup/src/app_auto_launcher.dart'; 2 | 3 | class AppAutoLauncherImplNoop extends AppAutoLauncher { 4 | AppAutoLauncherImplNoop() : super(appName: '', appPath: ''); 5 | 6 | @override 7 | Future isEnabled() async { 8 | throw UnsupportedError('isEnabled'); 9 | } 10 | 11 | @override 12 | Future enable() async { 13 | throw UnsupportedError('enable'); 14 | } 15 | 16 | @override 17 | Future disable() async { 18 | throw UnsupportedError('disable'); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /lib/src/app_auto_launcher_impl_windows.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'dart:typed_data'; 3 | 4 | import 'package:launch_at_startup/src/app_auto_launcher.dart'; 5 | import 'package:win32_registry/win32_registry.dart' 6 | if (dart.library.html) 'noop.dart'; 7 | 8 | bool isRunningInMsix(String packageName) { 9 | final String resolvedExecutable = Platform.resolvedExecutable; 10 | final bool isMsix = resolvedExecutable.contains('WindowsApps') && 11 | resolvedExecutable.contains(packageName); 12 | return isMsix; 13 | } 14 | 15 | class AppAutoLauncherImplWindows extends AppAutoLauncher { 16 | AppAutoLauncherImplWindows({ 17 | required super.appName, 18 | required String appPath, 19 | List args = const [], 20 | }) : super(appPath: appPath, args: args) { 21 | _registryValue = args.isEmpty ? appPath : '$appPath ${args.join(' ')}'; 22 | } 23 | 24 | late String _registryValue; 25 | 26 | RegistryKey get _regKey => Registry.openPath( 27 | RegistryHive.currentUser, 28 | path: r'Software\Microsoft\Windows\CurrentVersion\Run', 29 | desiredAccessRights: AccessRights.allAccess, 30 | ); 31 | 32 | RegistryKey get _startupApprovedRegKey => Registry.openPath( 33 | RegistryHive.currentUser, 34 | path: 35 | r'Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run', 36 | desiredAccessRights: AccessRights.allAccess, 37 | ); 38 | 39 | static const int _startupApprovedRegKeyBytesLength = 12; 40 | 41 | @override 42 | Future isEnabled() async { 43 | String? value = _regKey.getStringValue(appName); 44 | 45 | return value == _registryValue && await _isStartupApproved(); 46 | } 47 | 48 | @override 49 | Future enable() async { 50 | _regKey.createValue( 51 | RegistryValue.string( 52 | appName, 53 | _registryValue, 54 | ), 55 | ); 56 | 57 | final bytes = Uint8List(_startupApprovedRegKeyBytesLength); 58 | // "2" as a first byte in this register means that the autostart is enabled 59 | bytes[0] = 2; 60 | 61 | _startupApprovedRegKey.createValue(RegistryValue.binary(appName, bytes)); 62 | 63 | return true; 64 | } 65 | 66 | @override 67 | Future disable() async { 68 | _removeValue(_regKey, appName); 69 | _removeValue(_startupApprovedRegKey, appName); 70 | return true; 71 | } 72 | 73 | // https://renenyffenegger.ch/notes/Windows/registry/tree/HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Explorer/StartupApproved/Run/index 74 | // Odd first byte will prevent the app from autostarting 75 | // Empty or any other value will allow the app to autostart 76 | Future _isStartupApproved() async { 77 | final value = _startupApprovedRegKey.getBinaryValue(appName); 78 | 79 | if (value == null) { 80 | return true; 81 | } 82 | 83 | if (value.isEmpty) { 84 | return true; 85 | } 86 | 87 | return value[0].isEven; 88 | } 89 | 90 | void _removeValue(RegistryKey key, String value) { 91 | if (key.getValue(value) != null) { 92 | key.deleteValue(value); 93 | } 94 | } 95 | } 96 | 97 | class AppAutoLauncherImplWindowsMsix extends AppAutoLauncher { 98 | AppAutoLauncherImplWindowsMsix({ 99 | required super.appName, 100 | required super.appPath, 101 | required this.packageName, 102 | super.args, 103 | }); 104 | 105 | final String packageName; 106 | 107 | File get _shortcutFile { 108 | return File( 109 | '${Platform.environment['APPDATA']}\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\$appName.lnk', 110 | ); 111 | } 112 | 113 | @override 114 | Future isEnabled() async { 115 | return _shortcutFile.existsSync(); 116 | } 117 | 118 | @override 119 | Future enable() async { 120 | final String script = ''' 121 | \$TargetPath = "$appPath" 122 | \$ShortcutFile = "\$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\$appName.lnk" 123 | \$WScriptShell = New-Object -ComObject WScript.Shell 124 | \$Shortcut = \$WScriptShell.CreateShortcut(\$ShortcutFile) 125 | \$Shortcut.TargetPath = \$TargetPath 126 | \$Shortcut.Arguments = "${args.join(' ')}" 127 | \$Shortcut.Save() 128 | '''; 129 | final result = Process.runSync('powershell', ['-Command', script]); 130 | if (result.stderr != null && result.stderr!.isNotEmpty) { 131 | throw Exception('Failed to create shortcut: ${result.stderr}'); 132 | } 133 | return _shortcutFile.existsSync(); 134 | } 135 | 136 | @override 137 | Future disable() async { 138 | if (_shortcutFile.existsSync()) { 139 | final String script = ''' 140 | Remove-Item -Path "\$env:APPDATA\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\$appName.lnk" 141 | '''; 142 | final result = Process.runSync('powershell', ['-Command', script]); 143 | if (result.stderr != null && result.stderr!.isNotEmpty) { 144 | throw Exception('Failed to delete shortcut: ${result.stderr}'); 145 | } 146 | } 147 | return !_shortcutFile.existsSync(); 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /lib/src/app_auto_launcher_impl_windows_noop.dart: -------------------------------------------------------------------------------- 1 | import 'package:launch_at_startup/src/app_auto_launcher_impl_noop.dart'; 2 | 3 | bool isRunningInMsix(String packageName) { 4 | return false; 5 | } 6 | 7 | class AppAutoLauncherImplWindows extends AppAutoLauncherImplNoop { 8 | AppAutoLauncherImplWindows({ 9 | required String appName, 10 | required String appPath, 11 | List args = const [], 12 | }) : super(); 13 | } 14 | 15 | class AppAutoLauncherImplWindowsMsix extends AppAutoLauncherImplNoop { 16 | AppAutoLauncherImplWindowsMsix({ 17 | required String appName, 18 | required String appPath, 19 | required String packageName, 20 | List args = const [], 21 | }) : super(); 22 | } 23 | -------------------------------------------------------------------------------- /lib/src/launch_at_startup.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:io'; 3 | 4 | import 'package:flutter/foundation.dart'; 5 | import 'package:launch_at_startup/src/app_auto_launcher.dart'; 6 | import 'package:launch_at_startup/src/app_auto_launcher_impl_linux.dart'; 7 | import 'package:launch_at_startup/src/app_auto_launcher_impl_macos.dart'; 8 | import 'package:launch_at_startup/src/app_auto_launcher_impl_noop.dart'; 9 | import 'package:launch_at_startup/src/app_auto_launcher_impl_windows.dart' 10 | if (dart.library.html) 'app_auto_launcher_impl_windows_noop.dart'; 11 | 12 | class LaunchAtStartup { 13 | LaunchAtStartup._(); 14 | 15 | /// The shared instance of [LaunchAtStartup]. 16 | static final LaunchAtStartup instance = LaunchAtStartup._(); 17 | 18 | AppAutoLauncher _appAutoLauncher = AppAutoLauncherImplNoop(); 19 | 20 | void setup({ 21 | required String appName, 22 | required String appPath, 23 | String? packageName, 24 | List args = const [], 25 | }) { 26 | if (!kIsWeb && Platform.isLinux) { 27 | _appAutoLauncher = AppAutoLauncherImplLinux( 28 | appName: appName, 29 | appPath: appPath, 30 | args: args, 31 | ); 32 | } else if (!kIsWeb && Platform.isMacOS) { 33 | _appAutoLauncher = AppAutoLauncherImplMacOS( 34 | appName: appName, 35 | appPath: appPath, 36 | args: args, 37 | ); 38 | } else if (!kIsWeb && Platform.isWindows) { 39 | if (packageName != null && isRunningInMsix(packageName)) { 40 | _appAutoLauncher = AppAutoLauncherImplWindowsMsix( 41 | appName: appName, 42 | appPath: appPath, 43 | packageName: packageName, 44 | args: args, 45 | ); 46 | return; 47 | } 48 | _appAutoLauncher = AppAutoLauncherImplWindows( 49 | appName: appName, 50 | appPath: appPath, 51 | args: args, 52 | ); 53 | } 54 | } 55 | 56 | /// Sets your app to auto-launch at startup 57 | Future enable() => _appAutoLauncher.enable(); 58 | 59 | /// Disables your app from auto-launching at startup. 60 | Future disable() => _appAutoLauncher.disable(); 61 | 62 | Future isEnabled() => _appAutoLauncher.isEnabled(); 63 | } 64 | 65 | final launchAtStartup = LaunchAtStartup.instance; 66 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: launch_at_startup 2 | description: This plugin allows Flutter desktop apps to Auto launch on startup / login. 3 | version: 0.5.1 4 | homepage: https://leanflutter.dev/documentation/launch_at_startup 5 | repository: https://github.com/leanflutter/launch_at_startup 6 | issue_tracker: https://github.com/leanflutter/launch_at_startup/issues 7 | documentation: https://leanflutter.dev/documentation/launch_at_startup 8 | 9 | platforms: 10 | linux: 11 | macos: 12 | windows: 13 | 14 | environment: 15 | sdk: ">=3.0.0 <4.0.0" 16 | flutter: ">=3.3.0" 17 | 18 | dependencies: 19 | flutter: 20 | sdk: flutter 21 | win32_registry: ^2.0.0 22 | 23 | dev_dependencies: 24 | dependency_validator: ^3.0.0 25 | # flutter_test: 26 | # sdk: flutter 27 | mostly_reasonable_lints: ^0.1.2 28 | --------------------------------------------------------------------------------