mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 09:00:38 +08:00
docs: sync translations (#2893)
Co-authored-by: leaanthony <leaanthony@users.noreply.github.com>
This commit is contained in:
parent
30d17a760d
commit
a59f8b2cf3
@ -60,6 +60,10 @@ Si vous n'êtes pas sûr d'un modèle, inspectez `package.json` et `wails.json`
|
||||
- [wails-elm-template](https://github.com/benjamin-thomas/wails-elm-template) - Développez votre application GUI avec de la programmation fonctionnelle et une configuration de développement en direct :tada: :rocket:
|
||||
- [wails-template-elm-tailwind](https://github.com/rnice01/wails-template-elm-tailwind) - Combine les puissances :muscle: d'Elm + Tailwind CSS + Wails ! Rechargement automatique pris en charge.
|
||||
|
||||
## HTMX
|
||||
|
||||
- [wails-htmx-templ-chi-tailwind](https://github.com/PylotLight/wails-hmtx-templ-template) - Use a unique combination of pure htmx for interactivity plus templ for creating components and forms
|
||||
|
||||
## Pure JavaScript (Vanilla)
|
||||
|
||||
- [wails-pure-js-template](https://github.com/KiddoV/wails-pure-js-template) - Un modèle avec rien que du JavaScript, du HTML et du CSS de base
|
||||
|
@ -0,0 +1,66 @@
|
||||
# Crossplatform build with Github Actions
|
||||
|
||||
To build a Wails project for all the available platforms, you need to create an application build for each operating system. One effective method to achieve this is by utilizing GitHub Actions.
|
||||
|
||||
An action that facilitates building a Wails app is available at:
|
||||
https://github.com/dAppServer/wails-build-action
|
||||
|
||||
In case the existing action doesn't fulfill your requirements, you can select only the necessary steps from the source:
|
||||
https://github.com/dAppServer/wails-build-action/blob/main/action.yml
|
||||
|
||||
Below is a comprehensive example that demonstrates building an app upon the creation of a new Git tag and subsequently uploading it to the Actions artifacts:
|
||||
|
||||
```yaml
|
||||
name: Wails build
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
# Match any new tag
|
||||
- '*'
|
||||
|
||||
env:
|
||||
# Necessary for most environments as build failure can occur due to OOM issues
|
||||
NODE_OPTIONS: "--max-old-space-size=4096"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
# Failure in one platform build won't impact the others
|
||||
fail-fast: false
|
||||
matrix:
|
||||
build:
|
||||
- name: 'App'
|
||||
platform: 'linux/amd64'
|
||||
os: 'ubuntu-latest'
|
||||
- name: 'App'
|
||||
platform: 'windows/amd64'
|
||||
os: 'windows-latest'
|
||||
- name: 'App'
|
||||
platform: 'darwin/universal'
|
||||
os: 'macos-latest'
|
||||
|
||||
runs-on: ${{ matrix.build.os }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Build wails
|
||||
uses: dAppServer/wails-build-action@v2.2
|
||||
id: build
|
||||
with:
|
||||
build-name: ${{ matrix.build.name }}
|
||||
build-platform: ${{ matrix.build.platform }}
|
||||
package: false
|
||||
go-version: '1.20'
|
||||
```
|
||||
|
||||
This example offers opportunities for various enhancements, including:
|
||||
|
||||
- Caching dependencies
|
||||
- Code signing
|
||||
- Uploading to platforms like S3, Supbase, etc.
|
||||
- Injecting secrets as environment variables
|
||||
- Utilizing environment variables as build variables (such as version variable extracted from the current Git tag)
|
@ -0,0 +1,199 @@
|
||||
# File Association
|
||||
|
||||
File association feature allows you to associate specific file types with your app so that when users open those files,
|
||||
your app is launched to handle them. This can be particularly useful for text editors, image viewers, or any application
|
||||
that works with specific file formats. In this guide, we'll walk through the steps to implement file association in Wails app.
|
||||
|
||||
## Set Up File Association:
|
||||
|
||||
To set up file association, you need to modify your application's wails.json file.
|
||||
In "info" section add a "fileAssociations" section specifying the file types your app should be associated with.
|
||||
|
||||
For example:
|
||||
|
||||
```json
|
||||
{
|
||||
"info": {
|
||||
"fileAssociations": [
|
||||
{
|
||||
"ext": "wails",
|
||||
"name": "Wails",
|
||||
"description": "Wails Application File",
|
||||
"iconName": "wailsFileIcon",
|
||||
"role": "Editor"
|
||||
},
|
||||
{
|
||||
"ext": "jpg",
|
||||
"name": "JPEG",
|
||||
"description": "Image File",
|
||||
"iconName": "jpegFileIcon",
|
||||
"role": "Editor"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
| Property | Description |
|
||||
| :---------- | :------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| ext | The extension (minus the leading period). e.g. png |
|
||||
| name | The name. e.g. PNG File |
|
||||
| iconName | The icon name without extension. Icons should be located in build folder. Proper icons will be generated from .png file for both macOS and Windows |
|
||||
| description | Windows-only. The description. It is displayed on the `Type` column on Windows Explorer. |
|
||||
| role | macOS-only. The app’s role with respect to the type. Corresponds to CFBundleTypeRole. |
|
||||
|
||||
## Platform Specifics:
|
||||
|
||||
### macOS
|
||||
|
||||
When you open file (or files) with your app, the system will launch your app and call the `OnFileOpen` function in your Wails app. Example:
|
||||
|
||||
```go title="main.go"
|
||||
func main() {
|
||||
// Create application with options
|
||||
err := wails.Run(&options.App{
|
||||
Title: "wails-open-file",
|
||||
Width: 1024,
|
||||
Height: 768,
|
||||
AssetServer: &assetserver.Options{
|
||||
Assets: assets,
|
||||
},
|
||||
BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1},
|
||||
Mac: &mac.Options{
|
||||
OnFileOpen: func(filePaths []string) { println(filestring) },
|
||||
},
|
||||
Bind: []interface{}{
|
||||
app,
|
||||
},
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
println("Error:", err.Error())
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Windows
|
||||
|
||||
On Windows file association is supported only with NSIS installer. During installation, the installer will create a
|
||||
registry entry for your file associations. When you open file with your app, new instance of app is launched and file path is passed
|
||||
as argument to your app. To handle this you should parse command line arguments in your app. Example:
|
||||
|
||||
```go title="main.go"
|
||||
func main() {
|
||||
argsWithoutProg := os.Args[1:]
|
||||
|
||||
if len(argsWithoutProg) != 0 {
|
||||
println("launchArgs", argsWithoutProg)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Linux
|
||||
|
||||
Currently, Wails doesn't support bundling for Linux. So, you need to create file associations manually.
|
||||
For example if you distribute your app as a .deb package, you can create file associations by adding required files in you bundle.
|
||||
You can use [nfpm](https://nfpm.goreleaser.com/) to create .deb package for your app.
|
||||
|
||||
1. Create a .desktop file for your app and specify file associations there. Example:
|
||||
|
||||
```ini
|
||||
[Desktop Entry]
|
||||
Categories=Office
|
||||
Exec=/usr/bin/wails-open-file %u
|
||||
Icon=wails-open-file.png
|
||||
Name=wails-open-file
|
||||
Terminal=false
|
||||
Type=Application
|
||||
MimeType=application/x-wails;application/x-test
|
||||
```
|
||||
|
||||
2. Create mime types file. Example:
|
||||
|
||||
```xml
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
|
||||
<mime-type type="application/x-wails">
|
||||
<comment>Wails Application File</comment>
|
||||
<glob pattern="*.wails"/>
|
||||
</mime-type>
|
||||
</mime-info>
|
||||
```
|
||||
|
||||
3. Create icons for your file types. SVG icons are recommended.
|
||||
4. Prepare postInstall/postRemove scripts for your package. Example:
|
||||
|
||||
```sh
|
||||
# reload mime types to register file associations
|
||||
update-mime-database /usr/share/mime
|
||||
# reload desktop database to load app in list of available
|
||||
update-desktop-database /usr/share/applications
|
||||
# update icons
|
||||
update-icon-caches /usr/share/icons/*
|
||||
```
|
||||
|
||||
5. Configure nfpm to use your scripts and files. Example:
|
||||
|
||||
```yaml
|
||||
name: "wails-open-file"
|
||||
arch: "arm64"
|
||||
platform: "linux"
|
||||
version: "1.0.0"
|
||||
section: "default"
|
||||
priority: "extra"
|
||||
maintainer: "FooBarCorp <FooBarCorp@gmail.com>"
|
||||
description: "Sample Package"
|
||||
vendor: "FooBarCorp"
|
||||
homepage: "http://example.com"
|
||||
license: "MIT"
|
||||
contents:
|
||||
- src: ../bin/wails-open-file
|
||||
dst: /usr/bin/wails-open-file
|
||||
- src: ./main.desktop
|
||||
dst: /usr/share/applications/wails-open-file.desktop
|
||||
- src: ./application-wails-mime.xml
|
||||
dst: /usr/share/mime/packages/application-x-wails.xml
|
||||
- src: ./application-test-mime.xml
|
||||
dst: /usr/share/mime/packages/application-x-test.xml
|
||||
- src: ../appicon.svg
|
||||
dst: /usr/share/icons/hicolor/scalable/apps/wails-open-file.svg
|
||||
- src: ../wailsFileIcon.svg
|
||||
dst: /usr/share/icons/hicolor/scalable/mimetypes/application-x-wails.svg
|
||||
- src: ../testFileIcon.svg
|
||||
dst: /usr/share/icons/hicolor/scalable/mimetypes/application-x-test.svg
|
||||
# copy icons to Yaru theme as well. For some reason Ubuntu didn't pick up fileicons from hicolor theme
|
||||
- src: ../appicon.svg
|
||||
dst: /usr/share/icons/Yaru/scalable/apps/wails-open-file.svg
|
||||
- src: ../wailsFileIcon.svg
|
||||
dst: /usr/share/icons/Yaru/scalable/mimetypes/application-x-wails.svg
|
||||
- src: ../testFileIcon.svg
|
||||
dst: /usr/share/icons/Yaru/scalable/mimetypes/application-x-test.svg
|
||||
scripts:
|
||||
postinstall: ./postInstall.sh
|
||||
postremove: ./postRemove.sh
|
||||
```
|
||||
|
||||
6. Build your .deb package using nfpm:
|
||||
|
||||
```sh
|
||||
nfpm pkg --packager deb --target .
|
||||
```
|
||||
|
||||
7. Now when your package is installed, your app will be associated with specified file types. When you open file with your app,
|
||||
new instance of app is launched and file path is passed as argument to your app.
|
||||
To handle this you should parse command line arguments in your app. Example:
|
||||
|
||||
```go title="main.go"
|
||||
func main() {
|
||||
argsWithoutProg := os.Args[1:]
|
||||
|
||||
if len(argsWithoutProg) != 0 {
|
||||
println("launchArgs", argsWithoutProg)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Limitations:
|
||||
|
||||
On Windows and Linux when associated file is opened, new instance of your app is launched.
|
||||
Currently, Wails doesn't support opening files in already running app. There is plugin for single instance support for v3 in development.
|
@ -159,6 +159,28 @@ If `/Applications/Xcode.app/Contents/Developer` is displayed, run `sudo xcode-se
|
||||
|
||||
Sources: https://github.com/wailsapp/wails/issues/1806 and https://github.com/wailsapp/wails/issues/1140#issuecomment-1290446496
|
||||
|
||||
## My application won't compile on Mac
|
||||
|
||||
If you are getting errors like this:
|
||||
|
||||
```shell
|
||||
l1@m2 GoEasyDesigner % go build -tags dev -gcflags "all=-N -l"
|
||||
/Users/l1/sdk/go1.20.5/pkg/tool/darwin_arm64/link: running clang failed: exit status 1
|
||||
Undefined symbols for architecture arm64:
|
||||
"_OBJC_CLASS_$_UTType", referenced from:
|
||||
objc-class-ref in 000016.o
|
||||
ld: symbol(s) not found for architecture arm64
|
||||
clang: error: linker command failed with exit code 1 (use -v to see invocation)
|
||||
```
|
||||
Ensure you have the latest SDK installed. If so and you're still experiencing this issue, try the following:
|
||||
|
||||
```shell
|
||||
export CGO_LDFLAGS="-framework UniformTypeIdentifiers" && go build -tags dev -gcflags "all=-N -l"
|
||||
```
|
||||
|
||||
Sources: https://github.com/wailsapp/wails/pull/2925#issuecomment-1726828562
|
||||
|
||||
|
||||
--
|
||||
|
||||
## Cannot start service: Host version "x.x.x does not match binary version "x.x.x"
|
||||
@ -185,4 +207,162 @@ This is due to the default background of the webview being white. If you want to
|
||||
WebviewIsTransparent: true,
|
||||
},
|
||||
})
|
||||
```
|
||||
```
|
||||
|
||||
## I get a "Microsoft Edge can't read or write to its data directory" error when running my program as admin on Windows
|
||||
|
||||
You set your program to require admin permissions and it worked great! Unfortunately, some users are seeing a "Microsoft Edge can't read or write to its data directory" error when running it.
|
||||
|
||||
When a Windows machine has two local accounts:
|
||||
|
||||
- Alice, an admin
|
||||
- Bob, a regular user
|
||||
|
||||
Bob sees a UAC prompt when running your program. Bob enters Alice's admin credentials into this prompt. The app launches with admin permissions under Alice's account.
|
||||
|
||||
Wails instructs WebView2 to store user data at the specified `WebviewUserDataPath`. It defaults to `%APPDATA%\[BinaryName.exe]`.
|
||||
|
||||
Because the application is running under Alice's account, `%APPDATA%\[BinaryName.exe]` resolves to `C:\Users\Alice\AppData\Roaming\[BinaryName.exe]`.
|
||||
|
||||
WebView2 [creates some child processes under Bob's logged-in account instead of Alice's admin account](https://github.com/MicrosoftEdge/WebView2Feedback/issues/932#issue-807464179). Since Bob cannot access `C:\Users\Alice\AppData\Roaming\[BinaryName.exe]`, the "Microsoft Edge can't read or write to its data directory" error is shown.
|
||||
|
||||
Possible solution #1:
|
||||
|
||||
Refactor your application to work without constant admin permissions. If you just need to perform a small set of admin tasks (such as running an updater), you can run your application with the minimum permissions and then use the `runas` command to run these tasks with admin permissions as needed:
|
||||
|
||||
```go
|
||||
//go:build windows
|
||||
|
||||
package sample
|
||||
|
||||
import (
|
||||
"golang.org/x/sys/windows"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// Calling RunAs("C:\path\to\my\updater.exe") shows Bob a UAC prompt. Bob enters Alice's admin credentials. The updater launches with admin permissions under Alice's account.
|
||||
func RunAs(path string) error {
|
||||
verbPtr, _ := syscall.UTF16PtrFromString("runas")
|
||||
exePtr, _ := syscall.UTF16PtrFromString(path)
|
||||
cwdPtr, _ := syscall.UTF16PtrFromString("")
|
||||
argPtr, _ := syscall.UTF16PtrFromString("")
|
||||
|
||||
var showCmd int32 = 1 //SW_NORMAL
|
||||
|
||||
err := windows.ShellExecute(0, verbPtr, exePtr, argPtr, cwdPtr, showCmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
```
|
||||
|
||||
Possible solution #2:
|
||||
|
||||
Run your application with extended permissions. If you absolutely must run with constant admin permissions, WebView2 will function correctly if you use a data directory accessible by both users and you also launch your app with the `SeBackupPrivilege`, `SeDebugPrivilege`, and `SeRestorePrivilege` permissions. Here's an example:
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"os"
|
||||
"runtime"
|
||||
|
||||
"github.com/fourcorelabs/wintoken"
|
||||
"github.com/hectane/go-acl"
|
||||
"github.com/wailsapp/wails/v2"
|
||||
"github.com/wailsapp/wails/v2/pkg/options"
|
||||
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
|
||||
"github.com/wailsapp/wails/v2/pkg/options/windows"
|
||||
)
|
||||
|
||||
//go:embed all:frontend/dist
|
||||
var assets embed.FS
|
||||
|
||||
const (
|
||||
fixedTokenKey = "SAMPLE_RANDOM_KEY"
|
||||
fixedTokenVal = "with-fixed-token"
|
||||
webviewDir = "C:\\ProgramData\\Sample"
|
||||
)
|
||||
|
||||
func runWithFixedToken() {
|
||||
println("Re-launching self")
|
||||
token, err := wintoken.OpenProcessToken(0, wintoken.TokenPrimary) //pass 0 for own process
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer token.Close()
|
||||
|
||||
token.EnableTokenPrivileges([]string{
|
||||
"SeBackupPrivilege",
|
||||
"SeDebugPrivilege",
|
||||
"SeRestorePrivilege",
|
||||
})
|
||||
|
||||
cmd := exec.Command(os.Args[0])
|
||||
cmd.Args = os.Args
|
||||
cmd.Env = os.Environ()
|
||||
cmd.Env = append(cmd.Env, fmt.Sprintf("%v=%v", fixedTokenKey, fixedTokenVal))
|
||||
cmd.Stdin = os.Stdin
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{Token: syscall.Token(token.Token())}
|
||||
if err := cmd.Run(); err != nil {
|
||||
println("Error after launching self:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
println("Clean self launch :)")
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
func main() {
|
||||
if runtime.GOOS == "windows" && os.Getenv(fixedTokenKey) != fixedTokenVal {
|
||||
runWithFixedToken()
|
||||
}
|
||||
|
||||
println("Setting data dir to", webviewDir)
|
||||
if err := os.MkdirAll(webviewDir, os.ModePerm); err != nil {
|
||||
println("Failed creating dir:", err)
|
||||
}
|
||||
if err := acl.Chmod(webviewDir, 0777); err != nil {
|
||||
println("Failed setting ACL on dir:", err)
|
||||
}
|
||||
|
||||
app := NewApp()
|
||||
|
||||
err := wails.Run(&options.App{
|
||||
Title: "sample-data-dir",
|
||||
Width: 1024,
|
||||
Height: 768,
|
||||
AssetServer: &assetserver.Options{
|
||||
Assets: assets,
|
||||
},
|
||||
Bind: []interface{}{
|
||||
app,
|
||||
},
|
||||
Windows: &windows.Options{
|
||||
WebviewUserDataPath: webviewDir,
|
||||
},
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
println("Error:", err.Error())
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If you use a data directory accessible by both users but not the extended privileges, you will receive a WebView2 `80010108 The object invoked has disconnected from its clients` error.
|
||||
|
||||
Possible future solution #3: [run WebView2 using an in-memory mode if implemented](https://github.com/MicrosoftEdge/WebView2Feedback/issues/3637#issuecomment-1728300982).
|
||||
|
||||
## WebView2 installation succeeded, but the wails doctor command shows that it is not installed
|
||||
|
||||
If you have installed WebView2, but the `wails doctor` command shows that it is not installed, it is likely that the WebView2 runtime installed was for a different architecture. You can download the correct runtime from [here](https://developer.microsoft.com/en-us/microsoft-edge/webview2/).
|
||||
|
||||
Source: https://github.com/wailsapp/wails/issues/2917
|
||||
|
||||
## WebVie2wProcess failed with kind
|
||||
|
||||
If your Windows app generates this kind of error, you can check out what the error means [here](https://docs.microsoft.com/en-us/microsoft-edge/webview2/reference/winrt/microsoft_web_webview2_core/corewebview2processfailedkind?view=webview2-winrt-1.0.2045.28).
|
||||
|
||||
|
@ -49,35 +49,35 @@ Si vous n'êtes pas sûr d'un modèle, inspectez les fichiers `package.json` et
|
||||
|
||||
`wails build` est utilisé pour compiler votre projet vers un binaire prêt à la production.
|
||||
|
||||
| Option | Description | Par défaut |
|
||||
|:-------------------- |:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| -clean | Nettoie le répertoire `build/bin` | |
|
||||
| -compiler "compiler" | Utiliser un autre compilateur pour compiler, par exemple go1.15beta1 | go |
|
||||
| -debug | Conserve les informations de débogage dans l'application et affiche la console de débogage. Permet l'utilisation des outils de développement dans la fenêtre de l'application | |
|
||||
| -devtools | Permet l'utilisation des devtools dans la fenêtre d'application en production (quand -debug n'est pas utilisé) | |
|
||||
| -dryrun | Affiche la commande build sans l'exécuter | |
|
||||
| -f | Forcer la compilation de l'application | |
|
||||
| -garbleargs | Arguments à passer à garble | `-literals -tiny -seed=random` |
|
||||
| -ldflags "flags" | Options supplémentaires à passer au compilateur | |
|
||||
| -m | Permet d'ignorer mod tidy avant la compilation | |
|
||||
| -nopackage | Ne pas empaqueter l'application | |
|
||||
| -nocolour | Désactive la couleur des logs dans le terminal | |
|
||||
| -nosyncgomod | Ne pas synchroniser go.mod avec la version Wails | |
|
||||
| -nsis | Génère l'installateur NSIS pour Windows | |
|
||||
| -o filename | Nom du fichier de sortie | |
|
||||
| -obfuscated | Cacher le code de l'application en utilisant [garble](https://github.com/burrowers/garble) | |
|
||||
| -platform | Construit pour les [plates-formes](../reference/cli.mdx#platforms) données (séparées par des virgules) par exemple. `windows/arm64`. Notez que si vous ne donnez pas l'architecture, `runtime.GOARCH` est utilisé. | platform = le contenu de la variable d'environnement `GOOS` si elle existe, autrement `runtime.GOOS`.<br/>arch = le contenu de la variable d'environnement `GOARCH` si elle existe, autrement `runtime.GOARCH`. |
|
||||
| -race | Construire avec le détecteur Go race | |
|
||||
| -s | Ignorer la construction du frontend | |
|
||||
| -skipbindings | Ignorer la génération des liaisons | |
|
||||
| -tags "extra tags" | Options de compilation à passer au compilateur Go. Doivent être entre guillemets. Séparés par un espace ou une virgule (pas les deux) | |
|
||||
| -trimpath | Supprimer tous les chemins vers les fichiers système de l'exécutable final. | |
|
||||
| -u | Met à jour le `go.mod de votre projet` pour utiliser la même version de Wails que le CLI | |
|
||||
| -upx | Compresser le binaire final en utilisant "upx" | |
|
||||
| -upxflags | Options à passer à upx | |
|
||||
| -v int | Niveau de verbosité (0 - silencieux, 1 - par défaut, 2 - verbeux) | 1 |
|
||||
| -webview2 | Stratégie d'installation WebView2 : download,embed,browser,error | download |
|
||||
| -windowsconsole | Garder la fenêtre de la console lors de la construction d'une version pour Windows | |
|
||||
| Option | Description | Par défaut |
|
||||
|:-------------------- |:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| -clean | Nettoie le répertoire `build/bin` | |
|
||||
| -compiler "compiler" | Utiliser un autre compilateur pour compiler, par exemple go1.15beta1 | go |
|
||||
| -debug | Conserve les informations de débogage dans l'application et affiche la console de débogage. Permet l'utilisation des outils de développement dans la fenêtre de l'application | |
|
||||
| -devtools | Allows the use of the devtools in the application window in production (when -debug is not used). Ctrl/Cmd+Shift+F12 may be used to open the devtools window. *NOTE*: This option will make your application FAIL Mac appstore guidelines. Use for debugging only. | |
|
||||
| -dryrun | Affiche la commande build sans l'exécuter | |
|
||||
| -f | Forcer la compilation de l'application | |
|
||||
| -garbleargs | Arguments à passer à garble | `-literals -tiny -seed=random` |
|
||||
| -ldflags "flags" | Options supplémentaires à passer au compilateur | |
|
||||
| -m | Permet d'ignorer mod tidy avant la compilation | |
|
||||
| -nopackage | Ne pas empaqueter l'application | |
|
||||
| -nocolour | Désactive la couleur des logs dans le terminal | |
|
||||
| -nosyncgomod | Ne pas synchroniser go.mod avec la version Wails | |
|
||||
| -nsis | Génère l'installateur NSIS pour Windows | |
|
||||
| -o filename | Nom du fichier de sortie | |
|
||||
| -obfuscated | Cacher le code de l'application en utilisant [garble](https://github.com/burrowers/garble) | |
|
||||
| -platform | Construit pour les [plates-formes](../reference/cli.mdx#platforms) données (séparées par des virgules) par exemple. `windows/arm64`. Notez que si vous ne donnez pas l'architecture, `runtime.GOARCH` est utilisé. | platform = le contenu de la variable d'environnement `GOOS` si elle existe, autrement `runtime.GOOS`.<br/>arch = le contenu de la variable d'environnement `GOARCH` si elle existe, autrement `runtime.GOARCH`. |
|
||||
| -race | Construire avec le détecteur Go race | |
|
||||
| -s | Ignorer la construction du frontend | |
|
||||
| -skipbindings | Ignorer la génération des liaisons | |
|
||||
| -tags "extra tags" | Options de compilation à passer au compilateur Go. Doivent être entre guillemets. Séparés par un espace ou une virgule (pas les deux) | |
|
||||
| -trimpath | Supprimer tous les chemins vers les fichiers système de l'exécutable final. | |
|
||||
| -u | Met à jour le `go.mod de votre projet` pour utiliser la même version de Wails que le CLI | |
|
||||
| -upx | Compresser le binaire final en utilisant "upx" | |
|
||||
| -upxflags | Options à passer à upx | |
|
||||
| -v int | Niveau de verbosité (0 - silencieux, 1 - par défaut, 2 - verbeux) | 1 |
|
||||
| -webview2 | Stratégie d'installation WebView2 : download,embed,browser,error | download |
|
||||
| -windowsconsole | Garder la fenêtre de la console lors de la construction d'une version pour Windows | |
|
||||
|
||||
Pour une description détaillée des options `webview2` , veuillez vous référer au Guide de [Windows](../guides/windows.mdx).
|
||||
|
||||
@ -167,8 +167,8 @@ Your system is ready for Wails development!
|
||||
- Un serveur web est lancé sur `http://localhost:34115` qui sert votre application (et pas seulement le frontend) sur http. Cela vous permet d'utiliser les extensions de développement de votre navigateur favori
|
||||
- Tous les assets de l'application sont chargés à partir du disque. Si elles sont modifiées, l'application se rechargera automatiquement (pas de recompilation). Tous les navigateurs connectés rechargeront également
|
||||
- Un module JS est généré fournissant les éléments suivants :
|
||||
- Les méthodes Javascript permettant d'appeler vos méthodes Go avec JSDoc autogénérée, vous fournissant des indications sur les méthodes
|
||||
- Les versions TypeScript de vos structures Go, qui peuvent être construites et transmises à vos méthodes
|
||||
- Les méthodes Javascript permettant d'appeler vos méthodes Go avec JSDoc autogénérée, vous fournissant des indications sur les méthodes
|
||||
- Les versions TypeScript de vos structures Go, qui peuvent être construites et transmises à vos méthodes
|
||||
- Un second module JS est généré qui fournit une déclaration des méthodes et structures pour l'exécutable
|
||||
- Sur macOS, il regroupera l'application dans un fichier `.app` et l'exécutera. Il utilisera un `build/darwin/Info.dev.plist` pour le développement.
|
||||
|
||||
|
@ -366,7 +366,7 @@ Nom: CSSDragValue<br/> Type: `string`
|
||||
|
||||
EnableDefaultContextMenu active le menu contextuel par défaut du navigateur en production.
|
||||
|
||||
Par défaut, le menu contextuel par défaut du navigateur n'est disponible qu'en développement et dans un `-debug` ou `-devtools` [build](../reference/cli.mdx#build) avec l'inspecteur de devtools, En utilisant cette option, vous pouvez activer le menu contextuel par défaut dans `production` alors que l'inspecteur devtools ne sera pas disponible à moins que le drapeau `-devtools` ne soit utilisé.
|
||||
By default, the browser's default context-menu is only available in development and in a `-debug` [build](../reference/cli.mdx#build) along with the devtools inspector, Using this option you can enable the default context-menu in `production` while the devtools inspector won't be available unless the `-devtools` build flag is used.
|
||||
|
||||
Lorsque cette option est activée, par défaut, le menu contextuel ne sera affiché que pour du texte (où Couper/Copier/Coller est nécessaire), pour remplacer ce comportement, vous pouvez utiliser la propriété CSS `--default-contextmenu` sur n'importe quel élément HTML (y compris le corps ``) avec les valeurs suivantes :
|
||||
|
||||
@ -593,6 +593,12 @@ Définir ceci à `true` désactivera l'accélération matérielle GPU pour la we
|
||||
|
||||
Nom: WebviewGpuIsDisabled<br/> Type: `bool`
|
||||
|
||||
#### EnableSwipeGestures
|
||||
|
||||
Setting this to `true` will enable swipe gestures for the webview.
|
||||
|
||||
Name: EnableSwipeGestures<br/> Type: `bool`
|
||||
|
||||
### Mac
|
||||
|
||||
Ceci définit [les options spécifiques à Mac](#mac).
|
||||
@ -688,6 +694,42 @@ Définir ceci à `true` rendra l'arrière-plan de la fenêtre translucide. Souve
|
||||
|
||||
Nom: WindowIsTranslucent<br/> Type: `bool`
|
||||
|
||||
#### Preferences
|
||||
|
||||
The Preferences struct provides the ability to configure the Webview preferences.
|
||||
|
||||
Name: Preferences<br/> Type: [`*mac.Preferences`](#preferences-struct)
|
||||
|
||||
##### Preferences struct
|
||||
|
||||
You can specify the webview preferences.
|
||||
|
||||
```go
|
||||
type Preferences struct {
|
||||
TabFocusesLinks u.Bool
|
||||
TextInteractionEnabled u.Bool
|
||||
FullscreenEnabled u.Bool
|
||||
}
|
||||
```
|
||||
|
||||
| Nom | Description |
|
||||
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| TabFocusesLinks | A Boolean value that indicates whether pressing the tab key changes the focus to links and form controls. [Apple Docs](https://developer.apple.com/documentation/webkit/wkpreferences/2818595-tabfocuseslinks?language=objc) |
|
||||
| TextInteractionEnabled | A Boolean value that indicates whether to allow people to select or otherwise interact with text. [Apple Docs](https://developer.apple.com/documentation/webkit/wkpreferences/3727362-textinteractionenabled?language=objc) |
|
||||
| FullscreenEnabled | A Boolean value that indicates whether a web view can display content full screen. [Apple Docs](https://developer.apple.com/documentation/webkit/wkpreferences/3917769-elementfullscreenenabled?language=objc) |
|
||||
|
||||
Exemple:
|
||||
|
||||
```go
|
||||
Mac: &mac.Options{
|
||||
Preferences: &mac.Preferences{
|
||||
TabFocusesLinks: mac.Enabled,
|
||||
TextInteractionEnabled: mac.Disabled,
|
||||
FullscreenEnabled: mac.Enabled,
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### About
|
||||
|
||||
Cette configuration vous permet de définir le titre, le message et l'icône pour l'élément de menu "À propos" dans le menu de l'application créé par le rôle "AppMenu".
|
||||
|
@ -13,6 +13,28 @@ Le format est basé sur [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Ajouts
|
||||
|
||||
- Added support for enabling/disabling swipe gestures for Windows WebView2. Added by @leaanthony in [PR](https://github.com/wailsapp/wails/pull/2878)
|
||||
- When building with `-devtools` flag, CMD/CTRL+SHIFT+F12 can be used to open the devtools. Added by @leaanthony in [PR](https://github.com/wailsapp/wails/pull/2915) – Added file association support for macOS and Windows. Added by @APshenkin in [PR](https://github.com/wailsapp/wails/pull/2918)
|
||||
- Added support for setting some of the Webview preferences, `textInteractionEnabled` and `tabFocusesLinks` on Mac. Added by @fkhadra in [PR](https://github.com/wailsapp/wails/pull/2937)
|
||||
- Added support for enabling/disabling fullscreen of the Webview on Mac. Added by @fkhadra in [PR](https://github.com/wailsapp/wails/pull/2953)
|
||||
- Added French README.fr.md page. Added by @nejos97 in [PR](https://github.com/wailsapp/wails/pull/2943)
|
||||
- New task created for linting v2 `task v2:lint`. Workflow updated to run the task. Added by @mikeee in [PR](https://github.com/wailsapp/wails/pull/2957)
|
||||
- Added new community template wails-htmx-templ-chi-tailwind. Added by [@pylotlight](https://github.com/pylotlight) in [PR](https://github.com/wailsapp/wails/pull/2984)
|
||||
- Added CPU/GPU/Memory detection for `wails doctor`. Added by @leaanthony in #d51268b8d0680430f3a614775b13e6cd2b906d1c
|
||||
|
||||
### Changements
|
||||
|
||||
- AssetServer requests are now processed asynchronously without blocking the main thread on Windows. Changed by @stffabi in [PR](https://github.com/wailsapp/wails/pull/2926)
|
||||
- AssetServer requests are now processed concurrently by spawning a goroutine per request. Changed by @stffabi in [PR](https://github.com/wailsapp/wails/pull/2926)
|
||||
- Now building with `-devtools` flag doesn't enable the default context-menu. Changed by @mmghv in [PR](https://github.com/wailsapp/wails/pull/2923)
|
||||
- Change Window Level. Changed by @almas1992 in [PR](https://github.com/wailsapp/wails/pull/2944)
|
||||
#### Corrections
|
||||
|
||||
- Fixed typo on docs/reference/options page. Added by [@pylotlight](https://github.com/pylotlight) in [PR](https://github.com/wailsapp/wails/pull/2887)
|
||||
- Fixed issue with npm being called npm20 on openSUSE-Tumbleweed. Fixed by @TuffenDuffen in [PR] in (https://github.com/wailsapp/wails/pull/2941)
|
||||
|
||||
## v2.6.0 - 2023-09-06
|
||||
|
||||
### Modifications importantes
|
||||
@ -27,6 +49,7 @@ Le format est basé sur [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||
- Fixed `SetBackgroundColour` so it sets the window's background color to reduce resize flickering on Linux. Added by @lyimmi in [PR](https://github.com/wailsapp/wails/pull/2853)
|
||||
- Fixed disable window resize option and wrong initial window size when its enabled. Added by @lyimmi in [PR](https://github.com/wailsapp/wails/pull/2863)
|
||||
- Fixed build hook command parsing. Added by @smac89 in [PR](https://github.com/wailsapp/wails/pull/2836)
|
||||
- Fixed filesystem watcher from filtering top level project directory if binary name is included in .gitignore. Added by [@haukened](https://github.com/haukened) in [PR #2869](https://github.com/wailsapp/wails/pull/2869)
|
||||
- Fixed `-reloaddir` flag to watch additional directories (non-recursively). [@haukened](https://github.com/haukened) in [PR #2871](https://github.com/wailsapp/wails/pull/2871)
|
||||
- Fixed support for Go 1.21 `go.mod` files. Fixed by @stffabi in [PR](https://github.com/wailsapp/wails/pull/2876)
|
||||
|
||||
@ -44,6 +67,7 @@ Le format est basé sur [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||
- Added new community template wails-sveltekit-tailwind. Added by [@pylotlight](https://github.com/pylotlight) in [PR](https://github.com/wailsapp/wails/pull/2851)
|
||||
- Added support for print dialogs. Added by [@aangelisc](https://github.com/aangelisc) in [PR](https://github.com/wailsapp/wails/pull/2822)
|
||||
- Added new `wails dev -nogorebuild` flag to prevent restarts on back end file changes. [@haukened](https://github.com/haukened) in [PR #2870](https://github.com/wailsapp/wails/pull/2870)
|
||||
- Added a guide to describe a cross-platform build using GitHub Actions. Added by [@dennypenta](https://github.com/dennypenta) in [PR](https://github.com/wailsapp/wails/pull/2879)
|
||||
|
||||
### Changements
|
||||
|
||||
@ -680,9 +704,6 @@ Experimental: &options.Experimental{
|
||||
|
||||
- [v2, nsis] On dirait que / comme séparateur de chemin ne fonctionne que pour certaines directives de manière cross-platform par [@stffabi](https://github.com/stffabi) dans #1227
|
||||
- import des modèles sur la définition de bindings par [@adalessa](https://github.com/adalessa) dans #123
|
||||
|
||||
1
|
||||
|
||||
- Utilisation de la recherche locale sur le site web par [@leaanthony](https://github.com/leaanthony) en #1234
|
||||
- Ensure binary resources can be served by [@napalu](https://github.com/napalu) in #1240
|
||||
- Only retry loading assets when loading from disk by [@leaanthony](https://github.com/leaanthony) in #1241
|
||||
|
@ -47,7 +47,7 @@ sidebar_position: 1
|
||||
- [wails-svelte-template](https://github.com/raitonoberu/wails-svelte-template) - Svelteを使用したテンプレート
|
||||
- [wails-vite-svelte-template](https://github.com/BillBuilt/wails-vite-svelte-template) - SvelteおよびViteを使用したテンプレート
|
||||
- [wails-vite-svelte-tailwind-template](https://github.com/BillBuilt/wails-vite-svelte-tailwind-template) - TailwindCSS v3を含んだ、SvelteおよびViteを使用したテンプレート
|
||||
- [wails-svelte-tailwind-vite-template](https://github.com/PylotLight/wails-vite-svelte-tailwind-template/tree/master) - An updated template using Svelte v4.2.0 and Vite with TailwindCSS v3.3.3
|
||||
- [wails-svelte-tailwind-vite-template](https://github.com/PylotLight/wails-vite-svelte-tailwind-template/tree/master) - Svelte v4.2.0、Vite、TailwindCSS v3.3.3を使用したテンプレート
|
||||
- [wails-sveltekit-template](https://github.com/h8gi/wails-sveltekit-template) - SvelteKitを使用したテンプレート
|
||||
|
||||
## Solid
|
||||
@ -60,6 +60,10 @@ sidebar_position: 1
|
||||
- [wails-elm-template](https://github.com/benjamin-thomas/wails-elm-template) - 関数型プログラミングと**高速な**ホットリロードを使ったGUIアプリ開発 :tada: :rocket:
|
||||
- [wails-template-elm-tailwind](https://github.com/rnice01/wails-template-elm-tailwind) - Elm + Tailwind CSS + Wailsのパワー:muscle:を組み合わせたテンプレート (ホットリロードサポートあり)
|
||||
|
||||
## HTMX
|
||||
|
||||
- [wails-htmx-templ-chi-tailwind](https://github.com/PylotLight/wails-hmtx-templ-template) - インタラクティビティを実現するためのピュアなhtmxに、コンポーネントおよびフォームを作成するためのテンプレートが合わさったテンプレート
|
||||
|
||||
## ピュアJavaScript (バニラ)
|
||||
|
||||
- [wails-pure-js-template](https://github.com/KiddoV/wails-pure-js-template) - 基本的なJavaScript、HTML、CSSのみを含むテンプレート
|
||||
|
@ -0,0 +1,66 @@
|
||||
# Crossplatform build with Github Actions
|
||||
|
||||
To build a Wails project for all the available platforms, you need to create an application build for each operating system. One effective method to achieve this is by utilizing GitHub Actions.
|
||||
|
||||
An action that facilitates building a Wails app is available at:
|
||||
https://github.com/dAppServer/wails-build-action
|
||||
|
||||
In case the existing action doesn't fulfill your requirements, you can select only the necessary steps from the source:
|
||||
https://github.com/dAppServer/wails-build-action/blob/main/action.yml
|
||||
|
||||
Below is a comprehensive example that demonstrates building an app upon the creation of a new Git tag and subsequently uploading it to the Actions artifacts:
|
||||
|
||||
```yaml
|
||||
name: Wails build
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
# Match any new tag
|
||||
- '*'
|
||||
|
||||
env:
|
||||
# Necessary for most environments as build failure can occur due to OOM issues
|
||||
NODE_OPTIONS: "--max-old-space-size=4096"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
# Failure in one platform build won't impact the others
|
||||
fail-fast: false
|
||||
matrix:
|
||||
build:
|
||||
- name: 'App'
|
||||
platform: 'linux/amd64'
|
||||
os: 'ubuntu-latest'
|
||||
- name: 'App'
|
||||
platform: 'windows/amd64'
|
||||
os: 'windows-latest'
|
||||
- name: 'App'
|
||||
platform: 'darwin/universal'
|
||||
os: 'macos-latest'
|
||||
|
||||
runs-on: ${{ matrix.build.os }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Build wails
|
||||
uses: dAppServer/wails-build-action@v2.2
|
||||
id: build
|
||||
with:
|
||||
build-name: ${{ matrix.build.name }}
|
||||
build-platform: ${{ matrix.build.platform }}
|
||||
package: false
|
||||
go-version: '1.20'
|
||||
```
|
||||
|
||||
This example offers opportunities for various enhancements, including:
|
||||
|
||||
- Caching dependencies
|
||||
- Code signing
|
||||
- Uploading to platforms like S3, Supbase, etc.
|
||||
- Injecting secrets as environment variables
|
||||
- Utilizing environment variables as build variables (such as version variable extracted from the current Git tag)
|
@ -0,0 +1,199 @@
|
||||
# File Association
|
||||
|
||||
File association feature allows you to associate specific file types with your app so that when users open those files,
|
||||
your app is launched to handle them. This can be particularly useful for text editors, image viewers, or any application
|
||||
that works with specific file formats. In this guide, we'll walk through the steps to implement file association in Wails app.
|
||||
|
||||
## Set Up File Association:
|
||||
|
||||
To set up file association, you need to modify your application's wails.json file.
|
||||
In "info" section add a "fileAssociations" section specifying the file types your app should be associated with.
|
||||
|
||||
For example:
|
||||
|
||||
```json
|
||||
{
|
||||
"info": {
|
||||
"fileAssociations": [
|
||||
{
|
||||
"ext": "wails",
|
||||
"name": "Wails",
|
||||
"description": "Wails Application File",
|
||||
"iconName": "wailsFileIcon",
|
||||
"role": "Editor"
|
||||
},
|
||||
{
|
||||
"ext": "jpg",
|
||||
"name": "JPEG",
|
||||
"description": "Image File",
|
||||
"iconName": "jpegFileIcon",
|
||||
"role": "Editor"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
| Property | Description |
|
||||
| :---------- | :------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| ext | The extension (minus the leading period). e.g. png |
|
||||
| name | The name. e.g. PNG File |
|
||||
| iconName | The icon name without extension. Icons should be located in build folder. Proper icons will be generated from .png file for both macOS and Windows |
|
||||
| description | Windows-only. The description. It is displayed on the `Type` column on Windows Explorer. |
|
||||
| role | macOS-only. The app’s role with respect to the type. Corresponds to CFBundleTypeRole. |
|
||||
|
||||
## Platform Specifics:
|
||||
|
||||
### macOS
|
||||
|
||||
When you open file (or files) with your app, the system will launch your app and call the `OnFileOpen` function in your Wails app. Example:
|
||||
|
||||
```go title="main.go"
|
||||
func main() {
|
||||
// Create application with options
|
||||
err := wails.Run(&options.App{
|
||||
Title: "wails-open-file",
|
||||
Width: 1024,
|
||||
Height: 768,
|
||||
AssetServer: &assetserver.Options{
|
||||
Assets: assets,
|
||||
},
|
||||
BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1},
|
||||
Mac: &mac.Options{
|
||||
OnFileOpen: func(filePaths []string) { println(filestring) },
|
||||
},
|
||||
Bind: []interface{}{
|
||||
app,
|
||||
},
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
println("Error:", err.Error())
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Windows
|
||||
|
||||
On Windows file association is supported only with NSIS installer. During installation, the installer will create a
|
||||
registry entry for your file associations. When you open file with your app, new instance of app is launched and file path is passed
|
||||
as argument to your app. To handle this you should parse command line arguments in your app. Example:
|
||||
|
||||
```go title="main.go"
|
||||
func main() {
|
||||
argsWithoutProg := os.Args[1:]
|
||||
|
||||
if len(argsWithoutProg) != 0 {
|
||||
println("launchArgs", argsWithoutProg)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Linux
|
||||
|
||||
Currently, Wails doesn't support bundling for Linux. So, you need to create file associations manually.
|
||||
For example if you distribute your app as a .deb package, you can create file associations by adding required files in you bundle.
|
||||
You can use [nfpm](https://nfpm.goreleaser.com/) to create .deb package for your app.
|
||||
|
||||
1. Create a .desktop file for your app and specify file associations there. Example:
|
||||
|
||||
```ini
|
||||
[Desktop Entry]
|
||||
Categories=Office
|
||||
Exec=/usr/bin/wails-open-file %u
|
||||
Icon=wails-open-file.png
|
||||
Name=wails-open-file
|
||||
Terminal=false
|
||||
Type=Application
|
||||
MimeType=application/x-wails;application/x-test
|
||||
```
|
||||
|
||||
2. Create mime types file. Example:
|
||||
|
||||
```xml
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
|
||||
<mime-type type="application/x-wails">
|
||||
<comment>Wails Application File</comment>
|
||||
<glob pattern="*.wails"/>
|
||||
</mime-type>
|
||||
</mime-info>
|
||||
```
|
||||
|
||||
3. Create icons for your file types. SVG icons are recommended.
|
||||
4. Prepare postInstall/postRemove scripts for your package. Example:
|
||||
|
||||
```sh
|
||||
# reload mime types to register file associations
|
||||
update-mime-database /usr/share/mime
|
||||
# reload desktop database to load app in list of available
|
||||
update-desktop-database /usr/share/applications
|
||||
# update icons
|
||||
update-icon-caches /usr/share/icons/*
|
||||
```
|
||||
|
||||
5. Configure nfpm to use your scripts and files. Example:
|
||||
|
||||
```yaml
|
||||
name: "wails-open-file"
|
||||
arch: "arm64"
|
||||
platform: "linux"
|
||||
version: "1.0.0"
|
||||
section: "default"
|
||||
priority: "extra"
|
||||
maintainer: "FooBarCorp <FooBarCorp@gmail.com>"
|
||||
description: "Sample Package"
|
||||
vendor: "FooBarCorp"
|
||||
homepage: "http://example.com"
|
||||
license: "MIT"
|
||||
contents:
|
||||
- src: ../bin/wails-open-file
|
||||
dst: /usr/bin/wails-open-file
|
||||
- src: ./main.desktop
|
||||
dst: /usr/share/applications/wails-open-file.desktop
|
||||
- src: ./application-wails-mime.xml
|
||||
dst: /usr/share/mime/packages/application-x-wails.xml
|
||||
- src: ./application-test-mime.xml
|
||||
dst: /usr/share/mime/packages/application-x-test.xml
|
||||
- src: ../appicon.svg
|
||||
dst: /usr/share/icons/hicolor/scalable/apps/wails-open-file.svg
|
||||
- src: ../wailsFileIcon.svg
|
||||
dst: /usr/share/icons/hicolor/scalable/mimetypes/application-x-wails.svg
|
||||
- src: ../testFileIcon.svg
|
||||
dst: /usr/share/icons/hicolor/scalable/mimetypes/application-x-test.svg
|
||||
# copy icons to Yaru theme as well. For some reason Ubuntu didn't pick up fileicons from hicolor theme
|
||||
- src: ../appicon.svg
|
||||
dst: /usr/share/icons/Yaru/scalable/apps/wails-open-file.svg
|
||||
- src: ../wailsFileIcon.svg
|
||||
dst: /usr/share/icons/Yaru/scalable/mimetypes/application-x-wails.svg
|
||||
- src: ../testFileIcon.svg
|
||||
dst: /usr/share/icons/Yaru/scalable/mimetypes/application-x-test.svg
|
||||
scripts:
|
||||
postinstall: ./postInstall.sh
|
||||
postremove: ./postRemove.sh
|
||||
```
|
||||
|
||||
6. Build your .deb package using nfpm:
|
||||
|
||||
```sh
|
||||
nfpm pkg --packager deb --target .
|
||||
```
|
||||
|
||||
7. Now when your package is installed, your app will be associated with specified file types. When you open file with your app,
|
||||
new instance of app is launched and file path is passed as argument to your app.
|
||||
To handle this you should parse command line arguments in your app. Example:
|
||||
|
||||
```go title="main.go"
|
||||
func main() {
|
||||
argsWithoutProg := os.Args[1:]
|
||||
|
||||
if len(argsWithoutProg) != 0 {
|
||||
println("launchArgs", argsWithoutProg)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Limitations:
|
||||
|
||||
On Windows and Linux when associated file is opened, new instance of your app is launched.
|
||||
Currently, Wails doesn't support opening files in already running app. There is plugin for single instance support for v3 in development.
|
@ -159,6 +159,28 @@ XCodeコマンドラインツールの再インストールが引き続き失敗
|
||||
|
||||
出典: https://github.com/wailsapp/wails/issues/1806 および https://github.com/wailsapp/wails/issues/1140#issuecomment-1290446496
|
||||
|
||||
## My application won't compile on Mac
|
||||
|
||||
次のようなエラーが発生する場合:
|
||||
|
||||
```shell
|
||||
l1@m2 GoEasyDesigner % go build -tags dev -gcflags "all=-N -l"
|
||||
/Users/l1/sdk/go1.20.5/pkg/tool/darwin_arm64/link: running clang failed: exit status 1
|
||||
Undefined symbols for architecture arm64:
|
||||
"_OBJC_CLASS_$_UTType", referenced from:
|
||||
objc-class-ref in 000016.o
|
||||
ld: symbol(s) not found for architecture arm64
|
||||
clang: error: linker command failed with exit code 1 (use -v to see invocation)
|
||||
```
|
||||
Ensure you have the latest SDK installed. If so and you're still experiencing this issue, try the following:
|
||||
|
||||
```shell
|
||||
export CGO_LDFLAGS="-framework UniformTypeIdentifiers" && go build -tags dev -gcflags "all=-N -l"
|
||||
```
|
||||
|
||||
Sources: https://github.com/wailsapp/wails/pull/2925#issuecomment-1726828562
|
||||
|
||||
|
||||
--
|
||||
|
||||
## Cannot start service: Host version "x.x.x does not match binary version "x.x.x"
|
||||
@ -185,4 +207,162 @@ This is due to the default background of the webview being white. If you want to
|
||||
WebviewIsTransparent: true,
|
||||
},
|
||||
})
|
||||
```
|
||||
```
|
||||
|
||||
## I get a "Microsoft Edge can't read or write to its data directory" error when running my program as admin on Windows
|
||||
|
||||
You set your program to require admin permissions and it worked great! Unfortunately, some users are seeing a "Microsoft Edge can't read or write to its data directory" error when running it.
|
||||
|
||||
When a Windows machine has two local accounts:
|
||||
|
||||
- Alice, an admin
|
||||
- Bob, a regular user
|
||||
|
||||
Bob sees a UAC prompt when running your program. Bob enters Alice's admin credentials into this prompt. The app launches with admin permissions under Alice's account.
|
||||
|
||||
Wails instructs WebView2 to store user data at the specified `WebviewUserDataPath`. It defaults to `%APPDATA%\[BinaryName.exe]`.
|
||||
|
||||
Because the application is running under Alice's account, `%APPDATA%\[BinaryName.exe]` resolves to `C:\Users\Alice\AppData\Roaming\[BinaryName.exe]`.
|
||||
|
||||
WebView2 [creates some child processes under Bob's logged-in account instead of Alice's admin account](https://github.com/MicrosoftEdge/WebView2Feedback/issues/932#issue-807464179). Since Bob cannot access `C:\Users\Alice\AppData\Roaming\[BinaryName.exe]`, the "Microsoft Edge can't read or write to its data directory" error is shown.
|
||||
|
||||
Possible solution #1:
|
||||
|
||||
Refactor your application to work without constant admin permissions. If you just need to perform a small set of admin tasks (such as running an updater), you can run your application with the minimum permissions and then use the `runas` command to run these tasks with admin permissions as needed:
|
||||
|
||||
```go
|
||||
//go:build windows
|
||||
|
||||
package sample
|
||||
|
||||
import (
|
||||
"golang.org/x/sys/windows"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// Calling RunAs("C:\path\to\my\updater.exe") shows Bob a UAC prompt. Bob enters Alice's admin credentials. The updater launches with admin permissions under Alice's account.
|
||||
func RunAs(path string) error {
|
||||
verbPtr, _ := syscall.UTF16PtrFromString("runas")
|
||||
exePtr, _ := syscall.UTF16PtrFromString(path)
|
||||
cwdPtr, _ := syscall.UTF16PtrFromString("")
|
||||
argPtr, _ := syscall.UTF16PtrFromString("")
|
||||
|
||||
var showCmd int32 = 1 //SW_NORMAL
|
||||
|
||||
err := windows.ShellExecute(0, verbPtr, exePtr, argPtr, cwdPtr, showCmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
```
|
||||
|
||||
Possible solution #2:
|
||||
|
||||
Run your application with extended permissions. If you absolutely must run with constant admin permissions, WebView2 will function correctly if you use a data directory accessible by both users and you also launch your app with the `SeBackupPrivilege`, `SeDebugPrivilege`, and `SeRestorePrivilege` permissions. Here's an example:
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"os"
|
||||
"runtime"
|
||||
|
||||
"github.com/fourcorelabs/wintoken"
|
||||
"github.com/hectane/go-acl"
|
||||
"github.com/wailsapp/wails/v2"
|
||||
"github.com/wailsapp/wails/v2/pkg/options"
|
||||
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
|
||||
"github.com/wailsapp/wails/v2/pkg/options/windows"
|
||||
)
|
||||
|
||||
//go:embed all:frontend/dist
|
||||
var assets embed.FS
|
||||
|
||||
const (
|
||||
fixedTokenKey = "SAMPLE_RANDOM_KEY"
|
||||
fixedTokenVal = "with-fixed-token"
|
||||
webviewDir = "C:\\ProgramData\\Sample"
|
||||
)
|
||||
|
||||
func runWithFixedToken() {
|
||||
println("Re-launching self")
|
||||
token, err := wintoken.OpenProcessToken(0, wintoken.TokenPrimary) //pass 0 for own process
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer token.Close()
|
||||
|
||||
token.EnableTokenPrivileges([]string{
|
||||
"SeBackupPrivilege",
|
||||
"SeDebugPrivilege",
|
||||
"SeRestorePrivilege",
|
||||
})
|
||||
|
||||
cmd := exec.Command(os.Args[0])
|
||||
cmd.Args = os.Args
|
||||
cmd.Env = os.Environ()
|
||||
cmd.Env = append(cmd.Env, fmt.Sprintf("%v=%v", fixedTokenKey, fixedTokenVal))
|
||||
cmd.Stdin = os.Stdin
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{Token: syscall.Token(token.Token())}
|
||||
if err := cmd.Run(); err != nil {
|
||||
println("Error after launching self:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
println("Clean self launch :)")
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
func main() {
|
||||
if runtime.GOOS == "windows" && os.Getenv(fixedTokenKey) != fixedTokenVal {
|
||||
runWithFixedToken()
|
||||
}
|
||||
|
||||
println("Setting data dir to", webviewDir)
|
||||
if err := os.MkdirAll(webviewDir, os.ModePerm); err != nil {
|
||||
println("Failed creating dir:", err)
|
||||
}
|
||||
if err := acl.Chmod(webviewDir, 0777); err != nil {
|
||||
println("Failed setting ACL on dir:", err)
|
||||
}
|
||||
|
||||
app := NewApp()
|
||||
|
||||
err := wails.Run(&options.App{
|
||||
Title: "sample-data-dir",
|
||||
Width: 1024,
|
||||
Height: 768,
|
||||
AssetServer: &assetserver.Options{
|
||||
Assets: assets,
|
||||
},
|
||||
Bind: []interface{}{
|
||||
app,
|
||||
},
|
||||
Windows: &windows.Options{
|
||||
WebviewUserDataPath: webviewDir,
|
||||
},
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
println("Error:", err.Error())
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If you use a data directory accessible by both users but not the extended privileges, you will receive a WebView2 `80010108 The object invoked has disconnected from its clients` error.
|
||||
|
||||
Possible future solution #3: [run WebView2 using an in-memory mode if implemented](https://github.com/MicrosoftEdge/WebView2Feedback/issues/3637#issuecomment-1728300982).
|
||||
|
||||
## WebView2 installation succeeded, but the wails doctor command shows that it is not installed
|
||||
|
||||
If you have installed WebView2, but the `wails doctor` command shows that it is not installed, it is likely that the WebView2 runtime installed was for a different architecture. You can download the correct runtime from [here](https://developer.microsoft.com/en-us/microsoft-edge/webview2/).
|
||||
|
||||
Source: https://github.com/wailsapp/wails/issues/2917
|
||||
|
||||
## WebVie2wProcess failed with kind
|
||||
|
||||
If your Windows app generates this kind of error, you can check out what the error means [here](https://docs.microsoft.com/en-us/microsoft-edge/webview2/reference/winrt/microsoft_web_webview2_core/corewebview2processfailedkind?view=webview2-winrt-1.0.2045.28).
|
||||
|
||||
|
@ -49,35 +49,35 @@ WailsではGitHubでホストされているリモートテンプレートをサ
|
||||
|
||||
`wails build`は、プロジェクトを本番配布用のバイナリにコンパイルするときに使用します。
|
||||
|
||||
| フラグ | 説明 | デフォルト |
|
||||
|:-------------------- |:-------------------------------------------------------------------------------------------------------------------------------- |:--------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| -clean | `build/bin`ディレクトリをクリーンする | |
|
||||
| -compiler "compiler" | 違うGoコンパイラを使用する。例: go1.15beta1 | go |
|
||||
| -debug | アプリケーションのデバッグ情報を保持し、デバッグコンソールを表示する。 これにより、アプリケーションウィンドウで開発者ツールを使用することを許可できます。 | |
|
||||
| -devtools | 本番用のアプリケーションウィンドウにおいて開発者ツールの使用を許可する (-debugが使用されていないとき) | |
|
||||
| -dryrun | 実際には実行せずにbuildコマンドの結果を表示する | |
|
||||
| -f | アプリケーションを強制的にビルド | |
|
||||
| -garbleargs | garbleへ渡す引数 | `-literals -tiny -seed=random` |
|
||||
| -ldflags "flags" | コンパイラに渡す追加のldflags | |
|
||||
| -m | コンパイル前のmod tidyの実行をスキップする | |
|
||||
| -nopackage | アプリケーションをパッケージ化しない | |
|
||||
| -nocolour | 出力文字に色をつけない | |
|
||||
| -nosyncgomod | go.modとWailsのバージョンを同期させない | |
|
||||
| -nsis | Windows向けのNSISインストーラを生成する | |
|
||||
| -o filename | 出力ファイル名 | |
|
||||
| -obfuscated | [garble](https://github.com/burrowers/garble)を使用してアプリケーションを難読化する | |
|
||||
| -platform | 指定された[プラットフォーム](../reference/cli.mdx#platforms)(カンマ区切り) 向けにビルドする。例: `windows/arm64`。 アーキテクチャを指定しない場合は、`runtime.GOARCH`の値が使用されます。 | platform = `GOOS` environment variable if given else `runtime.GOOS`.<br/>arch = `GOARCH` envrionment variable if given else `runtime.GOARCH`. |
|
||||
| -race | Goのrace detectorを使用してビルドする | |
|
||||
| -s | フロントエンドのビルドをスキップ | |
|
||||
| -skipbindings | バインディングの生成をスキップする | |
|
||||
| -tags "extra tags" | Goコンパイラに渡すビルドタグ。 値は引用符で囲んでください。 また、スペースまたはカンマで区切ってください(両方は使用しないでください)。 | |
|
||||
| -trimpath | 実行可能ファイルから、すべてのファイルシステムパスを削除する | |
|
||||
| -u | プロジェクトの`go.mod`を更新し、CLIと同じバージョンのWailsを使用する | |
|
||||
| -upx | "upx"を使用して最終的にバイナリを圧縮する | |
|
||||
| -upxflags | upxに渡すフラグ | |
|
||||
| -v int | 詳細度レベル (0 - サイレント, 1 - デフォルト, 2 - 詳細) | 1 |
|
||||
| -webview2 | WebView2インストーラーのストラテジ: download,embed,browser,error | download |
|
||||
| -windowsconsole | Windiws向けビルドでコンソールウィンドウを維持する | |
|
||||
| フラグ | 説明 | デフォルト |
|
||||
|:-------------------- |:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |:--------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| -clean | `build/bin`ディレクトリをクリーンする | |
|
||||
| -compiler "compiler" | 違うGoコンパイラを使用する。例: go1.15beta1 | go |
|
||||
| -debug | アプリケーションのデバッグ情報を保持し、デバッグコンソールを表示する。 これにより、アプリケーションウィンドウで開発者ツールを使用することを許可できます。 | |
|
||||
| -devtools | Allows the use of the devtools in the application window in production (when -debug is not used). Ctrl/Cmd+Shift+F12 may be used to open the devtools window. *NOTE*: This option will make your application FAIL Mac appstore guidelines. Use for debugging only. | |
|
||||
| -dryrun | 実際には実行せずにbuildコマンドの結果を表示する | |
|
||||
| -f | アプリケーションを強制的にビルド | |
|
||||
| -garbleargs | garbleへ渡す引数 | `-literals -tiny -seed=random` |
|
||||
| -ldflags "flags" | コンパイラに渡す追加のldflags | |
|
||||
| -m | コンパイル前のmod tidyの実行をスキップする | |
|
||||
| -nopackage | アプリケーションをパッケージ化しない | |
|
||||
| -nocolour | 出力文字に色をつけない | |
|
||||
| -nosyncgomod | go.modとWailsのバージョンを同期させない | |
|
||||
| -nsis | Windows向けのNSISインストーラを生成する | |
|
||||
| -o filename | 出力ファイル名 | |
|
||||
| -obfuscated | [garble](https://github.com/burrowers/garble)を使用してアプリケーションを難読化する | |
|
||||
| -platform | 指定された[プラットフォーム](../reference/cli.mdx#platforms)(カンマ区切り) 向けにビルドする。例: `windows/arm64`。 アーキテクチャを指定しない場合は、`runtime.GOARCH`の値が使用されます。 | platform = `GOOS` environment variable if given else `runtime.GOOS`.<br/>arch = `GOARCH` envrionment variable if given else `runtime.GOARCH`. |
|
||||
| -race | Goのrace detectorを使用してビルドする | |
|
||||
| -s | フロントエンドのビルドをスキップ | |
|
||||
| -skipbindings | バインディングの生成をスキップする | |
|
||||
| -tags "extra tags" | Goコンパイラに渡すビルドタグ。 値は引用符で囲んでください。 また、スペースまたはカンマで区切ってください(両方は使用しないでください)。 | |
|
||||
| -trimpath | 実行可能ファイルから、すべてのファイルシステムパスを削除する | |
|
||||
| -u | プロジェクトの`go.mod`を更新し、CLIと同じバージョンのWailsを使用する | |
|
||||
| -upx | "upx"を使用して最終的にバイナリを圧縮する | |
|
||||
| -upxflags | upxに渡すフラグ | |
|
||||
| -v int | 詳細度レベル (0 - サイレント, 1 - デフォルト, 2 - 詳細) | 1 |
|
||||
| -webview2 | WebView2インストーラーのストラテジ: download,embed,browser,error | download |
|
||||
| -windowsconsole | Windiws向けビルドでコンソールウィンドウを維持する | |
|
||||
|
||||
`webview2`フラグの詳細については、[Windows](../guides/windows.mdx)ガイドをご覧ください。
|
||||
|
||||
@ -166,8 +166,8 @@ Your system is ready for Wails development!
|
||||
- `http://localhost:34115`でWebサーバが起動し、HTTP経由でアプリケーション(フロントエンドだけではありません)が提供されます。 これにより、任意のブラウザ拡張機能を使用することができます
|
||||
- すべてのアプリケーションアセットはディスクから読み込まれます。 アセットが変更された場合、アプリケーションは自動的に、リビルドではなくリロードされます。 接続されているすべてのブラウザもリロードされます
|
||||
- 以下のものを含むJSモジュールが生成されます:
|
||||
- GoメソッドのJavaScriptラッパー (コードヒントに有用なJSDocも自動付与されています)
|
||||
- Goの構造体のTypeScriptバージョン (構造体のインスタンスを生成したり、Goメソッドの引数として渡したりすることができます)
|
||||
- GoメソッドのJavaScriptラッパー (コードヒントに有用なJSDocも自動付与されています)
|
||||
- Goの構造体のTypeScriptバージョン (構造体のインスタンスを生成したり、Goメソッドの引数として渡したりすることができます)
|
||||
- 別のJSモジュールとして、ランタイムのラッパーおよびTS定義も生成されます
|
||||
- macOSの場合、アプリケーションは`.app`ファイルにバンドルされて実行されます。 これには、開発用の`build/darwin/Info.dev.plist`を使用します。
|
||||
|
||||
|
@ -366,7 +366,7 @@ func (b *App) beforeClose(ctx context.Context) (prevent bool) {
|
||||
|
||||
EnableDefaultContextMenuは、本番環境において、ブラウザのデフォルトコンテキストメニューを有効にします。
|
||||
|
||||
通常、ブラウザのデフォルトコンテキストメニューは、開発環境での動作時、または`-debug`・`-devtools`フラグをつけて開発者ツールを有効にして[ビルド](../reference/cli.mdx#build)したときのみ利用できますが、本オプションを使うと、`-devtools`フラグをつけない限り開発者ツールは使用できませんが、`本番`環境でもコンテキストメニューを有効にすることができます。
|
||||
By default, the browser's default context-menu is only available in development and in a `-debug` [build](../reference/cli.mdx#build) along with the devtools inspector, Using this option you can enable the default context-menu in `production` while the devtools inspector won't be available unless the `-devtools` build flag is used.
|
||||
|
||||
このオプションを有効にすると、デフォルトでは、テキストに関するコンテキスト(切り取り/コピー/貼り付け) のみがコンテキストメニューに表示されます。この動作をオーバーライドするには、`--default-contextmenu`というCSSプロパティを任意のHTML要素(`body`含む) で以下の値と共に使用してください:
|
||||
|
||||
@ -593,6 +593,12 @@ Windowsがローパワーモード(サスペンド/休止状態) から復帰し
|
||||
|
||||
名前: WebviewGpuIsDisabled<br/> データ型: `bool`
|
||||
|
||||
#### EnableSwipeGestures
|
||||
|
||||
Setting this to `true` will enable swipe gestures for the webview.
|
||||
|
||||
Name: EnableSwipeGestures<br/> Type: `bool`
|
||||
|
||||
### Mac
|
||||
|
||||
[Mac固有のオプション](#mac)を定義します。
|
||||
@ -688,6 +694,42 @@ Mac: &mac.Options{
|
||||
|
||||
名前: WindowIsTranslucent<br/> データ型: `bool`
|
||||
|
||||
#### Preferences
|
||||
|
||||
The Preferences struct provides the ability to configure the Webview preferences.
|
||||
|
||||
Name: Preferences<br/> Type: [`*mac.Preferences`](#preferences-struct)
|
||||
|
||||
##### Preferences struct
|
||||
|
||||
You can specify the webview preferences.
|
||||
|
||||
```go
|
||||
type Preferences struct {
|
||||
TabFocusesLinks u.Bool
|
||||
TextInteractionEnabled u.Bool
|
||||
FullscreenEnabled u.Bool
|
||||
}
|
||||
```
|
||||
|
||||
| 名前 | 説明 |
|
||||
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| TabFocusesLinks | A Boolean value that indicates whether pressing the tab key changes the focus to links and form controls. [Apple Docs](https://developer.apple.com/documentation/webkit/wkpreferences/2818595-tabfocuseslinks?language=objc) |
|
||||
| TextInteractionEnabled | A Boolean value that indicates whether to allow people to select or otherwise interact with text. [Apple Docs](https://developer.apple.com/documentation/webkit/wkpreferences/3727362-textinteractionenabled?language=objc) |
|
||||
| FullscreenEnabled | A Boolean value that indicates whether a web view can display content full screen. [Apple Docs](https://developer.apple.com/documentation/webkit/wkpreferences/3917769-elementfullscreenenabled?language=objc) |
|
||||
|
||||
例:
|
||||
|
||||
```go
|
||||
Mac: &mac.Options{
|
||||
Preferences: &mac.Preferences{
|
||||
TabFocusesLinks: mac.Enabled,
|
||||
TextInteractionEnabled: mac.Disabled,
|
||||
FullscreenEnabled: mac.Enabled,
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### About
|
||||
|
||||
"AppMenu"ロールで作成されたアプリケーションメニューの中にある"About"メニュー項目において、タイトル、メッセージ、アイコンを設定できます。
|
||||
|
@ -202,7 +202,7 @@ Go: `WindowSetBackgroundColour(ctx context.Context, R, G, B, A uint8)`<br/> JS:
|
||||
|
||||
### WindowPrint
|
||||
|
||||
Opens tha native print dialog.
|
||||
ネイティブな印刷ダイアログを開きます。
|
||||
|
||||
Go: `WindowPrint(ctx context.Context)`<br/> JS: `WindowPrint()`
|
||||
|
||||
|
@ -4,35 +4,35 @@
|
||||
"description": "The label for version v2.6.0"
|
||||
},
|
||||
"sidebar.docs.category.Getting Started": {
|
||||
"message": "Getting Started",
|
||||
"message": "はじめよう",
|
||||
"description": "The label for category Getting Started in sidebar docs"
|
||||
},
|
||||
"sidebar.docs.category.Reference": {
|
||||
"message": "Reference",
|
||||
"message": "リファレンス",
|
||||
"description": "The label for category Reference in sidebar docs"
|
||||
},
|
||||
"sidebar.docs.category.Runtime": {
|
||||
"message": "Runtime",
|
||||
"message": "ランタイム",
|
||||
"description": "The label for category Runtime in sidebar docs"
|
||||
},
|
||||
"sidebar.docs.category.Community": {
|
||||
"message": "Community",
|
||||
"message": "コミュニティ",
|
||||
"description": "The label for category Community in sidebar docs"
|
||||
},
|
||||
"sidebar.docs.category.Showcase": {
|
||||
"message": "Showcase",
|
||||
"message": "事例紹介",
|
||||
"description": "The label for category Showcase in sidebar docs"
|
||||
},
|
||||
"sidebar.docs.category.Guides": {
|
||||
"message": "Guides",
|
||||
"message": "ガイド",
|
||||
"description": "The label for category Guides in sidebar docs"
|
||||
},
|
||||
"sidebar.docs.category.Tutorials": {
|
||||
"message": "Tutorials",
|
||||
"message": "チュートリアル",
|
||||
"description": "The label for category Tutorials in sidebar docs"
|
||||
},
|
||||
"sidebar.docs.link.Contributing": {
|
||||
"message": "Contributing",
|
||||
"message": "コントリビューション",
|
||||
"description": "The label for link Contributing in sidebar docs, linking to /community-guide#ways-of-contributing"
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,28 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
- Added support for enabling/disabling swipe gestures for Windows WebView2. Added by @leaanthony in [PR](https://github.com/wailsapp/wails/pull/2878)
|
||||
- When building with `-devtools` flag, CMD/CTRL+SHIFT+F12 can be used to open the devtools. Added by @leaanthony in [PR](https://github.com/wailsapp/wails/pull/2915) – Added file association support for macOS and Windows. Added by @APshenkin in [PR](https://github.com/wailsapp/wails/pull/2918)
|
||||
- Added support for setting some of the Webview preferences, `textInteractionEnabled` and `tabFocusesLinks` on Mac. Added by @fkhadra in [PR](https://github.com/wailsapp/wails/pull/2937)
|
||||
- Added support for enabling/disabling fullscreen of the Webview on Mac. Added by @fkhadra in [PR](https://github.com/wailsapp/wails/pull/2953)
|
||||
- Added French README.fr.md page. Added by @nejos97 in [PR](https://github.com/wailsapp/wails/pull/2943)
|
||||
- New task created for linting v2 `task v2:lint`. Workflow updated to run the task. Added by @mikeee in [PR](https://github.com/wailsapp/wails/pull/2957)
|
||||
- Added new community template wails-htmx-templ-chi-tailwind. Added by [@pylotlight](https://github.com/pylotlight) in [PR](https://github.com/wailsapp/wails/pull/2984)
|
||||
- Added CPU/GPU/Memory detection for `wails doctor`. Added by @leaanthony in #d51268b8d0680430f3a614775b13e6cd2b906d1c
|
||||
|
||||
### Changed
|
||||
|
||||
- AssetServer requests are now processed asynchronously without blocking the main thread on Windows. Changed by @stffabi in [PR](https://github.com/wailsapp/wails/pull/2926)
|
||||
- AssetServer requests are now processed concurrently by spawning a goroutine per request. Changed by @stffabi in [PR](https://github.com/wailsapp/wails/pull/2926)
|
||||
- Now building with `-devtools` flag doesn't enable the default context-menu. Changed by @mmghv in [PR](https://github.com/wailsapp/wails/pull/2923)
|
||||
- Change Window Level. Changed by @almas1992 in [PR](https://github.com/wailsapp/wails/pull/2944)
|
||||
#### Fixed
|
||||
|
||||
- Fixed typo on docs/reference/options page. Added by [@pylotlight](https://github.com/pylotlight) in [PR](https://github.com/wailsapp/wails/pull/2887)
|
||||
- Fixed issue with npm being called npm20 on openSUSE-Tumbleweed. Fixed by @TuffenDuffen in [PR] in (https://github.com/wailsapp/wails/pull/2941)
|
||||
|
||||
## v2.6.0 - 2023-09-06
|
||||
|
||||
### Breaking Changes
|
||||
@ -27,6 +49,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
- Fixed `SetBackgroundColour` so it sets the window's background color to reduce resize flickering on Linux. Added by @lyimmi in [PR](https://github.com/wailsapp/wails/pull/2853)
|
||||
- Fixed disable window resize option and wrong initial window size when its enabled. Added by @lyimmi in [PR](https://github.com/wailsapp/wails/pull/2863)
|
||||
- Fixed build hook command parsing. Added by @smac89 in [PR](https://github.com/wailsapp/wails/pull/2836)
|
||||
- Fixed filesystem watcher from filtering top level project directory if binary name is included in .gitignore. Added by [@haukened](https://github.com/haukened) in [PR #2869](https://github.com/wailsapp/wails/pull/2869)
|
||||
- Fixed `-reloaddir` flag to watch additional directories (non-recursively). [@haukened](https://github.com/haukened) in [PR #2871](https://github.com/wailsapp/wails/pull/2871)
|
||||
- Fixed support for Go 1.21 `go.mod` files. Fixed by @stffabi in [PR](https://github.com/wailsapp/wails/pull/2876)
|
||||
|
||||
@ -44,6 +67,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
- Added new community template wails-sveltekit-tailwind. Added by [@pylotlight](https://github.com/pylotlight) in [PR](https://github.com/wailsapp/wails/pull/2851)
|
||||
- Added support for print dialogs. Added by [@aangelisc](https://github.com/aangelisc) in [PR](https://github.com/wailsapp/wails/pull/2822)
|
||||
- Added new `wails dev -nogorebuild` flag to prevent restarts on back end file changes. [@haukened](https://github.com/haukened) in [PR #2870](https://github.com/wailsapp/wails/pull/2870)
|
||||
- Added a guide to describe a cross-platform build using GitHub Actions. Added by [@dennypenta](https://github.com/dennypenta) in [PR](https://github.com/wailsapp/wails/pull/2879)
|
||||
|
||||
### Changed
|
||||
|
||||
@ -680,9 +704,6 @@ Experimental: &options.Experimental{
|
||||
|
||||
- [v2, nsis] Seems like / as path separator works only for some directives in a cross platform way by [@stffabi](https://github.com/stffabi) in #1227
|
||||
- import models on binding definition by [@adalessa](https://github.com/adalessa) in #123
|
||||
|
||||
1
|
||||
|
||||
- Use local search on website by [@leaanthony](https://github.com/leaanthony) in #1234
|
||||
- Ensure binary resources can be served by [@napalu](https://github.com/napalu) in #1240
|
||||
- Only retry loading assets when loading from disk by [@leaanthony](https://github.com/leaanthony) in #1241
|
||||
|
@ -60,6 +60,10 @@ If you are unsure about a template, inspect `package.json` and `wails.json` for
|
||||
- [wails-elm-template](https://github.com/benjamin-thomas/wails-elm-template) - Develop your GUI app with functional programming and a **snappy** hot-reload setup :tada: :rocket:
|
||||
- [wails-template-elm-tailwind](https://github.com/rnice01/wails-template-elm-tailwind) - Combine the powers :muscle: of Elm + Tailwind CSS + Wails! Hot reloading supported.
|
||||
|
||||
## HTMX
|
||||
|
||||
- [wails-htmx-templ-chi-tailwind](https://github.com/PylotLight/wails-hmtx-templ-template) - Use a unique combination of pure htmx for interactivity plus templ for creating components and forms
|
||||
|
||||
## Pure JavaScript (Vanilla)
|
||||
|
||||
- [wails-pure-js-template](https://github.com/KiddoV/wails-pure-js-template) - A template with nothing but just basic JavaScript, HTML, and CSS
|
||||
|
@ -0,0 +1,66 @@
|
||||
# Crossplatform build with Github Actions
|
||||
|
||||
To build a Wails project for all the available platforms, you need to create an application build for each operating system. One effective method to achieve this is by utilizing GitHub Actions.
|
||||
|
||||
An action that facilitates building a Wails app is available at:
|
||||
https://github.com/dAppServer/wails-build-action
|
||||
|
||||
In case the existing action doesn't fulfill your requirements, you can select only the necessary steps from the source:
|
||||
https://github.com/dAppServer/wails-build-action/blob/main/action.yml
|
||||
|
||||
Below is a comprehensive example that demonstrates building an app upon the creation of a new Git tag and subsequently uploading it to the Actions artifacts:
|
||||
|
||||
```yaml
|
||||
name: Wails build
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
# Match any new tag
|
||||
- '*'
|
||||
|
||||
env:
|
||||
# Necessary for most environments as build failure can occur due to OOM issues
|
||||
NODE_OPTIONS: "--max-old-space-size=4096"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
# Failure in one platform build won't impact the others
|
||||
fail-fast: false
|
||||
matrix:
|
||||
build:
|
||||
- name: 'App'
|
||||
platform: 'linux/amd64'
|
||||
os: 'ubuntu-latest'
|
||||
- name: 'App'
|
||||
platform: 'windows/amd64'
|
||||
os: 'windows-latest'
|
||||
- name: 'App'
|
||||
platform: 'darwin/universal'
|
||||
os: 'macos-latest'
|
||||
|
||||
runs-on: ${{ matrix.build.os }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Build wails
|
||||
uses: dAppServer/wails-build-action@v2.2
|
||||
id: build
|
||||
with:
|
||||
build-name: ${{ matrix.build.name }}
|
||||
build-platform: ${{ matrix.build.platform }}
|
||||
package: false
|
||||
go-version: '1.20'
|
||||
```
|
||||
|
||||
This example offers opportunities for various enhancements, including:
|
||||
|
||||
- Caching dependencies
|
||||
- Code signing
|
||||
- Uploading to platforms like S3, Supbase, etc.
|
||||
- Injecting secrets as environment variables
|
||||
- Utilizing environment variables as build variables (such as version variable extracted from the current Git tag)
|
@ -0,0 +1,199 @@
|
||||
# File Association
|
||||
|
||||
File association feature allows you to associate specific file types with your app so that when users open those files,
|
||||
your app is launched to handle them. This can be particularly useful for text editors, image viewers, or any application
|
||||
that works with specific file formats. In this guide, we'll walk through the steps to implement file association in Wails app.
|
||||
|
||||
## Set Up File Association:
|
||||
|
||||
To set up file association, you need to modify your application's wails.json file.
|
||||
In "info" section add a "fileAssociations" section specifying the file types your app should be associated with.
|
||||
|
||||
For example:
|
||||
|
||||
```json
|
||||
{
|
||||
"info": {
|
||||
"fileAssociations": [
|
||||
{
|
||||
"ext": "wails",
|
||||
"name": "Wails",
|
||||
"description": "Wails Application File",
|
||||
"iconName": "wailsFileIcon",
|
||||
"role": "Editor"
|
||||
},
|
||||
{
|
||||
"ext": "jpg",
|
||||
"name": "JPEG",
|
||||
"description": "Image File",
|
||||
"iconName": "jpegFileIcon",
|
||||
"role": "Editor"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
| Property | Description |
|
||||
| :---------- | :------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| ext | The extension (minus the leading period). e.g. png |
|
||||
| name | The name. e.g. PNG File |
|
||||
| iconName | The icon name without extension. Icons should be located in build folder. Proper icons will be generated from .png file for both macOS and Windows |
|
||||
| description | Windows-only. The description. It is displayed on the `Type` column on Windows Explorer. |
|
||||
| role | macOS-only. The app’s role with respect to the type. Corresponds to CFBundleTypeRole. |
|
||||
|
||||
## Platform Specifics:
|
||||
|
||||
### macOS
|
||||
|
||||
When you open file (or files) with your app, the system will launch your app and call the `OnFileOpen` function in your Wails app. Example:
|
||||
|
||||
```go title="main.go"
|
||||
func main() {
|
||||
// Create application with options
|
||||
err := wails.Run(&options.App{
|
||||
Title: "wails-open-file",
|
||||
Width: 1024,
|
||||
Height: 768,
|
||||
AssetServer: &assetserver.Options{
|
||||
Assets: assets,
|
||||
},
|
||||
BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1},
|
||||
Mac: &mac.Options{
|
||||
OnFileOpen: func(filePaths []string) { println(filestring) },
|
||||
},
|
||||
Bind: []interface{}{
|
||||
app,
|
||||
},
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
println("Error:", err.Error())
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Windows
|
||||
|
||||
On Windows file association is supported only with NSIS installer. During installation, the installer will create a
|
||||
registry entry for your file associations. When you open file with your app, new instance of app is launched and file path is passed
|
||||
as argument to your app. To handle this you should parse command line arguments in your app. Example:
|
||||
|
||||
```go title="main.go"
|
||||
func main() {
|
||||
argsWithoutProg := os.Args[1:]
|
||||
|
||||
if len(argsWithoutProg) != 0 {
|
||||
println("launchArgs", argsWithoutProg)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Linux
|
||||
|
||||
Currently, Wails doesn't support bundling for Linux. So, you need to create file associations manually.
|
||||
For example if you distribute your app as a .deb package, you can create file associations by adding required files in you bundle.
|
||||
You can use [nfpm](https://nfpm.goreleaser.com/) to create .deb package for your app.
|
||||
|
||||
1. Create a .desktop file for your app and specify file associations there. Example:
|
||||
|
||||
```ini
|
||||
[Desktop Entry]
|
||||
Categories=Office
|
||||
Exec=/usr/bin/wails-open-file %u
|
||||
Icon=wails-open-file.png
|
||||
Name=wails-open-file
|
||||
Terminal=false
|
||||
Type=Application
|
||||
MimeType=application/x-wails;application/x-test
|
||||
```
|
||||
|
||||
2. Create mime types file. Example:
|
||||
|
||||
```xml
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
|
||||
<mime-type type="application/x-wails">
|
||||
<comment>Wails Application File</comment>
|
||||
<glob pattern="*.wails"/>
|
||||
</mime-type>
|
||||
</mime-info>
|
||||
```
|
||||
|
||||
3. Create icons for your file types. SVG icons are recommended.
|
||||
4. Prepare postInstall/postRemove scripts for your package. Example:
|
||||
|
||||
```sh
|
||||
# reload mime types to register file associations
|
||||
update-mime-database /usr/share/mime
|
||||
# reload desktop database to load app in list of available
|
||||
update-desktop-database /usr/share/applications
|
||||
# update icons
|
||||
update-icon-caches /usr/share/icons/*
|
||||
```
|
||||
|
||||
5. Configure nfpm to use your scripts and files. Example:
|
||||
|
||||
```yaml
|
||||
name: "wails-open-file"
|
||||
arch: "arm64"
|
||||
platform: "linux"
|
||||
version: "1.0.0"
|
||||
section: "default"
|
||||
priority: "extra"
|
||||
maintainer: "FooBarCorp <FooBarCorp@gmail.com>"
|
||||
description: "Sample Package"
|
||||
vendor: "FooBarCorp"
|
||||
homepage: "http://example.com"
|
||||
license: "MIT"
|
||||
contents:
|
||||
- src: ../bin/wails-open-file
|
||||
dst: /usr/bin/wails-open-file
|
||||
- src: ./main.desktop
|
||||
dst: /usr/share/applications/wails-open-file.desktop
|
||||
- src: ./application-wails-mime.xml
|
||||
dst: /usr/share/mime/packages/application-x-wails.xml
|
||||
- src: ./application-test-mime.xml
|
||||
dst: /usr/share/mime/packages/application-x-test.xml
|
||||
- src: ../appicon.svg
|
||||
dst: /usr/share/icons/hicolor/scalable/apps/wails-open-file.svg
|
||||
- src: ../wailsFileIcon.svg
|
||||
dst: /usr/share/icons/hicolor/scalable/mimetypes/application-x-wails.svg
|
||||
- src: ../testFileIcon.svg
|
||||
dst: /usr/share/icons/hicolor/scalable/mimetypes/application-x-test.svg
|
||||
# copy icons to Yaru theme as well. For some reason Ubuntu didn't pick up fileicons from hicolor theme
|
||||
- src: ../appicon.svg
|
||||
dst: /usr/share/icons/Yaru/scalable/apps/wails-open-file.svg
|
||||
- src: ../wailsFileIcon.svg
|
||||
dst: /usr/share/icons/Yaru/scalable/mimetypes/application-x-wails.svg
|
||||
- src: ../testFileIcon.svg
|
||||
dst: /usr/share/icons/Yaru/scalable/mimetypes/application-x-test.svg
|
||||
scripts:
|
||||
postinstall: ./postInstall.sh
|
||||
postremove: ./postRemove.sh
|
||||
```
|
||||
|
||||
6. Build your .deb package using nfpm:
|
||||
|
||||
```sh
|
||||
nfpm pkg --packager deb --target .
|
||||
```
|
||||
|
||||
7. Now when your package is installed, your app will be associated with specified file types. When you open file with your app,
|
||||
new instance of app is launched and file path is passed as argument to your app.
|
||||
To handle this you should parse command line arguments in your app. Example:
|
||||
|
||||
```go title="main.go"
|
||||
func main() {
|
||||
argsWithoutProg := os.Args[1:]
|
||||
|
||||
if len(argsWithoutProg) != 0 {
|
||||
println("launchArgs", argsWithoutProg)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Limitations:
|
||||
|
||||
On Windows and Linux when associated file is opened, new instance of your app is launched.
|
||||
Currently, Wails doesn't support opening files in already running app. There is plugin for single instance support for v3 in development.
|
@ -159,6 +159,28 @@ If `/Applications/Xcode.app/Contents/Developer` is displayed, run `sudo xcode-se
|
||||
|
||||
Sources: https://github.com/wailsapp/wails/issues/1806 and https://github.com/wailsapp/wails/issues/1140#issuecomment-1290446496
|
||||
|
||||
## My application won't compile on Mac
|
||||
|
||||
If you are getting errors like this:
|
||||
|
||||
```shell
|
||||
l1@m2 GoEasyDesigner % go build -tags dev -gcflags "all=-N -l"
|
||||
/Users/l1/sdk/go1.20.5/pkg/tool/darwin_arm64/link: running clang failed: exit status 1
|
||||
Undefined symbols for architecture arm64:
|
||||
"_OBJC_CLASS_$_UTType", referenced from:
|
||||
objc-class-ref in 000016.o
|
||||
ld: symbol(s) not found for architecture arm64
|
||||
clang: error: linker command failed with exit code 1 (use -v to see invocation)
|
||||
```
|
||||
Ensure you have the latest SDK installed. If so and you're still experiencing this issue, try the following:
|
||||
|
||||
```shell
|
||||
export CGO_LDFLAGS="-framework UniformTypeIdentifiers" && go build -tags dev -gcflags "all=-N -l"
|
||||
```
|
||||
|
||||
Sources: https://github.com/wailsapp/wails/pull/2925#issuecomment-1726828562
|
||||
|
||||
|
||||
--
|
||||
|
||||
## Cannot start service: Host version "x.x.x does not match binary version "x.x.x"
|
||||
@ -185,4 +207,162 @@ This is due to the default background of the webview being white. If you want to
|
||||
WebviewIsTransparent: true,
|
||||
},
|
||||
})
|
||||
```
|
||||
```
|
||||
|
||||
## I get a "Microsoft Edge can't read or write to its data directory" error when running my program as admin on Windows
|
||||
|
||||
You set your program to require admin permissions and it worked great! Unfortunately, some users are seeing a "Microsoft Edge can't read or write to its data directory" error when running it.
|
||||
|
||||
When a Windows machine has two local accounts:
|
||||
|
||||
- Alice, an admin
|
||||
- Bob, a regular user
|
||||
|
||||
Bob sees a UAC prompt when running your program. Bob enters Alice's admin credentials into this prompt. The app launches with admin permissions under Alice's account.
|
||||
|
||||
Wails instructs WebView2 to store user data at the specified `WebviewUserDataPath`. It defaults to `%APPDATA%\[BinaryName.exe]`.
|
||||
|
||||
Because the application is running under Alice's account, `%APPDATA%\[BinaryName.exe]` resolves to `C:\Users\Alice\AppData\Roaming\[BinaryName.exe]`.
|
||||
|
||||
WebView2 [creates some child processes under Bob's logged-in account instead of Alice's admin account](https://github.com/MicrosoftEdge/WebView2Feedback/issues/932#issue-807464179). Since Bob cannot access `C:\Users\Alice\AppData\Roaming\[BinaryName.exe]`, the "Microsoft Edge can't read or write to its data directory" error is shown.
|
||||
|
||||
Possible solution #1:
|
||||
|
||||
Refactor your application to work without constant admin permissions. If you just need to perform a small set of admin tasks (such as running an updater), you can run your application with the minimum permissions and then use the `runas` command to run these tasks with admin permissions as needed:
|
||||
|
||||
```go
|
||||
//go:build windows
|
||||
|
||||
package sample
|
||||
|
||||
import (
|
||||
"golang.org/x/sys/windows"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// Calling RunAs("C:\path\to\my\updater.exe") shows Bob a UAC prompt. Bob enters Alice's admin credentials. The updater launches with admin permissions under Alice's account.
|
||||
func RunAs(path string) error {
|
||||
verbPtr, _ := syscall.UTF16PtrFromString("runas")
|
||||
exePtr, _ := syscall.UTF16PtrFromString(path)
|
||||
cwdPtr, _ := syscall.UTF16PtrFromString("")
|
||||
argPtr, _ := syscall.UTF16PtrFromString("")
|
||||
|
||||
var showCmd int32 = 1 //SW_NORMAL
|
||||
|
||||
err := windows.ShellExecute(0, verbPtr, exePtr, argPtr, cwdPtr, showCmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
```
|
||||
|
||||
Possible solution #2:
|
||||
|
||||
Run your application with extended permissions. If you absolutely must run with constant admin permissions, WebView2 will function correctly if you use a data directory accessible by both users and you also launch your app with the `SeBackupPrivilege`, `SeDebugPrivilege`, and `SeRestorePrivilege` permissions. Here's an example:
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"os"
|
||||
"runtime"
|
||||
|
||||
"github.com/fourcorelabs/wintoken"
|
||||
"github.com/hectane/go-acl"
|
||||
"github.com/wailsapp/wails/v2"
|
||||
"github.com/wailsapp/wails/v2/pkg/options"
|
||||
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
|
||||
"github.com/wailsapp/wails/v2/pkg/options/windows"
|
||||
)
|
||||
|
||||
//go:embed all:frontend/dist
|
||||
var assets embed.FS
|
||||
|
||||
const (
|
||||
fixedTokenKey = "SAMPLE_RANDOM_KEY"
|
||||
fixedTokenVal = "with-fixed-token"
|
||||
webviewDir = "C:\\ProgramData\\Sample"
|
||||
)
|
||||
|
||||
func runWithFixedToken() {
|
||||
println("Re-launching self")
|
||||
token, err := wintoken.OpenProcessToken(0, wintoken.TokenPrimary) //pass 0 for own process
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer token.Close()
|
||||
|
||||
token.EnableTokenPrivileges([]string{
|
||||
"SeBackupPrivilege",
|
||||
"SeDebugPrivilege",
|
||||
"SeRestorePrivilege",
|
||||
})
|
||||
|
||||
cmd := exec.Command(os.Args[0])
|
||||
cmd.Args = os.Args
|
||||
cmd.Env = os.Environ()
|
||||
cmd.Env = append(cmd.Env, fmt.Sprintf("%v=%v", fixedTokenKey, fixedTokenVal))
|
||||
cmd.Stdin = os.Stdin
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{Token: syscall.Token(token.Token())}
|
||||
if err := cmd.Run(); err != nil {
|
||||
println("Error after launching self:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
println("Clean self launch :)")
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
func main() {
|
||||
if runtime.GOOS == "windows" && os.Getenv(fixedTokenKey) != fixedTokenVal {
|
||||
runWithFixedToken()
|
||||
}
|
||||
|
||||
println("Setting data dir to", webviewDir)
|
||||
if err := os.MkdirAll(webviewDir, os.ModePerm); err != nil {
|
||||
println("Failed creating dir:", err)
|
||||
}
|
||||
if err := acl.Chmod(webviewDir, 0777); err != nil {
|
||||
println("Failed setting ACL on dir:", err)
|
||||
}
|
||||
|
||||
app := NewApp()
|
||||
|
||||
err := wails.Run(&options.App{
|
||||
Title: "sample-data-dir",
|
||||
Width: 1024,
|
||||
Height: 768,
|
||||
AssetServer: &assetserver.Options{
|
||||
Assets: assets,
|
||||
},
|
||||
Bind: []interface{}{
|
||||
app,
|
||||
},
|
||||
Windows: &windows.Options{
|
||||
WebviewUserDataPath: webviewDir,
|
||||
},
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
println("Error:", err.Error())
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If you use a data directory accessible by both users but not the extended privileges, you will receive a WebView2 `80010108 The object invoked has disconnected from its clients` error.
|
||||
|
||||
Possible future solution #3: [run WebView2 using an in-memory mode if implemented](https://github.com/MicrosoftEdge/WebView2Feedback/issues/3637#issuecomment-1728300982).
|
||||
|
||||
## WebView2 installation succeeded, but the wails doctor command shows that it is not installed
|
||||
|
||||
If you have installed WebView2, but the `wails doctor` command shows that it is not installed, it is likely that the WebView2 runtime installed was for a different architecture. You can download the correct runtime from [here](https://developer.microsoft.com/en-us/microsoft-edge/webview2/).
|
||||
|
||||
Source: https://github.com/wailsapp/wails/issues/2917
|
||||
|
||||
## WebVie2wProcess failed with kind
|
||||
|
||||
If your Windows app generates this kind of error, you can check out what the error means [here](https://docs.microsoft.com/en-us/microsoft-edge/webview2/reference/winrt/microsoft_web_webview2_core/corewebview2processfailedkind?view=webview2-winrt-1.0.2045.28).
|
||||
|
||||
|
@ -49,35 +49,35 @@ If you are unsure about a template, inspect `package.json` and `wails.json` for
|
||||
|
||||
`wails build` is used for compiling your project to a production-ready binary.
|
||||
|
||||
| Flag | Description | Default |
|
||||
|:-------------------- |:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |:--------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| -clean | Cleans the `build/bin` directory | |
|
||||
| -compiler "compiler" | Use a different go compiler to build, eg go1.15beta1 | go |
|
||||
| -debug | Retains debug information in the application and shows the debug console. Allows the use of the devtools in the application window | |
|
||||
| -devtools | Allows the use of the devtools in the application window in production (when -debug is not used) | |
|
||||
| -dryrun | Prints the build command without executing it | |
|
||||
| -f | Force build application | |
|
||||
| -garbleargs | Arguments to pass to garble | `-literals -tiny -seed=random` |
|
||||
| -ldflags "flags" | Additional ldflags to pass to the compiler | |
|
||||
| -m | Skip mod tidy before compile | |
|
||||
| -nopackage | Do not package application | |
|
||||
| -nocolour | Disable colour in output | |
|
||||
| -nosyncgomod | Do not sync go.mod with the Wails version | |
|
||||
| -nsis | Generate NSIS installer for Windows | |
|
||||
| -o filename | Output filename | |
|
||||
| -obfuscated | Obfuscate the application using [garble](https://github.com/burrowers/garble) | |
|
||||
| -platform | Build for the given (comma delimited) [platforms](../reference/cli.mdx#platforms) eg. `windows/arm64`. Note, if you do not give the architecture, `runtime.GOARCH` is used. | platform = `GOOS` environment variable if given else `runtime.GOOS`.<br/>arch = `GOARCH` envrionment variable if given else `runtime.GOARCH`. |
|
||||
| -race | Build with Go's race detector | |
|
||||
| -s | Skip building the frontend | |
|
||||
| -skipbindings | Skip bindings generation | |
|
||||
| -tags "extra tags" | Build tags to pass to Go compiler. Must be quoted. Space or comma (but not both) separated | |
|
||||
| -trimpath | Remove all file system paths from the resulting executable. | |
|
||||
| -u | Updates your project's `go.mod` to use the same version of Wails as the CLI | |
|
||||
| -upx | Compress final binary using "upx" | |
|
||||
| -upxflags | Flags to pass to upx | |
|
||||
| -v int | Verbosity level (0 - silent, 1 - default, 2 - verbose) | 1 |
|
||||
| -webview2 | WebView2 installer strategy: download,embed,browser,error | download |
|
||||
| -windowsconsole | Keep the console window for Windows builds | |
|
||||
| Flag | Description | Default |
|
||||
|:-------------------- |:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |:--------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| -clean | Cleans the `build/bin` directory | |
|
||||
| -compiler "compiler" | Use a different go compiler to build, eg go1.15beta1 | go |
|
||||
| -debug | Retains debug information in the application and shows the debug console. Allows the use of the devtools in the application window | |
|
||||
| -devtools | Allows the use of the devtools in the application window in production (when -debug is not used). Ctrl/Cmd+Shift+F12 may be used to open the devtools window. *NOTE*: This option will make your application FAIL Mac appstore guidelines. Use for debugging only. | |
|
||||
| -dryrun | Prints the build command without executing it | |
|
||||
| -f | Force build application | |
|
||||
| -garbleargs | Arguments to pass to garble | `-literals -tiny -seed=random` |
|
||||
| -ldflags "flags" | Additional ldflags to pass to the compiler | |
|
||||
| -m | Skip mod tidy before compile | |
|
||||
| -nopackage | Do not package application | |
|
||||
| -nocolour | Disable colour in output | |
|
||||
| -nosyncgomod | Do not sync go.mod with the Wails version | |
|
||||
| -nsis | Generate NSIS installer for Windows | |
|
||||
| -o filename | Output filename | |
|
||||
| -obfuscated | Obfuscate the application using [garble](https://github.com/burrowers/garble) | |
|
||||
| -platform | Build for the given (comma delimited) [platforms](../reference/cli.mdx#platforms) eg. `windows/arm64`. Note, if you do not give the architecture, `runtime.GOARCH` is used. | platform = `GOOS` environment variable if given else `runtime.GOOS`.<br/>arch = `GOARCH` envrionment variable if given else `runtime.GOARCH`. |
|
||||
| -race | Build with Go's race detector | |
|
||||
| -s | Skip building the frontend | |
|
||||
| -skipbindings | Skip bindings generation | |
|
||||
| -tags "extra tags" | Build tags to pass to Go compiler. Must be quoted. Space or comma (but not both) separated | |
|
||||
| -trimpath | Remove all file system paths from the resulting executable. | |
|
||||
| -u | Updates your project's `go.mod` to use the same version of Wails as the CLI | |
|
||||
| -upx | Compress final binary using "upx" | |
|
||||
| -upxflags | Flags to pass to upx | |
|
||||
| -v int | Verbosity level (0 - silent, 1 - default, 2 - verbose) | 1 |
|
||||
| -webview2 | WebView2 installer strategy: download,embed,browser,error | download |
|
||||
| -windowsconsole | Keep the console window for Windows builds | |
|
||||
|
||||
For a detailed description of the `webview2` flag, please refer to the [Windows](../guides/windows.mdx) Guide.
|
||||
|
||||
@ -166,8 +166,8 @@ Your system is ready for Wails development!
|
||||
- A webserver is started on `http://localhost:34115` which serves your application (not just frontend) over http. This allows you to use your favourite browser development extensions
|
||||
- All application assets are loaded from disk. If they are changed, the application will automatically reload (not rebuild). All connected browsers will also reload
|
||||
- A JS module is generated that provides the following:
|
||||
- JavaScript wrappers of your Go methods with autogenerated JSDoc, providing code hinting
|
||||
- TypeScript versions of your Go structs, that can be constructed and passed to your go methods
|
||||
- JavaScript wrappers of your Go methods with autogenerated JSDoc, providing code hinting
|
||||
- TypeScript versions of your Go structs, that can be constructed and passed to your go methods
|
||||
- A second JS module is generated that provides a wrapper + TS declaration for the runtime
|
||||
- On macOS, it will bundle the application into a `.app` file and run it. It will use a `build/darwin/Info.dev.plist` for development.
|
||||
|
||||
|
@ -366,7 +366,7 @@ Name: CSSDragValue<br/> Type: `string`
|
||||
|
||||
EnableDefaultContextMenu enables the browser's default context-menu in production.
|
||||
|
||||
By default, the browser's default context-menu is only available in development and in a `-debug` or `-devtools` [build](../reference/cli.mdx#build) along with the devtools inspector, Using this option you can enable the default context-menu in `production` while the devtools inspector won't be available unless the `-devtools` build flag is used.
|
||||
By default, the browser's default context-menu is only available in development and in a `-debug` [build](../reference/cli.mdx#build) along with the devtools inspector, Using this option you can enable the default context-menu in `production` while the devtools inspector won't be available unless the `-devtools` build flag is used.
|
||||
|
||||
When this option is enabled, by default the context-menu will only be shown for text contexts (where Cut/Copy/Paste is needed), to override this behavior, you can use the CSS property `--default-contextmenu` on any HTML element (including the `body`) with the following values :
|
||||
|
||||
@ -593,6 +593,12 @@ Setting this to `true` will disable GPU hardware acceleration for the webview.
|
||||
|
||||
Name: WebviewGpuIsDisabled<br/> Type: `bool`
|
||||
|
||||
#### EnableSwipeGestures
|
||||
|
||||
Setting this to `true` will enable swipe gestures for the webview.
|
||||
|
||||
Name: EnableSwipeGestures<br/> Type: `bool`
|
||||
|
||||
### Mac
|
||||
|
||||
This defines [Mac specific options](#mac).
|
||||
@ -688,6 +694,42 @@ Setting this to `true` will make the window background translucent. Often combin
|
||||
|
||||
Name: WindowIsTranslucent<br/> Type: `bool`
|
||||
|
||||
#### Preferences
|
||||
|
||||
The Preferences struct provides the ability to configure the Webview preferences.
|
||||
|
||||
Name: Preferences<br/> Type: [`*mac.Preferences`](#preferences-struct)
|
||||
|
||||
##### Preferences struct
|
||||
|
||||
You can specify the webview preferences.
|
||||
|
||||
```go
|
||||
type Preferences struct {
|
||||
TabFocusesLinks u.Bool
|
||||
TextInteractionEnabled u.Bool
|
||||
FullscreenEnabled u.Bool
|
||||
}
|
||||
```
|
||||
|
||||
| Name | Description |
|
||||
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| TabFocusesLinks | A Boolean value that indicates whether pressing the tab key changes the focus to links and form controls. [Apple Docs](https://developer.apple.com/documentation/webkit/wkpreferences/2818595-tabfocuseslinks?language=objc) |
|
||||
| TextInteractionEnabled | A Boolean value that indicates whether to allow people to select or otherwise interact with text. [Apple Docs](https://developer.apple.com/documentation/webkit/wkpreferences/3727362-textinteractionenabled?language=objc) |
|
||||
| FullscreenEnabled | A Boolean value that indicates whether a web view can display content full screen. [Apple Docs](https://developer.apple.com/documentation/webkit/wkpreferences/3917769-elementfullscreenenabled?language=objc) |
|
||||
|
||||
Example:
|
||||
|
||||
```go
|
||||
Mac: &mac.Options{
|
||||
Preferences: &mac.Preferences{
|
||||
TabFocusesLinks: mac.Enabled,
|
||||
TextInteractionEnabled: mac.Disabled,
|
||||
FullscreenEnabled: mac.Enabled,
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### About
|
||||
|
||||
This configuration lets you set the title, message and icon for the "About" menu item in the app menu created by the "AppMenu" role.
|
||||
|
@ -13,6 +13,28 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
- Added support for enabling/disabling swipe gestures for Windows WebView2. Added by @leaanthony in [PR](https://github.com/wailsapp/wails/pull/2878)
|
||||
- When building with `-devtools` flag, CMD/CTRL+SHIFT+F12 can be used to open the devtools. Added by @leaanthony in [PR](https://github.com/wailsapp/wails/pull/2915) – Added file association support for macOS and Windows. Added by @APshenkin in [PR](https://github.com/wailsapp/wails/pull/2918)
|
||||
- Added support for setting some of the Webview preferences, `textInteractionEnabled` and `tabFocusesLinks` on Mac. Added by @fkhadra in [PR](https://github.com/wailsapp/wails/pull/2937)
|
||||
- Added support for enabling/disabling fullscreen of the Webview on Mac. Added by @fkhadra in [PR](https://github.com/wailsapp/wails/pull/2953)
|
||||
- Added French README.fr.md page. Added by @nejos97 in [PR](https://github.com/wailsapp/wails/pull/2943)
|
||||
- New task created for linting v2 `task v2:lint`. Workflow updated to run the task. Added by @mikeee in [PR](https://github.com/wailsapp/wails/pull/2957)
|
||||
- Added new community template wails-htmx-templ-chi-tailwind. Added by [@pylotlight](https://github.com/pylotlight) in [PR](https://github.com/wailsapp/wails/pull/2984)
|
||||
- Added CPU/GPU/Memory detection for `wails doctor`. Added by @leaanthony in #d51268b8d0680430f3a614775b13e6cd2b906d1c
|
||||
|
||||
### Changed
|
||||
|
||||
- AssetServer requests are now processed asynchronously without blocking the main thread on Windows. Changed by @stffabi in [PR](https://github.com/wailsapp/wails/pull/2926)
|
||||
- AssetServer requests are now processed concurrently by spawning a goroutine per request. Changed by @stffabi in [PR](https://github.com/wailsapp/wails/pull/2926)
|
||||
- Now building with `-devtools` flag doesn't enable the default context-menu. Changed by @mmghv in [PR](https://github.com/wailsapp/wails/pull/2923)
|
||||
- Change Window Level. Changed by @almas1992 in [PR](https://github.com/wailsapp/wails/pull/2944)
|
||||
#### Fixed
|
||||
|
||||
- Fixed typo on docs/reference/options page. Added by [@pylotlight](https://github.com/pylotlight) in [PR](https://github.com/wailsapp/wails/pull/2887)
|
||||
- Fixed issue with npm being called npm20 on openSUSE-Tumbleweed. Fixed by @TuffenDuffen in [PR] in (https://github.com/wailsapp/wails/pull/2941)
|
||||
|
||||
## v2.6.0 - 2023-09-06
|
||||
|
||||
### Breaking Changes
|
||||
@ -27,6 +49,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
- Fixed `SetBackgroundColour` so it sets the window's background color to reduce resize flickering on Linux. Added by @lyimmi in [PR](https://github.com/wailsapp/wails/pull/2853)
|
||||
- Fixed disable window resize option and wrong initial window size when its enabled. Added by @lyimmi in [PR](https://github.com/wailsapp/wails/pull/2863)
|
||||
- Fixed build hook command parsing. Added by @smac89 in [PR](https://github.com/wailsapp/wails/pull/2836)
|
||||
- Fixed filesystem watcher from filtering top level project directory if binary name is included in .gitignore. Added by [@haukened](https://github.com/haukened) in [PR #2869](https://github.com/wailsapp/wails/pull/2869)
|
||||
- Fixed `-reloaddir` flag to watch additional directories (non-recursively). [@haukened](https://github.com/haukened) in [PR #2871](https://github.com/wailsapp/wails/pull/2871)
|
||||
- Fixed support for Go 1.21 `go.mod` files. Fixed by @stffabi in [PR](https://github.com/wailsapp/wails/pull/2876)
|
||||
|
||||
@ -44,6 +67,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
- Added new community template wails-sveltekit-tailwind. Added by [@pylotlight](https://github.com/pylotlight) in [PR](https://github.com/wailsapp/wails/pull/2851)
|
||||
- Added support for print dialogs. Added by [@aangelisc](https://github.com/aangelisc) in [PR](https://github.com/wailsapp/wails/pull/2822)
|
||||
- Added new `wails dev -nogorebuild` flag to prevent restarts on back end file changes. [@haukened](https://github.com/haukened) in [PR #2870](https://github.com/wailsapp/wails/pull/2870)
|
||||
- Added a guide to describe a cross-platform build using GitHub Actions. Added by [@dennypenta](https://github.com/dennypenta) in [PR](https://github.com/wailsapp/wails/pull/2879)
|
||||
|
||||
### Changed
|
||||
|
||||
@ -680,9 +704,6 @@ Experimental: &options.Experimental{
|
||||
|
||||
- [v2, nsis] Seems like / as path separator works only for some directives in a cross platform way by [@stffabi](https://github.com/stffabi) in #1227
|
||||
- import models on binding definition by [@adalessa](https://github.com/adalessa) in #123
|
||||
|
||||
1
|
||||
|
||||
- Use local search on website by [@leaanthony](https://github.com/leaanthony) in #1234
|
||||
- Ensure binary resources can be served by [@napalu](https://github.com/napalu) in #1240
|
||||
- Only retry loading assets when loading from disk by [@leaanthony](https://github.com/leaanthony) in #1241
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
slug: wails-v2-beta-for-windows
|
||||
title: Wails v2 Beta for Windows
|
||||
title: Wails v2 Beta para Windows
|
||||
authors:
|
||||
- leaanthony
|
||||
tags:
|
||||
@ -19,19 +19,19 @@ tags:
|
||||
<br />
|
||||
```
|
||||
|
||||
When I first announced Wails on Reddit, just over 2 years ago from a train in Sydney, I did not expect it to get much attention. A few days later, a prolific tech vlogger released a tutorial video, gave it a positive review and from that point on, interest in the project has skyrocketed.
|
||||
Quando eu anunciei o pela primeira vez o Wails no Reddit, justamente a 2 anos atrás dentro de um trem em Sidney, Eu não esperava que isso teria muita atenção. Alguns dias mais tarde, um vlogger tecnológico prolífico lançou um vídeo de tutorial, deu uma revisão positiva desde então o interesse pelo projeto disparou.
|
||||
|
||||
It was clear that people were excited about adding web frontends to their Go projects, and almost immediately pushed the project beyond the proof of concept that I had created. At the time, Wails used the [webview](https://github.com/webview/webview) project to handle the frontend, and the only option for Windows was the IE11 renderer. Many bug reports were rooted in this limitation: poor JavaScript/CSS support and no dev tools to debug it. This was a frustrating development experience but there wasn't much that could have been done to rectify it.
|
||||
Estava claro que as pessoas estavam animadas para adicionar frontend ‘web’ nas suas aplicações em Go, e quase imediatamente o projeto foi para além da prova de conceito que criei. No momento, Wails usava o projeto [webview](https://github.com/webview/webview) para lidar com o frontend, e a única opção para Windows era o renderizador IE11. Muitos relatórios de erros tiveram root nessa limitação: suporte pobre de JavaScript/CSS e nenhuma ferramenta de desenvolvimento para depurá-lo. Esta foi uma experiência de desenvolvimento frustrante, mas não havia muito que pudesse ter sido feito para corrigi-lo.
|
||||
|
||||
For a long time, I'd firmly believed that Microsoft would eventually have to sort out their browser situation. The world was moving on, frontend development was booming and IE wasn't cutting it. When Microsoft announced the move to using Chromium as the basis for their new browser direction, I knew it was only a matter of time until Wails could use it, and move the Windows developer experience to the next level.
|
||||
Por muito tempo, eu acreditava firmemente que a Microsoft acabaria por ter que resolver a situação do navegador. O mundo estava avançando, o desenvolvimento frondend estava crescendo e o IE não estava acompanhando. Quando a Microsoft anunciou o movimento para usar o Chromium como base para a nova direção do navegador. Eu sabia que era apenas uma questão de tempo até que as Wails pudessem usá-lo, e mova a experiência de desenvolvedor do Windows para o próximo nível.
|
||||
|
||||
Today, I am pleased to announce: **Wails v2 Beta for Windows**! There's a huge amount to unpack in this release, so grab a drink, take a seat and we'll begin...
|
||||
Hoje, estou contente em anunciar: **Wails v2 Beta para Windows**! Há uma enorme quantidade para descompactar esta atualização, então tome uma bebida, sente-se e nós começaremos...
|
||||
|
||||
### No CGO Dependency!
|
||||
### Sem dependência CGO!
|
||||
|
||||
No, I'm not joking: _No_ _CGO_ _dependency_ 🤯! The thing about Windows is that, unlike MacOS and Linux, it doesn't come with a default compiler. In addition, CGO requires a mingw compiler and there's a ton of different installation options. Removing the CGO requirement has massively simplified setup, as well as making debugging an awful lot easier. Whilst I have put a fair bit of effort in getting this working, the majority of the credit should go to [John Chadwick](https://github.com/jchv) for not only starting a couple of projects to make this possible, but also being open to someone taking those projects and building on them. Credit also to [Tad Vizbaras](https://github.com/tadvi) whose [winc](https://github.com/tadvi/winc) project started me down this path.
|
||||
Não, não estou brincando: _Não_ _CGO_ _dependência_🤯! O problema do Windows é que, diferentemente do MacOS e do Linux, ele não vem com um compilador padrão. Além disso, CGO requer um compilador mingw e há uma tonelada de diferentes opções de instalação. A remoção do requisito de CGO tem uma configuração simplificada massivamente, bem como tornar a depuração muito mais fácil. Embora eu tenha me esforçado bastante para fazer isso funcionar, a maioria dos o crédito deveria ir para [John Chadwick](https://github.com/jchv) por não apenas iniciar alguns projetos para fazer isso possível, mas também estar aberto a alguém que assuma esses projetos e os desenvolva. Crédito também a [Tad Vizbaras](https://github.com/tadvi) cujo projeto [winc](https://github.com/tadvi/winc) me iniciou por este caminho.
|
||||
|
||||
### WebView2 Chromium Renderer
|
||||
### Renderizador Chromium WebView2
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
@ -44,15 +44,15 @@ No, I'm not joking: _No_ _CGO_ _dependency_ 🤯! The thing about Windows is tha
|
||||
<br />
|
||||
```
|
||||
|
||||
Finally, Windows developers get a first class rendering engine for their applications! Gone are the days of contorting your frontend code to work on Windows. On top of that, you get a first-class developer tools experience!
|
||||
Finalmente, os desenvolvedores do Windows recebem um mecanismo de renderização de primeira classe para as suas aplicações! Já se foram dias de contorno seu código frontend para funcionar no Windows. Além disso, você tem uma experiência de ferramentas de desenvolvedor de primeira classe!
|
||||
|
||||
The WebView2 component does, however, have a requirement to have the `WebView2Loader.dll` sitting alongside the binary. This makes distribution just that little bit more painful than we gophers are used to. All solutions and libraries (that I know of) that use WebView2 have this dependency.
|
||||
O componente WebView2 tem, no entanto, um requisito para que o `WebView2Loader.dll` fique lado a lado com o binário. Isso faz com que a distribuição seja um pouco mais dolorosa do que nós gophers gostamos de ver. Todas as soluções e bibliotecas (que eu conheço) que usam WebView2 têm essa dependência.
|
||||
|
||||
However, I'm really excited to announce that Wails applications _have no such requirement_! Thanks to the wizardry of [John Chadwick](https://github.com/jchv), we are able to bundle this dll inside the binary and get Windows to load it as if it were present on disk.
|
||||
No entanto, estou muito animado em anunciar que os aplicativos Wails _não têm tal exigência_! Obrigado à magia de [John Chadwick](https://github.com/jchv), nós somos capazes de agregar essa barra dentro do binário e fazer com que o Windows carregue como se estivesse presente no disco.
|
||||
|
||||
Gophers rejoice! The single binary dream lives on!
|
||||
Gophers se alegram! O sonho binário único continua vivo!
|
||||
|
||||
### New Features
|
||||
### Novos Recursos
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
@ -65,11 +65,11 @@ Gophers rejoice! The single binary dream lives on!
|
||||
<br />
|
||||
```
|
||||
|
||||
There were a lot of requests for native menu support. Wails has finally got you covered. Application menus are now available and include support for most native menu features. This includes standard menu items, checkboxes, radio groups, submenus and separators.
|
||||
Houve muitas solicitações para o suporte ao menu nativo. Wails finalmente ajudou você. Os menus de aplicativo agora estão disponíveis e incluem suporte para a maioria dos recursos do menu nativo. Isto inclui itens de menu padrão, caixas de seleção, grupos de rádio, submenus e separadores.
|
||||
|
||||
There were a huge number of requests in v1 for the ability to have greater control of the window itself. I'm happy to announce that there's new runtime APIs specifically for this. It's feature-rich and supports multi-monitor configurations. There is also an improved dialogs API: Now, you can have modern, native dialogs with rich configuration to cater for all your dialog needs.
|
||||
Houve um grande número de pedidos na v1 no sentido de se conseguir um maior controlo da própria janela. Estou feliz em anunciar que há novas APIs de tempo de execução especificamente para isso. Ele é rico em recursos e suporta configurações multi-monitores. Há também uma API de diálogos aprimorada: agora você pode ter diálogos com configuração avançada para atender a todas as suas necessidades de diálogo.
|
||||
|
||||
There is now the option to generate IDE configuration along with your project. This means that if you open your project in a supported IDE, it will already be configured for building and debugging your application. Currently VSCode is supported but we hope to support other IDEs such as Goland soon.
|
||||
Agora há a opção de gerar a configuração do IDE junto com o seu projeto. Isto significa que se você abrir o seu projeto em um IDE suportado, ele já será configurado para construir e depurar sua aplicação. Atualmente o VSCode é suportado mas esperamos dar suporte a outros IDEs como o Goland em breve.
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
@ -82,19 +82,19 @@ There is now the option to generate IDE configuration along with your project. T
|
||||
<br />
|
||||
```
|
||||
|
||||
### No requirement to bundle assets
|
||||
### Nenhum requisito para empacotar assets
|
||||
|
||||
A huge pain-point of v1 was the need to condense your entire application down to single JS & CSS files. I'm happy to announce that for v2, there is no requirement to bundle assets, in any way, shape or form. Want to load a local image? Use an `<img>` tag with a local src path. Want to use a cool font? Copy it in and add the path to it in your CSS.
|
||||
Um grande problema da v1 foi a necessidade de condensar todo o seu aplicativo em um único JS & Arquivos CSS. Estou feliz em anunciar que para v2, não há nenhum requisito de agrupar assets, de qualquer forma. Quer carregar uma imagem local? Use uma tag `<img>` com um caminho de src local. Quer usar uma fonte legal? Copie ele e adicione o caminho para ele em seu CSS.
|
||||
|
||||
> Wow, that sounds like a webserver...
|
||||
> Uau, isso soa como um servidor web...
|
||||
|
||||
Yes, it works just like a webserver, except it isn't.
|
||||
Sim, funciona como um servidor web, mas não é.
|
||||
|
||||
> So how do I include my assets?
|
||||
> Então, como incluo meus assets?
|
||||
|
||||
You just pass a single `embed.FS` that contains all your assets into your application configuration. They don't even need to be in the top directory - Wails will just work it out for you.
|
||||
Você apenas passa um único `embed.FS` que contém todos os seus assets na configuração da sua aplicação. Eles nem precisam estar no diretório superior - o Wails resolverá isso para você.
|
||||
|
||||
### New Development Experience
|
||||
### Nova Experiência de Desenvolvimento
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
@ -107,20 +107,20 @@ You just pass a single `embed.FS` that contains all your assets into your applic
|
||||
<br />
|
||||
```
|
||||
|
||||
Now that assets don't need to be bundled, it's enabled a whole new development experience. The new `wails dev` command will build and run your application, but instead of using the assets in the `embed.FS`, it loads them directly from disk.
|
||||
Agora que os ativos não precisam ser agrupados, foi possível uma experiência de desenvolvimento totalmente nova. O novo comando `wail dev` irá construir e executar seu aplicativo, mas em vez de usar os ativos do `incorporados. S`, carrega-os diretamente do disco.
|
||||
|
||||
It also provides the additional features:
|
||||
Ele também fornece os recursos adicionais:
|
||||
|
||||
- Hot reload - Any changes to frontend assets will trigger and auto reload of the application frontend
|
||||
- Auto rebuild - Any changes to your Go code will rebuild and relaunch your application
|
||||
- Carregamento automatico - Quaisquer mudanças nos recursos do frontend irão ativar e recarregar automaticamente o frontend do aplicativo
|
||||
- Reconstrução automática - Qualquer alteração ao seu código Go irá reconstruir e reiniciar seu aplicativo
|
||||
|
||||
In addition to this, a webserver will start on port 34115. This will serve your application to any browser that connects to it. All connected web browsers will respond to system events like hot reload on asset change.
|
||||
Além disso, um servidor web iniciará na porta 34115. Isso servirá seu aplicativo para qualquer navegador que conecta a ele. Todos os navegadores web conectados responderão a eventos do sistema como recarregar rapidamente na alteração de ativos.
|
||||
|
||||
In Go, we are used to dealing with structs in our applications. It's often useful to send structs to our frontend and use them as state in our application. In v1, this was a very manual process and a bit of a burden on the developer. I'm happy to announce that in v2, any application run in dev mode will automatically generate TypeScript models for all structs that are input or output parameters to bound methods. This enables seamless interchange of data models between the two worlds.
|
||||
Em Go, estamos acostumados a lidar com estruturas em nossas aplicações. Muitas vezes é útil enviar estruturas para nosso frontend e use-os como estado em nosso aplicativo. Na v1, este foi um processo muito manual e um pouco de sobrecarga para o desenvolvedor. Tenho prazer em anunciar isso em v2, qualquer aplicativo executado no modo de desenvolvimento irá gerar automaticamente modelos TypeScript para todas as construções que são entradas ou parâmetros de saída para métodos vinculados. Isso permite uma troca perfeita de dados modelos entre os dois mundos.
|
||||
|
||||
In addition to this, another JS module is dynamically generated wrapping all your bound methods. This provides JSDoc for your methods, providing code completion and hinting in your IDE. It's really cool when you get data models auto-imported when hitting tab in an auto-generated module wrapping your Go code!
|
||||
Além disso, outro módulo JS é gerado dinamicamente todos os seus métodos de vinculação. Isso fornece JSDoc para seus métodos, fornecendo a conclusão de código e dicas em seu IDE. É muito legal quando você obtém modelos de dados auto-importado quando atinge a aba em um módulo gerado automaticamente embrulhando o seu código Go!
|
||||
|
||||
### Remote Templates
|
||||
### Modelos Remotos
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
@ -133,29 +133,29 @@ In addition to this, another JS module is dynamically generated wrapping all you
|
||||
<br />
|
||||
```
|
||||
|
||||
Getting an application up and running quickly was always a key goal for the Wails project. When we launched, we tried to cover a lot of the modern frameworks at the time: react, vue and angular. The world of frontend development is very opinionated, fast moving and hard to keep on top of! As a result, we found our base templates getting out of date pretty quickly and this caused a maintenance headache. It also meant that we didn't have cool modern templates for the latest and greatest tech stacks.
|
||||
Colocar um aplicativo em funcionamento rapidamente sempre foi um objetivo importante do projeto Wails. Quando lançamos, tentamos cobrir muitos dos frameworks modernos no momento: react, vue e angular. O mundo do desenvolvimento frontend é muito teimoso, rápido e difícil de manter no controle! Como resultado, descobrimos que nossos modelos básicos estavam bastante desatualizados rapidamente e isso causou uma dor de cabeça de manutenção. Também significava que não tínhamos modelos modernos legais para os mais recentes e os maiores cumes tecnológicos.
|
||||
|
||||
With v2, I wanted to empower the community by giving you the ability to create and host templates yourselves, rather than rely on the Wails project. So now you can create projects using community supported templates! I hope this will inspire developers to create a vibrant ecosystem of project templates. I'm really quite excited about what our developer community can create!
|
||||
Com a v2, eu queria capacitar a comunidade, dando a vocês a capacidade de criar e hospedar modelos por conta própria, em vez de do que confiar no projeto Wails. Então agora você pode criar projetos usando templates suportados pela comunidade! Espero que isto vá inspirar os desenvolvedores a criar um ecossistema vibrante de modelos de projeto. Estou realmente animado com o que a comunidade de desenvolvedores pode criar!
|
||||
|
||||
### In Conclusion
|
||||
### Em conclusão
|
||||
|
||||
Wails v2 represents a new foundation for the project. The aim of this release is to get feedback on the new approach, and to iron out any bugs before a full release. Your input would be most welcome. Please direct any feedback to the [v2 Beta](https://github.com/wailsapp/wails/discussions/828) discussion board.
|
||||
As trilhas v2 representam uma nova fundação para o projeto. O objetivo desta versão é obter feedback sobre a nova abordagem e aperfeiçoar quaisquer erros antes de uma versão completa. Sua opinião seria muito bem-vinda. Por favor, direcione qualquer feedback para o fórum de discussão [Beta](https://github.com/wailsapp/wails/discussions/828).
|
||||
|
||||
There were many twists and turns, pivots and u-turns to get to this point. This was due partly to early technical decisions that needed changing, and partly because some core problems we had spent time building workarounds for were fixed upstream: Go’s embed feature is a good example. Fortunately, everything came together at the right time, and today we have the very best solution that we can have. I believe the wait has been worth it - this would not have been possible even 2 months ago.
|
||||
Houve muitas reviravoltas, pivots e reviravoltas para chegar a este ponto. Isto deveu-se em parte a decisões técnicas iniciais isso precisava ser mudado, e em parte porque alguns problemas principais para os quais passamos tempo criando soluções alternativas foram corrigidos no upstream: O recurso de incorporação do Go é um bom exemplo. Felizmente, tudo se juntou no momento certo, e hoje nós temos a melhor solução que podemos ter. Eu acredito que a espera tem valido a pena - isto não teria sido possível até 2 meses atrás.
|
||||
|
||||
I also need to give a huge thank you :pray: to the following people because without them, this release just wouldn't exist:
|
||||
Eu também preciso dar um enorme agradecimento :pray: às seguintes pessoas, porque sem elas essa liberação não existiria:
|
||||
|
||||
- [Misite Bao](https://github.com/misitebao) - An absolute workhorse on the Chinese translations and an incredible bug finder.
|
||||
- [John Chadwick](https://github.com/jchv) - His amazing work on [go-webview2](https://github.com/jchv/go-webview2) and [go-winloader](https://github.com/jchv/go-winloader) have made the Windows version we have today possible.
|
||||
- [Tad Vizbaras](https://github.com/tadvi) - Experimenting with his [winc](https://github.com/tadvi/winc) project was the first step down the path to a pure Go Wails.
|
||||
- [Mat Ryer](https://github.com/matryer) - His support, encouragement and feedback has really helped drive the project forward.
|
||||
- [Misite Bao](https://github.com/misitebao) - Um cavalo de trabalho absoluto sobre as traduções chinesas e uma incrível busca de bugs.
|
||||
- [John Chadwick](https://github.com/jchv) - Seu excelente trabalho no [go-webview2](https://github.com/jchv/go-webview2) e [go-winloader](https://github.com/jchv/go-winloader) tornaram a versão do Windows que temos hoje possível.
|
||||
- [Tad Vizbaras](https://github.com/tadvi) - Experimentar seu projeto [winc](https://github.com/tadvi/winc) foi o primeiro passo para um Go Wails puro.
|
||||
- [Mat Ryer](https://github.com/matryer) - Seu apoio, encorajamento e feedback realmente ajudaram a impulsionar o projeto.
|
||||
|
||||
And finally, I'd like to give a special thank you to all the [project sponsors](/credits#sponsors), including [JetBrains](https://www.jetbrains.com?from=Wails), whose support drive the project in many ways behind the scenes.
|
||||
E finalmente, eu gostaria de agradecer especialmente a todos os patrocinadores [do projeto](/credits#sponsors), incluindo [JetBrains](https://www.jetbrains.com?from=Wails), cujo suporte dirige o projeto de muitas formas nos bastidores.
|
||||
|
||||
I look forward to seeing what people build with Wails in this next exciting phase of the project!
|
||||
Estou ansioso para ver o que as pessoas construirão com Wails nesta próxima fase emocionante do projeto!
|
||||
|
||||
Lea.
|
||||
|
||||
PS: MacOS and Linux users need not feel left out - porting to this new foundation is actively under way and most of the hard work has already been done. Hang in there!
|
||||
PS: MacOS e usuários do Linux não precisam de se sentir esquecidos - o facto de se portar para esta nova fundação está activamente em curso e a maior parte do trabalho árduo já foi feito. Aguenta firme!
|
||||
|
||||
PPS: If you or your company find Wails useful, please consider [sponsoring the project](https://github.com/sponsors/leaanthony). Thanks!
|
||||
PPS: Se você ou sua empresa consideram o Wails útil, considere [patrocinar o projeto](https://github.com/sponsors/leaanthony). Obrigado!
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
slug: wails-v2-beta-for-mac
|
||||
title: Wails v2 Beta for MacOS
|
||||
title: Wails v2 Beta para MacOS
|
||||
authors:
|
||||
- leaanthony
|
||||
tags:
|
||||
@ -19,13 +19,13 @@ tags:
|
||||
<br />
|
||||
```
|
||||
|
||||
Today marks the first beta release of Wails v2 for Mac! It's taken quite a while to get to this point and I'm hoping that today's release will give you something that's reasonably useful. There have been a number of twists and turns to get to this point and I'm hoping, with your help, to iron out the crinkles and get the Mac port polished for the final v2 release.
|
||||
Hoje marca a primeira versão beta do Wails v2 para Mac! Demorou um pouco para chegar a este ponto e espero que o lançamento de hoje lhe dará algo razoavelmente útil. Houve uma série de reviravoltas e turnos para chegar a este ponto e estou esperando, com a sua ajuda, para passar as rugas e polir a porta Mac para a versão final do v2.
|
||||
|
||||
You mean this isn't ready for production? For your use case, it may well be ready, but there are still a number of known issues so keep your eye on [this project board](https://github.com/wailsapp/wails/projects/7) and if you would like to contribute, you'd be very welcome!
|
||||
Quer dizer que isso não está pronto para a produção? Para o seu caso de uso, ele pode estar pronto, mas ainda há vários problemas conhecidos, então fique de olho [neste quadro de projeto](https://github.com/wailsapp/wails/projects/7) e se desejar gostaria de contribuir, será muito bem-vindo!
|
||||
|
||||
So what's new for Wails v2 for Mac vs v1? Hint: It's pretty similar to the Windows Beta :wink:
|
||||
Então, o que há de novo para Wails v2 para Mac vs v1? Dica: É bem parecido com o Windows Beta :wink:
|
||||
|
||||
### New Features
|
||||
### Novos Recursos
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
@ -38,47 +38,47 @@ So what's new for Wails v2 for Mac vs v1? Hint: It's pretty similar to the Windo
|
||||
<br />
|
||||
```
|
||||
|
||||
There were a lot of requests for native menu support. Wails has finally got you covered. Application menus are now available and include support for most native menu features. This includes standard menu items, checkboxes, radio groups, submenus and separators.
|
||||
Houve muitas solicitações para o suporte ao menu nativo. Wails finalmente ajudou você. Os menus de aplicativo agora estão disponíveis e incluem suporte para a maioria dos recursos do menu nativo. Isto inclui itens de menu padrão, caixas de seleção, grupos de rádio, submenus e separadores.
|
||||
|
||||
There were a huge number of requests in v1 for the ability to have greater control of the window itself. I'm happy to announce that there's new runtime APIs specifically for this. It's feature-rich and supports multi-monitor configurations. There is also an improved dialogs API: Now, you can have modern, native dialogs with rich configuration to cater for all your dialog needs.
|
||||
Houve um grande número de pedidos na v1 no sentido de se conseguir um maior controlo da própria janela. Estou feliz em anunciar que há novas APIs de tempo de execução especificamente para isso. Ele é rico em recursos e suporta configurações multi-monitores. Há também uma API de diálogos aprimorada: agora você pode ter diálogos com configuração avançada para atender a todas as suas necessidades de diálogo.
|
||||
|
||||
### Mac Specific Options
|
||||
### Opções especificas para Mac
|
||||
|
||||
In addition to the normal application options, Wails v2 for Mac also brings some Mac extras:
|
||||
Além das opções normais do aplicativo, o Wails v2 para Mac também traz alguns extras:
|
||||
|
||||
- Make your window all funky and translucent, like all the pretty swift apps!
|
||||
- Highly customisable titlebar
|
||||
- We support the NSAppearance options for the application
|
||||
- Simple config to auto-create an "About" menu
|
||||
- Faça sua janela totalmente engraçada e translucente, como todos os aplicativos muito rápidos!
|
||||
- Barra de títulos altamente customizável
|
||||
- Nós suportamos as opções NSAppearance para o aplicativo
|
||||
- Configuração simples para criar automaticamente um menu "Sobre"
|
||||
|
||||
### No requirement to bundle assets
|
||||
### Nenhum requisito para empacotar assets
|
||||
|
||||
A huge pain-point of v1 was the need to condense your entire application down to single JS & CSS files. I'm happy to announce that for v2, there is no requirement to bundle assets, in any way, shape or form. Want to load a local image? Use an `<img>` tag with a local src path. Want to use a cool font? Copy it in and add the path to it in your CSS.
|
||||
Um grande problema da v1 foi a necessidade de condensar todo o seu aplicativo em um único JS & Arquivos CSS. Estou feliz em anunciar que para v2, não há nenhum requisito de agrupar assets, de qualquer forma. Quer carregar uma imagem local? Use uma tag `<img>` com um caminho de src local. Quer usar uma fonte legal? Copie ele e adicione o caminho para ele em seu CSS.
|
||||
|
||||
> Wow, that sounds like a webserver...
|
||||
> Uau, isso soa como um servidor web...
|
||||
|
||||
Yes, it works just like a webserver, except it isn't.
|
||||
Sim, funciona como um servidor web, mas não é.
|
||||
|
||||
> So how do I include my assets?
|
||||
> Então, como incluo meus assets?
|
||||
|
||||
You just pass a single `embed.FS` that contains all your assets into your application configuration. They don't even need to be in the top directory - Wails will just work it out for you.
|
||||
Você apenas passa um único `embed.FS` que contém todos os seus assets na configuração da sua aplicação. Eles nem precisam estar no diretório superior - o Wails resolverá isso para você.
|
||||
|
||||
### New Development Experience
|
||||
### Nova Experiência de Desenvolvimento
|
||||
|
||||
Now that assets don't need to be bundled, it's enabled a whole new development experience. The new `wails dev` command will build and run your application, but instead of using the assets in the `embed.FS`, it loads them directly from disk.
|
||||
Agora que os ativos não precisam ser agrupados, foi possível uma experiência de desenvolvimento totalmente nova. O novo comando `wail dev` irá construir e executar seu aplicativo, mas em vez de usar os ativos do `incorporados. S`, carrega-os diretamente do disco.
|
||||
|
||||
It also provides the additional features:
|
||||
Ele também fornece os recursos adicionais:
|
||||
|
||||
- Hot reload - Any changes to frontend assets will trigger and auto reload of the application frontend
|
||||
- Auto rebuild - Any changes to your Go code will rebuild and relaunch your application
|
||||
- Carregamento automatico - Quaisquer mudanças nos recursos do frontend irão ativar e recarregar automaticamente o frontend do aplicativo
|
||||
- Reconstrução automática - Qualquer alteração ao seu código Go irá reconstruir e reiniciar seu aplicativo
|
||||
|
||||
In addition to this, a webserver will start on port 34115. This will serve your application to any browser that connects to it. All connected web browsers will respond to system events like hot reload on asset change.
|
||||
Além disso, um servidor web iniciará na porta 34115. Isso servirá seu aplicativo para qualquer navegador que conecta a ele. Todos os navegadores web conectados responderão a eventos do sistema como recarregar rapidamente na alteração de ativos.
|
||||
|
||||
In Go, we are used to dealing with structs in our applications. It's often useful to send structs to our frontend and use them as state in our application. In v1, this was a very manual process and a bit of a burden on the developer. I'm happy to announce that in v2, any application run in dev mode will automatically generate TypeScript models for all structs that are input or output parameters to bound methods. This enables seamless interchange of data models between the two worlds.
|
||||
Em Go, estamos acostumados a lidar com estruturas em nossas aplicações. Muitas vezes é útil enviar estruturas para nosso frontend e use-os como estado em nosso aplicativo. Na v1, este foi um processo muito manual e um pouco de sobrecarga para o desenvolvedor. Tenho prazer em anunciar isso em v2, qualquer aplicativo executado no modo de desenvolvimento irá gerar automaticamente modelos TypeScript para todas as construções que são entradas ou parâmetros de saída para métodos vinculados. Isso permite uma troca perfeita de dados modelos entre os dois mundos.
|
||||
|
||||
In addition to this, another JS module is dynamically generated wrapping all your bound methods. This provides JSDoc for your methods, providing code completion and hinting in your IDE. It's really cool when you get data models auto-imported when hitting tab in an auto-generated module wrapping your Go code!
|
||||
Além disso, outro módulo JS é gerado dinamicamente todos os seus métodos de vinculação. Isso fornece JSDoc para seus métodos, fornecendo a conclusão de código e dicas em seu IDE. É muito legal quando você obtém modelos de dados auto-importado quando atinge a aba em um módulo gerado automaticamente embrulhando o seu código Go!
|
||||
|
||||
### Remote Templates
|
||||
### Modelos Remotos
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
@ -91,13 +91,13 @@ In addition to this, another JS module is dynamically generated wrapping all you
|
||||
<br />
|
||||
```
|
||||
|
||||
Getting an application up and running quickly was always a key goal for the Wails project. When we launched, we tried to cover a lot of the modern frameworks at the time: react, vue and angular. The world of frontend development is very opinionated, fast moving and hard to keep on top of! As a result, we found our base templates getting out of date pretty quickly and this caused a maintenance headache. It also meant that we didn't have cool modern templates for the latest and greatest tech stacks.
|
||||
Colocar um aplicativo em funcionamento rapidamente sempre foi um objetivo importante do projeto Wails. Quando lançamos, tentamos cobrir muitos dos frameworks modernos no momento: react, vue e angular. O mundo do desenvolvimento frontend é muito teimoso, rápido e difícil de manter no controle! Como resultado, descobrimos que nossos modelos básicos estavam bastante desatualizados rapidamente e isso causou uma dor de cabeça de manutenção. Também significava que não tínhamos modelos modernos legais para os mais recentes e os maiores cumes tecnológicos.
|
||||
|
||||
With v2, I wanted to empower the community by giving you the ability to create and host templates yourselves, rather than rely on the Wails project. So now you can create projects using community supported templates! I hope this will inspire developers to create a vibrant ecosystem of project templates. I'm really quite excited about what our developer community can create!
|
||||
Com a v2, eu queria capacitar a comunidade, dando a vocês a capacidade de criar e hospedar modelos por conta própria, em vez de do que confiar no projeto Wails. Então agora você pode criar projetos usando templates suportados pela comunidade! Espero que isto vá inspirar os desenvolvedores a criar um ecossistema vibrante de modelos de projeto. Estou realmente animado com o que a comunidade de desenvolvedores pode criar!
|
||||
|
||||
### Native M1 Support
|
||||
### Suporte Nativo M1
|
||||
|
||||
Thanks to the amazing support of [Mat Ryer](https://github.com/matryer/), the Wails project now supports M1 native builds:
|
||||
Graças ao incrível apoio do [Ryer](https://github.com/matryer/)Mat, o projeto Wails agora suporta as construções nativas do M1:
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
@ -110,7 +110,7 @@ Thanks to the amazing support of [Mat Ryer](https://github.com/matryer/), the Wa
|
||||
<br />
|
||||
```
|
||||
|
||||
You can also specify `darwin/amd64` as a target too:
|
||||
Você também pode especificar `darwin/amd64` como um alvo também:
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
@ -123,7 +123,7 @@ You can also specify `darwin/amd64` as a target too:
|
||||
<br />
|
||||
```
|
||||
|
||||
Oh, I almost forgot.... you can also do `darwin/universal`.... :wink:
|
||||
Ah, eu quase esqueci... você também pode fazer `darwin/universal`.... :wink:
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
@ -136,9 +136,9 @@ Oh, I almost forgot.... you can also do `darwin/universal`.... :wink:
|
||||
<br />
|
||||
```
|
||||
|
||||
### Cross Compilation to Windows
|
||||
### Compilação para Windows
|
||||
|
||||
Because Wails v2 for Windows is pure Go, you can target Windows builds without docker.
|
||||
Como o Wails v2 para Windows é um Go, você pode direcionar versões do Windows sem o docker.
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
@ -151,20 +151,20 @@ Because Wails v2 for Windows is pure Go, you can target Windows builds without d
|
||||
<br />
|
||||
```
|
||||
|
||||
### WKWebView Renderer
|
||||
### Renderizador WKWebView
|
||||
|
||||
V1 relied on a (now deprecated) WebView component. V2 uses the most recent WKWebKit component so expect the latest and greatest from Apple.
|
||||
V1 dependeu de um componente WebView (agora obsoleto). V2 usa o componente WKWebKit mais recente então espere o mais recente e o maior da Apple.
|
||||
|
||||
### In Conclusion
|
||||
### Em conclusão
|
||||
|
||||
As I'd said in the Windows release notes, Wails v2 represents a new foundation for the project. The aim of this release is to get feedback on the new approach, and to iron out any bugs before a full release. Your input would be most welcome! Please direct any feedback to the [v2 Beta](https://github.com/wailsapp/wails/discussions/828) discussion board.
|
||||
Como eu disse nas notas de lançamento do Windows, Wails v2 representa uma nova fundação para o projeto. O objetivo desta versão é obter feedback sobre a nova abordagem e aperfeiçoar quaisquer erros antes de uma versão completa. Sua opinião seria muito bem-vinda! Por favor, direcione qualquer feedback para o fórum de discussão [Beta](https://github.com/wailsapp/wails/discussions/828).
|
||||
|
||||
And finally, I'd like to give a special thank you to all the [project sponsors](/credits#sponsors), including [JetBrains](https://www.jetbrains.com?from=Wails), whose support drive the project in many ways behind the scenes.
|
||||
E finalmente, eu gostaria de agradecer especialmente a todos os patrocinadores [do projeto](/credits#sponsors), incluindo [JetBrains](https://www.jetbrains.com?from=Wails), cujo suporte dirige o projeto de muitas formas nos bastidores.
|
||||
|
||||
I look forward to seeing what people build with Wails in this next exciting phase of the project!
|
||||
Estou ansioso para ver o que as pessoas construirão com Wails nesta próxima fase emocionante do projeto!
|
||||
|
||||
Lea.
|
||||
|
||||
PS: Linux users, you're next!
|
||||
PS: usuários do Linux, você será o próximo!
|
||||
|
||||
PPS: If you or your company find Wails useful, please consider [sponsoring the project](https://github.com/sponsors/leaanthony). Thanks!
|
||||
PPS: Se você ou sua empresa consideram o Wails útil, considere [patrocinar o projeto](https://github.com/sponsors/leaanthony). Obrigado!
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
slug: wails-v2-beta-for-linux
|
||||
title: Wails v2 Beta for Linux
|
||||
title: Wails v2 Beta para Linux
|
||||
authors:
|
||||
- leaanthony
|
||||
tags:
|
||||
@ -19,9 +19,9 @@ tags:
|
||||
<br />
|
||||
```
|
||||
|
||||
I'm pleased to finally announce that Wails v2 is now in beta for Linux! It is somewhat ironic that the very first experiments with v2 was on Linux and yet it has ended up as the last release. That being said, the v2 we have today is very different from those first experiments. So without further ado, let's go over the new features:
|
||||
Tenho o prazer de finalmente anunciar que as Wails v2 agora estão em beta para Linux! É um pouco irônico que os primeiros experimentos com v2 tenha sido no Linux e, no entanto, ele acabou como o último lançamento. Dito isso, o v2 que temos hoje é muito diferente desses primeiros experimentos. Então, sem mais demora, vamos analisar os novos recursos:
|
||||
|
||||
### New Features
|
||||
### Novos Recursos
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
@ -34,38 +34,38 @@ I'm pleased to finally announce that Wails v2 is now in beta for Linux! It is so
|
||||
<br />
|
||||
```
|
||||
|
||||
There were a lot of requests for native menu support. Wails has finally got you covered. Application menus are now available and include support for most native menu features. This includes standard menu items, checkboxes, radio groups, submenus and separators.
|
||||
Houve muitas solicitações para o suporte ao menu nativo. Wails finalmente ajudou você. Os menus de aplicativo agora estão disponíveis e incluem suporte para a maioria dos recursos do menu nativo. Isto inclui itens de menu padrão, caixas de seleção, grupos de rádio, submenus e separadores.
|
||||
|
||||
There were a huge number of requests in v1 for the ability to have greater control of the window itself. I'm happy to announce that there's new runtime APIs specifically for this. It's feature-rich and supports multi-monitor configurations. There is also an improved dialogs API: Now, you can have modern, native dialogs with rich configuration to cater for all your dialog needs.
|
||||
Houve um grande número de pedidos na v1 no sentido de se conseguir um maior controlo da própria janela. Estou feliz em anunciar que há novas APIs de tempo de execução especificamente para isso. Ele é rico em recursos e suporta configurações multi-monitores. Há também uma API de diálogos aprimorada: agora você pode ter diálogos com configuração avançada para atender a todas as suas necessidades de diálogo.
|
||||
|
||||
### No requirement to bundle assets
|
||||
### Nenhum requisito para empacotar assets
|
||||
|
||||
A huge pain-point of v1 was the need to condense your entire application down to single JS & CSS files. I'm happy to announce that for v2, there is no requirement to bundle assets, in any way, shape or form. Want to load a local image? Use an `<img>` tag with a local src path. Want to use a cool font? Copy it in and add the path to it in your CSS.
|
||||
Um grande problema da v1 foi a necessidade de condensar todo o seu aplicativo em um único JS & Arquivos CSS. Estou feliz em anunciar que para v2, não há nenhum requisito de agrupar assets, de qualquer forma. Quer carregar uma imagem local? Use uma tag `<img>` com um caminho de src local. Quer usar uma fonte legal? Copie ele e adicione o caminho para ele em seu CSS.
|
||||
|
||||
> Wow, that sounds like a webserver...
|
||||
> Uau, isso soa como um servidor web...
|
||||
|
||||
Yes, it works just like a webserver, except it isn't.
|
||||
Sim, funciona como um servidor web, mas não é.
|
||||
|
||||
> So how do I include my assets?
|
||||
> Então, como incluo meus assets?
|
||||
|
||||
You just pass a single `embed.FS` that contains all your assets into your application configuration. They don't even need to be in the top directory - Wails will just work it out for you.
|
||||
Você apenas passa um único `embed.FS` que contém todos os seus assets na configuração da sua aplicação. Eles nem precisam estar no diretório superior - o Wails resolverá isso para você.
|
||||
|
||||
### New Development Experience
|
||||
### Nova Experiência de Desenvolvimento
|
||||
|
||||
Now that assets don't need to be bundled, it's enabled a whole new development experience. The new `wails dev` command will build and run your application, but instead of using the assets in the `embed.FS`, it loads them directly from disk.
|
||||
Agora que os ativos não precisam ser agrupados, foi possível uma experiência de desenvolvimento totalmente nova. O novo comando `wail dev` irá construir e executar seu aplicativo, mas em vez de usar os ativos do `incorporados. S`, carrega-os diretamente do disco.
|
||||
|
||||
It also provides the additional features:
|
||||
Ele também fornece os recursos adicionais:
|
||||
|
||||
- Hot reload - Any changes to frontend assets will trigger and auto reload of the application frontend
|
||||
- Auto rebuild - Any changes to your Go code will rebuild and relaunch your application
|
||||
- Carregamento automatico - Quaisquer mudanças nos recursos do frontend irão ativar e recarregar automaticamente o frontend do aplicativo
|
||||
- Reconstrução automática - Qualquer alteração ao seu código Go irá reconstruir e reiniciar seu aplicativo
|
||||
|
||||
In addition to this, a webserver will start on port 34115. This will serve your application to any browser that connects to it. All connected web browsers will respond to system events like hot reload on asset change.
|
||||
Além disso, um servidor web iniciará na porta 34115. Isso servirá seu aplicativo para qualquer navegador que conecta a ele. Todos os navegadores web conectados responderão a eventos do sistema como recarregar rapidamente na alteração de ativos.
|
||||
|
||||
In Go, we are used to dealing with structs in our applications. It's often useful to send structs to our frontend and use them as state in our application. In v1, this was a very manual process and a bit of a burden on the developer. I'm happy to announce that in v2, any application run in dev mode will automatically generate TypeScript models for all structs that are input or output parameters to bound methods. This enables seamless interchange of data models between the two worlds.
|
||||
Em Go, estamos acostumados a lidar com estruturas em nossas aplicações. Muitas vezes é útil enviar estruturas para nosso frontend e use-os como estado em nosso aplicativo. Na v1, este foi um processo muito manual e um pouco de sobrecarga para o desenvolvedor. Tenho prazer em anunciar isso em v2, qualquer aplicativo executado no modo de desenvolvimento irá gerar automaticamente modelos TypeScript para todas as construções que são entradas ou parâmetros de saída para métodos vinculados. Isso permite uma troca perfeita de dados modelos entre os dois mundos.
|
||||
|
||||
In addition to this, another JS module is dynamically generated wrapping all your bound methods. This provides JSDoc for your methods, providing code completion and hinting in your IDE. It's really cool when you get data models auto-imported when hitting tab in an auto-generated module wrapping your Go code!
|
||||
Além disso, outro módulo JS é gerado dinamicamente todos os seus métodos de vinculação. Isso fornece JSDoc para seus métodos, fornecendo a conclusão de código e dicas em seu IDE. É muito legal quando você obtém modelos de dados auto-importado quando atinge a aba em um módulo gerado automaticamente embrulhando o seu código Go!
|
||||
|
||||
### Remote Templates
|
||||
### Modelos Remotos
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
@ -78,13 +78,13 @@ In addition to this, another JS module is dynamically generated wrapping all you
|
||||
<br />
|
||||
```
|
||||
|
||||
Getting an application up and running quickly was always a key goal for the Wails project. When we launched, we tried to cover a lot of the modern frameworks at the time: react, vue and angular. The world of frontend development is very opinionated, fast moving and hard to keep on top of! As a result, we found our base templates getting out of date pretty quickly and this caused a maintenance headache. It also meant that we didn't have cool modern templates for the latest and greatest tech stacks.
|
||||
Colocar um aplicativo em funcionamento rapidamente sempre foi um objetivo importante do projeto Wails. Quando lançamos, tentamos cobrir muitos dos frameworks modernos no momento: react, vue e angular. O mundo do desenvolvimento frontend é muito teimoso, rápido e difícil de manter no controle! Como resultado, descobrimos que nossos modelos básicos estavam bastante desatualizados rapidamente e isso causou uma dor de cabeça de manutenção. Também significava que não tínhamos modelos modernos legais para os mais recentes e os maiores cumes tecnológicos.
|
||||
|
||||
With v2, I wanted to empower the community by giving you the ability to create and host templates yourselves, rather than rely on the Wails project. So now you can create projects using community supported templates! I hope this will inspire developers to create a vibrant ecosystem of project templates. I'm really quite excited about what our developer community can create!
|
||||
Com a v2, eu queria capacitar a comunidade, dando a vocês a capacidade de criar e hospedar modelos por conta própria, em vez de do que confiar no projeto Wails. Então agora você pode criar projetos usando templates suportados pela comunidade! Espero que isto vá inspirar os desenvolvedores a criar um ecossistema vibrante de modelos de projeto. Estou realmente animado com o que a comunidade de desenvolvedores pode criar!
|
||||
|
||||
### Cross Compilation to Windows
|
||||
### Compilação para Windows
|
||||
|
||||
Because Wails v2 for Windows is pure Go, you can target Windows builds without docker.
|
||||
Como o Wails v2 para Windows é um Go, você pode direcionar versões do Windows sem o docker.
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
@ -97,18 +97,18 @@ Because Wails v2 for Windows is pure Go, you can target Windows builds without d
|
||||
<br />
|
||||
```
|
||||
|
||||
### In Conclusion
|
||||
### Em conclusão
|
||||
|
||||
As I'd said in the Windows release notes, Wails v2 represents a new foundation for the project. The aim of this release is to get feedback on the new approach, and to iron out any bugs before a full release. Your input would be most welcome! Please direct any feedback to the [v2 Beta](https://github.com/wailsapp/wails/discussions/828) discussion board.
|
||||
Como eu disse nas notas de lançamento do Windows, Wails v2 representa uma nova fundação para o projeto. O objetivo desta versão é obter feedback sobre a nova abordagem e aperfeiçoar quaisquer erros antes de uma versão completa. Sua opinião seria muito bem-vinda! Por favor, direcione qualquer feedback para o fórum de discussão [Beta](https://github.com/wailsapp/wails/discussions/828).
|
||||
|
||||
Linux is **hard** to support. We expect there to be a number of quirks with the beta. Please help us to help you by filing detailed bug reports!
|
||||
Linux é **Difícil** de suporte. Esperamos que haja uma série de peculiaridades com o beta. Por favor, ajude-nos a lhe ajudar por a visualizar relatórios detalhados de erros!
|
||||
|
||||
Finally, I'd like to give a special thank you to all the [project sponsors](/credits#sponsors) whose support drive the project in many ways behind the scenes.
|
||||
Por fim, gostaria de agradecer especialmente a todos os [patrocinadores do projeto](/credits#sponsors) cujo apoio conduzir o projeto de várias maneiras nos bastidores.
|
||||
|
||||
I look forward to seeing what people build with Wails in this next exciting phase of the project!
|
||||
Estou ansioso para ver o que as pessoas construirão com Wails nesta próxima fase emocionante do projeto!
|
||||
|
||||
Lea.
|
||||
|
||||
PS: The v2 release isn't far off now!
|
||||
PS: A versão v2 não está muito distante agora!
|
||||
|
||||
PPS: If you or your company find Wails useful, please consider [sponsoring the project](https://github.com/sponsors/leaanthony). Thanks!
|
||||
PPS: Se você ou sua empresa consideram o Wails útil, considere [patrocinar o projeto](https://github.com/sponsors/leaanthony). Obrigado!
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
slug: wails-v2-released
|
||||
title: Wails v2 Released
|
||||
title: Wails v2 liberado
|
||||
authors:
|
||||
- leaanthony
|
||||
tags:
|
||||
@ -18,81 +18,81 @@ tags:
|
||||
<br />
|
||||
```
|
||||
|
||||
# It's here!
|
||||
# Já disponível!
|
||||
|
||||
Today marks the release of [Wails](https://wails.io) v2. It's been about 18 months since the first v2 alpha and about a year from the first beta release. I'm truly grateful to everyone involved in the evolution of the project.
|
||||
Hoje marca a liberação de [Wails](https://wails.io) v2. Já faz cerca de 18 meses desde o primeiro alfa v2 e cerca de um ano desde a primeira versão beta. Eu sou realmente grato a todos que participaram da evolução do projeto.
|
||||
|
||||
Part of the reason it took that long was due to wanting to get to some definition of completeness before officially calling it v2. The truth is, there's never a perfect time to tag a release - there's always outstanding issues or "just one more" feature to squeeze in. What tagging an imperfect major release does do, however, is to provide a bit of stability for users of the project, as well as a bit of a reset for the developers.
|
||||
Uma parte da razão por que demorou tanto tempo a querer chegar a uma definição de completude antes de a designar oficialmente como v2. A verdade é que nunca há um momento perfeito para marcar uma versão - há sempre questões pendentes ou "apenas mais um" recurso para entrar. No entanto, o que marcar uma versão principal imperfeita faz. é fornecer um pouco de estabilidade para os usuários do projeto, bem como um pouco de redefinição para os desenvolvedores.
|
||||
|
||||
This release is more than I'd ever expected it to be. I hope it gives you as much pleasure as it has given us to develop it.
|
||||
Esta versão é mais do que eu já esperava que fosse. Espero que lhe dê tanto prazer como nos deu em desenvolvê-lo.
|
||||
|
||||
# What _is_ Wails?
|
||||
# O que _é_ Wails?
|
||||
|
||||
If you are unfamiliar with Wails, it is a project that enables Go programmers to provide rich frontends for their Go programs using familiar web technologies. It's a lightweight, Go alternative to Electron. Much more information can be found on the [official site](https://wails.io/docs/introduction).
|
||||
Se você não estiver familiarizado com as Wails, é um projeto que permite aos programadores Go fornecerem frontend ricos para seus programas usando tecnologias web familiares. É leve, uma alternativa ao Electron. Muito mais informações podem ser encontradas no [site oficial](https://wails.io/docs/introduction).
|
||||
|
||||
# What's new?
|
||||
# O que há de novo?
|
||||
|
||||
The v2 release is a huge leap forward for the project, addressing many of the pain points of v1. If you have not read any of the blog posts on the Beta releases for [macOS](/blog/wails-v2-beta-for-mac), [Windows](/blog/wails-v2-beta-for-windows) or [Linux](/blog/wails-v2-beta-for-linux), then I encourage you to do so as it covers all the major changes in more detail. In summary:
|
||||
A liberação v2 é um enorme salto em frente para o projeto, abordando muitos dos pontos de dor da v1. Se você não leu nenhum dos posts no blog em versões beta para [macOS](/blog/wails-v2-beta-for-mac), [Windows](/blog/wails-v2-beta-for-windows) ou [Linux](/blog/wails-v2-beta-for-linux), Então eu encorajo-os a fazê-lo porque cobre todas as principais mudanças em mais detalhes. Resumo:
|
||||
|
||||
- Webview2 component for Windows that supports modern web standards and debugging capabilities.
|
||||
- [Dark / Light theme](/docs/reference/options#theme) + [custom theming](/docs/reference/options#customtheme) on Windows.
|
||||
- Windows now has no CGO requirements.
|
||||
- Out-of-the-box support for Svelte, Vue, React, Preact, Lit & Vanilla project templates.
|
||||
- [Vite](https://vitejs.dev/) integration providing a hot-reload development environment for your application.
|
||||
- Native application [menus](/docs/guides/application-development#application-menu) and [dialogs](/docs/reference/runtime/dialog).
|
||||
- Native window translucency effects for [Windows](/docs/reference/options#windowistranslucent) and [macOS](/docs/reference/options#windowistranslucent-1). Support for Mica & Acrylic backdrops.
|
||||
- Easily generate an [NSIS installer](/docs/guides/windows-installer) for Windows deployments.
|
||||
- A rich [runtime library](/docs/reference/runtime/intro) providing utility methods for window manipulation, eventing, dialogs, menus and logging.
|
||||
- Support for [obfuscating](/docs/guides/obfuscated) your application using [garble](https://github.com/burrowers/garble).
|
||||
- Support for compressing your application using [UPX](https://upx.github.io/).
|
||||
- Automatic TypeScript generation of Go structs. More info [here](/docs/howdoesitwork#calling-bound-go-methods).
|
||||
- No extra libraries or DLLs are required to be shipped with your application. For any platform.
|
||||
- No requirement to bundle frontend assets. Just develop your application like any other web application.
|
||||
- Componente Webview2 para Windows que oferece suporte a modernos padrões da web e capacidades de depuração.
|
||||
- [Tema Dark / Light](/docs/reference/options#theme) + [tema personalizado](/docs/reference/options#customtheme) no Windows.
|
||||
- Windows não tem os requisitos de CGO.
|
||||
- Suporte fora da caixa para modelos de projeto Svelte, Vue, React, Preact, Lit & Vanilla.
|
||||
- [Vite](https://vitejs.dev/) integração proporcionando um ambiente de desenvolvimento de atualização quente para seu aplicativo.
|
||||
- Aplicação nativa [menus](/docs/guides/application-development#application-menu) e [dialogs](/docs/reference/runtime/dialog).
|
||||
- Efeitos de translucência nativos da janela para [Windows](/docs/reference/options#windowistranslucent) e [macOS](/docs/reference/options#windowistranslucent-1). Support para Mica & Acrylic backdrops.
|
||||
- Gera facilmente um instalador [NSIS](/docs/guides/windows-installer) para deploys com Windows.
|
||||
- Uma biblioteca [em tempo de execução](/docs/reference/runtime/intro) que fornece métodos utilitários para manipulação de janelas, eventos, diálogos, menus e logs.
|
||||
- Suporte para [ofuscar](/docs/guides/obfuscated) seu aplicativo usando [garble](https://github.com/burrowers/garble).
|
||||
- Suporte para compactar sua aplicação usando [UPX](https://upx.github.io/).
|
||||
- Geração automática de estruturas de Go para TypeScript. Mais informações [aqui](/docs/howdoesitwork#calling-bound-go-methods).
|
||||
- Não são necessárias bibliotecas extras ou DLLs para enviar com sua aplicação. Para qualquer plataforma.
|
||||
- Nenhum requisito para empacotar assets. Apenas desenvolva seu aplicativo como qualquer outro aplicativo da web.
|
||||
|
||||
# Credit & Thanks
|
||||
# Crédito & Obrigado
|
||||
|
||||
Getting to v2 has been a huge effort. There have been ~2.2K commits by 89 contributors between the initial alpha and the release today, and many, many more that have provided translations, testing, feedback and help on the discussion forums as well as the issue tracker. I'm so unbelievably grateful to each one of you. I'd also like to give an extra special thank you to all the project sponsors who have provided guidance, advice and feedback. Everything you do is hugely appreciated.
|
||||
Chegar à v2 tem sido um enorme esforço. Houve cerca de 2,2 mil commits de 89 colaboradores entre o alfa inicial e o lançamento de hoje, e muitos, muitos mais que forneceram traduções, testes, feedback e ajuda nos fóruns de discussão, bem como no rastreador de problemas. Sou tão incrivelmente grato a cada um de vocês. Eu também gostaria de dar um agradecimento especial extra para todos os patrocinadores do projeto que forneceram orientação, conselho e feedback. Tudo o que você faz é extremamente apreciado.
|
||||
|
||||
There are a few people I'd like to give special mention to:
|
||||
Há algumas pessoas que eu gostaria de mencionar especialmente:
|
||||
|
||||
Firstly, a **huge** thank you to [@stffabi](https://github.com/stffabi) who has provided so many contributions which we all benefit from, as well as providing a lot of support on many issues. He has provided some key features such as the external dev server support which transformed our dev mode offering by allowing us to hook into [Vite](https://vitejs.dev/)'s superpowers. It's fair to say that Wails v2 would be a far less exciting release without his [incredible contributions](https://github.com/wailsapp/wails/commits?author=stffabi&since=2020-01-04). Thank you so much @stffabi!
|
||||
Primeiro, a **enorme** obrigado a [@stffabi](https://github.com/stffabi) que forneceu tantas contribuições das quais todos nos beneficiamos, Para além de prestar muito apoio em muitas questões. Ele forneceu algumas principais características, como o suporte ao servidor de desenvolvimento externo que transformou a oferta de desenvolvimento ao nos permitir conectar aos superpoderes do [Vite](https://vitejs.dev/). É justo dizer que o Wails v2 seria um lançamento muito menos emocionante sem sua [incrível contribuição](https://github.com/wailsapp/wails/commits?author=stffabi&since=2020-01-04). Muito obrigado @stffabi!
|
||||
|
||||
I'd also like to give a huge shout-out to [@misitebao](https://github.com/misitebao) who has tirelessly been maintaining the website, as well as providing Chinese translations, managing Crowdin and helping new translators get up to speed. This is a hugely important task, and I'm extremely grateful for all the time and effort put into this! You rock!
|
||||
Eu também gostaria de dar um grande grito para [@misitebao](https://github.com/misitebao) que tem mantido o site incansavelmente. Além de fornecer traduções chinesas, gerenciar Crowdin e ajudar novos tradutores a se atualizarem para a velocidade. Esta é uma tarefa extremamente importante, e estou extremamente grato por todo o tempo e esforço investido nisso! Você é espetacular!
|
||||
|
||||
Last, but not least, a huge thank you to Mat Ryer who has provided advice and support during the development of v2. Writing xBar together using an early Alpha of v2 was helpful in shaping the direction of v2, as well as give me an understanding of some design flaws in the early releases. I'm happy to announce that as of today, we will start to port xBar to Wails v2, and it will become the flagship application for the project. Cheers Mat!
|
||||
Por último, mas não menos importante, um enorme agradecimento ao senhor Mat Ryer, que prestou aconselhamento e apoio durante o desenvolvimento da v2. Escrever xBar junto usando um alfa inicial da v2 foi útil para moldar a direção da v2, Além de me dar uma ideia de algumas falhas de design nas versões mais cedo. Tenho prazer em anunciar que, a partir de hoje, começaremos a abrir o porto xBar para Wails v2, e tornar-se-á o principal aplicativo para o projecto. Felicidades Mat!
|
||||
|
||||
# Lessons Learnt
|
||||
# Lições Aprendidas
|
||||
|
||||
There are a number of lessons learnt in getting to v2 that will shape development moving forward.
|
||||
Há uma série de lições aprendidas ao chegar à v2 que irão moldar o desenvolvimento avançado.
|
||||
|
||||
## Smaller, Quicker, Focused Releases
|
||||
## Menor, Rápido e Focado Versões
|
||||
|
||||
In the course of developing v2, there were many features and bug fixes that were developed on an ad-hoc basis. This led to longer release cycles and were harder to debug. Moving forward, we are going to create releases more often that will include a reduced number of features. A release will involve updates to documentation as well as thorough testing. Hopefully, these smaller, quicker, focussed releases will lead to fewer regressions and better quality documentation.
|
||||
No desenvolvimento da v2, havia muitas características e correções de erros que foram desenvolvidas numa base ad-hoc. Isso levou a ciclos de lançamento mais longos e era mais difícil de depurar. Seguindo, vamos criar lançamentos com mais frequência que incluirá um número reduzido de recursos. Uma versão envolverá atualizações da documentação, bem como testes completos. Esperemos que estes lançamentos mais pequenos, mais rápidos e focados conduzam a menos regressões e a uma melhor documentação de qualidade.
|
||||
|
||||
## Encourage Engagement
|
||||
## Incentive o envolvimento
|
||||
|
||||
When starting this project, I wanted to immediately help everyone who had a problem. Issues were "personal" and I wanted them resolved as quickly as possible. This is unsustainable and ultimately works against the longevity of the project. Moving forward, I will be giving more space for people to get involved in answering questions and triaging issues. It would be good to get some tooling to help with this so if you have any suggestions, please join in the discussion [here](https://github.com/wailsapp/wails/discussions/1855).
|
||||
Ao iniciar este projeto, eu queria ajudar imediatamente todos os que tiveram um problema. Os problemas eram "pessoais" e eu queria que eles fossem resolvidos o mais rapidamente possível. Isto é insustentável e acaba por contrariar a longevidade do projecto. Avançando, darei mais espaço para que as pessoas se envolvam na resposta a perguntas e na triagem de questões. Seria bom conseguir algumas ferramentas para ajudar com isso, portanto, se você tiver alguma sugestão, por favor, participe da discussão [aqui](https://github.com/wailsapp/wails/discussions/1855).
|
||||
|
||||
## Learning to say No
|
||||
## Aprendendo a dizer Não
|
||||
|
||||
The more people that engage with an Open Source project, the more requests there will be for additional features that may or may not be useful to the majority of people. These features will take an initial amount of time to develop and debug, and incur an ongoing maintenance cost from that point on. I myself am the most guilty of this, often wanting to "boil the sea" rather than provide the minimum viable feature. Moving forward, we will need to say "No" a bit more to adding core features and focus our energies on a way to empower developers to provide that functionality themselves. We are looking seriously into plugins for this scenario. This will allow anyone to extend the project as they see fit, as well as providing an easy way to contribute towards the project.
|
||||
Quanto mais pessoas se envolverem com um projeto de Código Aberto, quanto mais pedidos forem para recursos adicionais que possam ou não ser úteis para a maioria das pessoas. Estas características levarão um tempo inicial para desenvolver e debugar e incorrer num custo de manutenção contínuo a partir desse ponto. Eu próprio sou o mais culpado por isso, querendo muitas vezes "ferver o mar" em vez de fornecer o mínimo viável. Seguindo, precisaremos dizer "Não" um pouco mais para adicionar recursos principais e concentrar as nossas energias em uma forma de capacitar os desenvolvedores para fornecer essas funcionalidades por conta própria. Estamos analisando seriamente plugins para este cenário. Isso permitirá a qualquer pessoa alargar o projecto como considerar conveniente, bem como proporcionar uma forma fácil de contribuir para o projecto.
|
||||
|
||||
# Looking to the Future
|
||||
# Olhando para o futuro
|
||||
|
||||
There are so many core features we are looking at to add to Wails in the next major development cycle already. The [roadmap](https://github.com/wailsapp/wails/discussions/1484) is full of interesting ideas, and I'm keen to start work on them. One of the big asks has been for multiple window support. It's a tricky one and to do it right, and we may need to look at providing an alternative API, as the current one was not designed with this in mind. Based on some preliminary ideas and feedback, I think you'll like where we're looking to go with it.
|
||||
Há tantas características centrais que estamos a analisar para adicionar às Wails no próximo grande ciclo de desenvolvimento. O [planejamento](https://github.com/wailsapp/wails/discussions/1484) está cheio de ideias interessantes, e estou ansioso para começar a trabalhar nelas. Uma das grandes perguntas tem sido a de múltiplas janelas. É um pouco complicado e para fazer isso certo, e pode ser que precisemos analisar a prover uma API alternativa. Como o actual não foi concebido tendo isso em mente. Com base em algumas idéias preliminares e feedback, eu acho que você vai gostar de onde estamos procurando acompanhá-lo.
|
||||
|
||||
I'm personally very excited at the prospect of getting Wails apps running on mobile. We already have a demo project showing that it is possible to run a Wails app on Android, so I'm really keen to explore where we can go with this!
|
||||
Eu pessoalmente estou muito animado com a perspectiva de fazer aplicativos Wails funcionarem em dispositivos móveis. Já temos um projeto de demonstração mostrando que é possível executar um aplicativo Wails no Android, então eu estou realmente ansioso para explorar onde podemos ir com isso!
|
||||
|
||||
A final point I'd like to raise is that of feature parity. It has long been a core principle that we wouldn't add anything to the project without there being full cross-platform support for it. Whilst this has proven to be (mainly) achievable so far, it has really held the project back in releasing new features. Moving forward, we will be adopting a slightly different approach: any new feature that cannot be immediately released for all platforms will be released under an experimental configuration or API. This allows early adopters on certain platforms to try the feature and provide feedback that will feed into the final design of the feature. This, of course, means that there are no guarantees of API stability until it is fully supported by all the platforms it can be supported on, but at least it will unblock development.
|
||||
Um último ponto que gostaria de levantar é o da paridade de recursos. Há muito tempo é um princípio central que não adicionamos nada ao projeto sem que haja suporte completo entre plataformas para ele. Embora isto tenha provado ser (principalmente) exequível até agora, conseguiu realmente reter o projeto na libertação de novas características. Movendo para frente, estaremos adotando uma abordagem ligeiramente diferente: qualquer nova funcionalidade que não possa ser imediatamente lançada para todas as plataformas será lançada sob uma configuração experimental ou API. Isso permite que usuários antecipados de certas plataformas experimentem o recurso e forneçam feedback que serão incorporados no design final da funcionalidade. Isto, claro, significa que não há garantias de estabilidade da API até que ela seja totalmente suportada por todas as plataformas em que pode ser suportada, mas pelo menos vai desbloquear o desenvolvimento.
|
||||
|
||||
# Final Words
|
||||
# Palavras Finais
|
||||
|
||||
I'm really proud of what we've been able to achieve with the V2 release. It's amazing to see what people have already been able to build using the beta releases so far. Quality applications like [Varly](https://varly.app/), [Surge](https://getsurge.io/) and [October](https://october.utf9k.net/). I encourage you to check them out.
|
||||
Estou muito orgulhoso do que conseguimos alcançar com a versão V2. É incrível ver o que as pessoas já foram capazes de construir usando os lançamentos beta. Aplicativos de qualidade como [Varly](https://varly.app/), [Surge](https://getsurge.io/) e [outubro](https://october.utf9k.net/). Eu encorajo você a conferi-los.
|
||||
|
||||
This release was achieved through the hard work of many contributors. Whilst it is free to download and use, it has not come about through zero cost. Make no mistakes, this project has come at considerable cost. It has not only been my time and the time of each and every contributor, but also the cost of absence from friends and families of each of those people too. That's why I'm extremely grateful for every second that has been dedicated to making this project happen. The more contributors we have, the more this effort can be spread out and the more we can achieve together. I'd like to encourage you all to pick one thing that you can contribute, whether it is confirming someone's bug, suggesting a fix, making a documentation change or helping out someone who needs it. All of these small things have such a huge impact! It would be so awesome if you too were part of the story in getting to v3.
|
||||
Esta libertação foi conseguida através do trabalho árduo de muitos contribuintes. Embora seja livre de descarregar e utilizar, não surgiu através de custo zero. Não cometamos erros, este projeto tem um custo considerável. Não foi só o meu tempo e o tempo de cada um dos intervenientes, mas também o de cada um. mas também o custo da ausência de amigos e famílias de cada uma dessas pessoas. É por isso que eu estou extremamente grato por cada segundo que foi dedicado a fazer este projeto acontecer. Quanto mais contribuidores tivermos, mais este esforço poderá ser repartido e mais conseguiremos alcançar em conjunto. Eu gostaria de encorajar todos vocês a escolherem uma coisa que você possa contribuir, seja confirmar o bug de alguém, Sugira uma correção, fazendo uma documentação mudar ou ajudando alguém que precise. Todas estas pequenas coisas têm um impacto tão grande! Seria fantástico se o senhor também fizesse parte da história para chegar à v3.
|
||||
|
||||
Enjoy!
|
||||
Aproveite!
|
||||
|
||||
‐ Lea
|
||||
|
||||
PS: If you or your company find Wails useful, please consider [sponsoring the project](https://github.com/sponsors/leaanthony). Thanks!
|
||||
PS: Se você ou sua empresa consideram o Wails útil, considere [patrocinar o projeto](https://github.com/sponsors/leaanthony). Obrigado!
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
slug: the-road-to-wails-v3
|
||||
title: The Road to Wails v3
|
||||
title: A Estrada para Wails v3
|
||||
authors:
|
||||
- leaanthony
|
||||
tags:
|
||||
@ -18,61 +18,61 @@ tags:
|
||||
<br />
|
||||
```
|
||||
|
||||
# Introduction
|
||||
# Introdução
|
||||
|
||||
Wails is a project that simplifies the ability to write cross-platform desktop applications using Go. It uses native webview components for the frontend (not embedded browsers), bringing the power of the world's most popular UI system to Go, whilst remaining lightweight.
|
||||
Wails é um projeto que simplifica a capacidade de escrever aplicativos de desktop multiplataforma usando Ir. Ele usa componentes nativos do webview para o frontend (não os navegadores incorporados), trazendo o poder do sistema de interface de usuário mais popular do mundo, enquanto permanece leve.
|
||||
|
||||
Version 2 was released on the 22nd of September 2022 and brought with it a lot of enhancements including:
|
||||
A versão 2 foi lançada no dia 22 de setembro de 2022 e trouxe uma série de aprimoramentos incluindo:
|
||||
|
||||
- Live development, leveraging the popular Vite project
|
||||
- Rich functionality for managing windows and creating menus
|
||||
- Desenvolvimento ao vivo, aproveitando o projeto popular Vite
|
||||
- Funcionalidade rica para gerenciar janelas e criar menus
|
||||
- Microsoft's WebView2 component
|
||||
- Generation of Typescript models that mirror your Go structs
|
||||
- Creating of NSIS Installer
|
||||
- Obfuscated builds
|
||||
- Geração de modelos de Typescript que espelham suas construções em Go
|
||||
- Criação do NSIS Installer
|
||||
- Compilações ofuscadas
|
||||
|
||||
Right now, Wails v2 provides powerful tooling for creating rich, cross-platform desktop applications.
|
||||
No momento, o Wails v2 fornece ferramentas poderosas para a criação de ‘desktops’ ricos e multiplataforma. Formulários. Ir.
|
||||
|
||||
This blog post aims to look at where the project is at right now and what we can improve on moving forward.
|
||||
Este post de blog visa ver onde o projeto está no momento e o que podemos melhorar ao avançar.
|
||||
|
||||
# Where are we now?
|
||||
# Em que ponto estamos agora?
|
||||
|
||||
It's been incredible to see the popularity of Wails rising since the v2 release. I'm constantly amazed by the creativity of the community and the wonderful things that are being built with it. With more popularity, comes more eyes on the project. And with that, more feature requests and bug reports.
|
||||
Tem sido incrível ver a popularidade das Wails aumentar desde o lançamento v2. Estou constantemente maravilhados com a criatividade da comunidade e com as coisas maravilhosas que estão sendo construídas com ela. Com mais popularidade, vem mais olhos para o projeto. E com isso, mais solicitações de recursos e relatórios de bugs.
|
||||
|
||||
Over time, I've been able to identify some of the most pressing issues facing the project. I've also been able to identify some of the things that are holding the project back.
|
||||
Ao longo do tempo, consegui identificar alguns dos problemas mais prementes enfrentados pelo projeto. Eu também fui capaz de identificar algumas das coisas que estão segurando o projeto de volta.
|
||||
|
||||
## Current issues
|
||||
## Problemas atuais
|
||||
|
||||
I've identified the following areas that I feel are holding the project back:
|
||||
Eu identifiquei as seguintes áreas que sinto que estão segurando o projeto de volta:
|
||||
|
||||
- The API
|
||||
- Bindings generation
|
||||
- The Build System
|
||||
- A API
|
||||
- Geração de Atalhos
|
||||
- O Sistema de Compilação
|
||||
|
||||
### The API
|
||||
### A API
|
||||
|
||||
The API to build a Wails application currently consists of 2 parts:
|
||||
A API para criar um aplicativo Wails atualmente consiste de 2 partes:
|
||||
|
||||
- The Application API
|
||||
- The Runtime API
|
||||
- A API do Aplicativo
|
||||
- A API Runtime
|
||||
|
||||
The Application API famously has only 1 function: `Run()` which takes a heap of options which govern how the application will work. Whilst this is very simple to use, it is also very limiting. It is a "declarative" approach which hides a lot of the underlying complexity. For instance, there is no handle to the main window, so you can't interact with it directly. For that, you need to use the Runtime API. This is a problem when you start to want to do more complex things like create multiple windows.
|
||||
A aplicação API famosamente tem apenas 1 função: `Run()` que dá um monte de opções que governam como a aplicação vai funcionar. Embora isso seja muito simples de usar, é também muito limitado. É uma abordagem "declarativa" que esconde muita da complexidade subjacente. Por exemplo, não há nenhum identificador para a janela principal, então você não pode interagir diretamente com ele. Para isso, você precisa usar a API Runtime. Este é um problema quando você começar a fazer coisas mais complexas como criar múltiplas janelas.
|
||||
|
||||
The Runtime API provides a lot of utility functions for the developer. This includes:
|
||||
A API do Runtime fornece um monte de funções de utilidade para o desenvolvedor. Isso inclui:
|
||||
|
||||
- Window management
|
||||
- Dialogs
|
||||
- Gestão de janelas
|
||||
- Caixa de diálogo
|
||||
- Menus
|
||||
- Events
|
||||
- Eventos
|
||||
- Logs
|
||||
|
||||
There are a number of things I am not happy with the Runtime API. The first is that it requires a "context" to be passed around. This is both frustrating and confusing for new developers who pass in a context and then get a runtime error.
|
||||
Há várias coisas que eu não estou feliz com a API de Runtime. O primeiro é que ele requer um "contexto" para ser passado. Isto é frustrante e confuso para novos desenvolvedores que passam em um contexto e depois recebem um erro de tempo de execução.
|
||||
|
||||
The biggest issue with the Runtime API is that it was designed for applications that only use a single window. Over time, the demand for multiple windows has grown and the API is not well suited to this.
|
||||
O maior problema com a API de Runtime é que ela foi projetada para aplicativos que só usam uma única janela. Ao longo do tempo, a demanda por várias janelas cresceu e a API é não adequada a isso.
|
||||
|
||||
### Thoughts on the v3 API
|
||||
### Pensamentos na API v3
|
||||
|
||||
Wouldn't it be great if we could do something like this?
|
||||
Não seria ótimo se pudéssemos fazer algo assim?
|
||||
|
||||
```go
|
||||
func main() {
|
||||
@ -86,7 +86,7 @@ func main() {
|
||||
}
|
||||
```
|
||||
|
||||
This programmatic approach is far more intuitive and allows the developer to interact with the application elements directly. All current runtime methods for windows would simply be methods on the window object. For the other runtime methods, we could move them to the application object like so:
|
||||
Esta abordagem programática é muito mais intuitiva e permite que o desenvolvedor interaja com os elementos do aplicativo diretamente. Todos os métodos atuais de tempo de execução para o windows seriam simplesmente métodos no objeto da janela. Para os outros métodos de execução, poderíamos mover eles para o objeto do aplicativo assim:
|
||||
|
||||
```go
|
||||
app := wails.NewApplication(options.App{})
|
||||
@ -94,7 +94,7 @@ app.NewInfoDialog(options.InfoDialog{})
|
||||
app.Log.Info("Hello World")
|
||||
```
|
||||
|
||||
This is a much more powerful API which will allow for more complex applications to be built. It also allows for the creation of multiple windows, [the most up-voted feature on GitHub](https://github.com/wailsapp/wails/issues/1480):
|
||||
Esta é uma API muito mais poderosa que permitirá a criação de aplicações mais complexas. Ele também permite a criação de múltiplas janelas, [o recurso mais votado para cima no GitHub](https://github.com/wailsapp/wails/issues/1480):
|
||||
|
||||
```go
|
||||
func main() {
|
||||
@ -113,72 +113,72 @@ func main() {
|
||||
}
|
||||
```
|
||||
|
||||
### Bindings generation
|
||||
### Geração de Atalhos
|
||||
|
||||
One of the key features of Wails is generating bindings for your Go methods so they may be called from Javascript. The current method for doing this is a bit of a hack. It involves building the application with a special flag and then running the resultant binary which uses reflection to determine what has been bound. This leads to a bit of a chicken and egg situation: You can't build the application without the bindings and you can't generate the bindings without building the application. There are many ways around this but the best one would be not to use this approach at all.
|
||||
Uma das principais características das Wails é gerar ligações para seus métodos Go para que possam ser chamadas a partir de Javascript. O método atual para fazer isso é um pouco hackeado. Ele envolve construir o aplicativo com uma bandeira especial e, em seguida, executar o binário resultante que usa reflexão para determinar o que foi vinculado. Isso leva a um pouco de galinha e ovo situação: você não pode construir o aplicativo sem as ligações e não pode gerar o vinculações sem compilar o aplicativo. Há muitas maneiras em torno disso, mas a melhor seria não usar essa abordagem de todo.
|
||||
|
||||
There was a number of attempts at writing a static analyser for Wails projects but they didn't get very far. In more recent times, it has become slightly easier to do this with more material available on the subject.
|
||||
Houve uma série de tentativas de escrever um analisador estático para projetos Wails, mas eles não chegaram muito longe. Em tempos mais recentes, tornou-se um pouco mais fácil fazer isso com mais material disponível sobre o assunto.
|
||||
|
||||
Compared to reflection, the AST approach is much faster however it is significantly more complicated. To start with, we may need to impose certain constraints on how to specify bindings in the code. The goal is to support the most common use cases and then expand it later on.
|
||||
Comparada à reflexão, a abordagem AST é muito mais rápida, porém é significativamente mais complicado. Para começar, podemos precisar impor certas restrições de como especificar ligações no código. O objetivo é suportar os casos de uso mais comuns e, em seguida, expandir mais tarde.
|
||||
|
||||
### The Build System
|
||||
### O Sistema de Compilação
|
||||
|
||||
Like the declarative approach to the API, the build system was created to hide the complexities of building a desktop application. When you run `wails build`, it does a lot of things behind the scenes:
|
||||
- Builds the backend binary for bindings and generates the bindings
|
||||
- Installs the frontend dependencies
|
||||
- Builds the frontend assets
|
||||
- Determines if the application icon is present and if so, embeds it
|
||||
- Builds the final binary
|
||||
- If the build is for `darwin/universal` it builds 2 binaries, one for `darwin/amd64` and one for `darwin/arm64` and then creates a fat binary using `lipo`
|
||||
- If compression is required, it compresses the binary with UPX
|
||||
- Determines if this binary is to be packaged and if so:
|
||||
- Ensures the icon and application manifest are compiled into the binary (Windows)
|
||||
- Builds out the application bundle, generates the icon bundle and copies it, the binary and Info.plist to the application bundle (Mac)
|
||||
- If an NSIS installer is required, it builds it
|
||||
Como a abordagem declarativa para a API, o sistema de compilação foi criado para ocultar as complexidades da construção de um aplicativo desktop. Quando você executa `wails build`, ele faz um muitas coisas nos bastidores:
|
||||
- Constrói o binário de back-end para ligações e gera as ligações
|
||||
- Instala as dependências de frontend
|
||||
- Constrói os assets do frontend
|
||||
- Determina se o ícone da aplicação está presente e, se sim, incorpora-o
|
||||
- Constrói o binário final
|
||||
- Se a compilação for para `darwin/universal` compila 2 binários, um para `darwin/amd64` e um para `darwin/arm64` e então cria um binário gordo usando `lipo`
|
||||
- Se a compressão é necessária, ela compacta o binário com UPX
|
||||
- Determina se este binário deve ser empacotado e, se isso acontecer:
|
||||
- Garante que o ícone e manifesto da aplicação são compilados em binário (Windows)
|
||||
- Constrói o pacote de aplicativos, gera o pacote de ícones e copia-lo, o binário e o Info.plist para o pacote de aplicações (Mac)
|
||||
- Se um instalador do NSIS for necessário, ele será compilado
|
||||
|
||||
This entire process, whilst very powerful, is also very opaque. It is very difficult to customise it and it is very difficult to debug.
|
||||
Todo este processo, apesar de muito poderoso, é também muito opaco. É muito difícil personalize-o e é muito difícil de depurar.
|
||||
|
||||
To address this in v3, I would like to move to a build system that exists outside of Wails. After using [Task](https://taskfile.dev/) for a while, I am a big fan of it. It is a great tool for configuring build systems and should be reasonably familiar to anyone who has used Makefiles.
|
||||
Para abordar esta questão na v3, gostaria de passar para um sistema de construção que existe fora das Wails. Depois de usar [Tarefa](https://taskfile.dev/) por um tempo, eu sou um grande fã dela. É uma ótima ferramenta para configurar sistemas de construção e deve ser razoavelmente familiar para qualquer um que tenha usado Makefiles.
|
||||
|
||||
The build system would be configured using a `Taskfile.yml` file which would be generated by default with any of the supported templates. This would have all of the steps required to do all the current tasks, such as building or packaging the application, allowing for easy customisation.
|
||||
O sistema de compilação seria configurado usando um arquivo `Taskfile.yml` que seria gerado por padrão com qualquer um dos modelos suportados. Isto teria todas as etapas necessárias para realizar todas as tarefas atuais, como construir ou embalar a aplicação, permitindo fácil personalização.
|
||||
|
||||
There will be no external requirement for this tooling as it would form part of the Wails CLI. This means that you can still use `wails build` and it will do all the things it does today. However, if you want to customise the build process, you can do so by editing the `Taskfile.yml` file. It also means you can easily understand the build steps and use your own build system if you wish.
|
||||
É muito difícil personalizar e é muito difícil de purificar. Isso significa que você ainda pode usar `wails build` e ele fará tudo o que faz hoje. No entanto, se você deseja personalizar o processo de construção, você pode fazê-lo editando o arquivo `Taskfile.yml`. Isso também significa que você pode facilmente entender as etapas de compilação e usar seu próprio sistema de compilação se desejar.
|
||||
|
||||
The missing piece in the build puzzle is the atomic operations in the build process, such as icon generation, compression and packaging. To require a bunch of external tooling would not be a great experience for the developer. To address this, the Wails CLI will provide all these capabilities as part of the CLI. This means that the builds still work as expected, with no extra external tooling, however you can replace any step of the build with any tool you like.
|
||||
A peça que falta no quebra-cabeça da construção são as operações atómicas no processo de construção, como geração, compactação e empacotamento de ícones. Para exigir um monte de ferramentas externas não seria uma ótima experiência para o desenvolvedor. Para resolver isso, a CLI do Wails fornecerá todos esses recursos como parte da CLI. Isso significa que as compilações ainda funcionam como esperado, sem ferramenta externa extra, no entanto você pode substituir qualquer passo da compilação por qualquer ferramenta que você goste.
|
||||
|
||||
This will be a much more transparent build system which will allow for easier customisation and address a lot of the issues that have been raised around it.
|
||||
Este será um sistema de compilação muito mais transparente que permitirá uma personalização mais fácil e resolverá muitas das questões que foram levantadas em torno dele.
|
||||
|
||||
## The Payoff
|
||||
## A Recompensa
|
||||
|
||||
These positive changes will be a huge benefit to the project:
|
||||
- The new API will be much more intuitive and will allow for more complex applications to be built.
|
||||
- Using static analysis for bindings generation will be much faster and reduce a lot of the complexity around the current process.
|
||||
- Using an established, external build system will make the build process completely transparent, allowing for powerful customisation.
|
||||
Estas mudanças positivas serão um grande benefício para o projeto:
|
||||
- A nova API será muito mais intuitiva e permitirá a criação de aplicativos mais complexos.
|
||||
- Usar análise estática para geração de ligações será muito mais rápido e reduzirá muito da complexidade em torno do processo atual.
|
||||
- Usando um sistema de compilação externa estabelecido tornará o processo de construção completamente transparente, permitindo uma personalização poderosa.
|
||||
|
||||
Benefits to the project maintainers are:
|
||||
Os benefícios para os mantenedores do projeto são:
|
||||
|
||||
- The new API will be much easier to maintain and adapt to new features and platforms.
|
||||
- The new build system will be much easier to maintain and extend. I hope this will lead to a new ecosystem of community driven build pipelines.
|
||||
- Better separation of concerns within the project. This will make it easier to add new features and platforms.
|
||||
- A nova API será muito mais fácil de manter e adaptar a novos recursos e plataformas.
|
||||
- O novo sistema de construção será muito mais fácil de manter e alargar. Espero que isto conduza a um novo ecossistema de gasodutos de construção orientados pela comunidade.
|
||||
- Melhor separação das preocupações no âmbito do projecto. Isso facilitará a adição de novos recursos e plataformas.
|
||||
|
||||
## The Plan
|
||||
## O Plano
|
||||
|
||||
A lot of the experimentation for this has already been done and it's looking good. There is no current timeline for this work but I'm hoping by the end of Q1 2023, there will be an alpha release for Mac to allow the community to test, experiment with and provide feedback.
|
||||
Muitos dos experimentos já foram feitos e estão bons. Não há um cronograma atual para este trabalho, mas espero que até o final do primeiro trimestre de 2023, haja será uma versão alfa para Mac para permitir que a comunidade teste, experimente e dar uma resposta.
|
||||
|
||||
## Summary
|
||||
## Resumo
|
||||
|
||||
- The v2 API is declarative, hides a lot from the developer and not suitable for features such as multiple windows. A new API will be created which will be simpler, intuitive and more powerful.
|
||||
- The build system is opaque and difficult to customise so we will move to an external build system which will open it all up.
|
||||
- The bindings generation is slow and complex so we will move to static analysis which will remove a lot of the complexity the current method has.
|
||||
- A API v2 é declarativa, esconde muito do desenvolvedor e não é adequada para recursos, como múltiplas janelas. Será criada uma nova API que será mais simples, intuitiva e mais poderosa.
|
||||
- O sistema de construção é opaco e difícil de personalizar, pelo que passaremos a um sistema de construção externa que o irá abrir.
|
||||
- A geração de bindings é lenta e complexa, pelo que avançaremos para uma análise estática, que removerá grande parte da complexidade do método atual.
|
||||
|
||||
There has been a lot of work put into the guts of v2 and it's solid. It's now time to address the layer on top of it and make it a much better experience for the developer.
|
||||
Tem havido muito trabalho colocado nas entranhas da v2 e é sólido. Agora é hora de abordar a camada acima dela e torná-la uma experiência muito melhor para o desenvolvedor.
|
||||
|
||||
I hope you are as excited about this as I am. I'm looking forward to hearing your thoughts and feedback.
|
||||
Espero que você esteja tão empolgado com isso quanto eu. Estou ansioso em ouvir os seus pensamentos e sugestões.
|
||||
|
||||
Regards,
|
||||
Cumprimentos,
|
||||
|
||||
‐ Lea
|
||||
|
||||
PS: If you or your company find Wails useful, please consider [sponsoring the project](https://github.com/sponsors/leaanthony). Thanks!
|
||||
PS: Se você ou sua empresa consideram o Wails útil, considere [patrocinar o projeto](https://github.com/sponsors/leaanthony). Obrigado!
|
||||
|
||||
PPS: Yes, that's a genuine screenshot of a multi-window application built with Wails. It's not a mockup. It's real. It's awesome. It's coming soon.
|
||||
PPS: Sim, esse é um genuíno screenshot de um aplicativo com várias janelas construído com Wails. Não é uma simulação. É real. É impressionante. Está chegando.
|
@ -12,7 +12,7 @@ A [lista definitiva](https://github.com/wailsapp/awesome-wails) dos links relaci
|
||||
|
||||
## Canais de Suporte
|
||||
|
||||
- [Wails Discord Server](https://discord.gg/JDdSxwjhGf)
|
||||
- [Servidor do Discord Wails](https://discord.gg/JDdSxwjhGf)
|
||||
- [Github Issues](https://github.com/wailsapp/wails/issues)
|
||||
- [v2 Beta Discussion Board](https://github.com/wailsapp/wails/discussions/828)
|
||||
|
||||
|
@ -7,4 +7,4 @@
|
||||
</p>
|
||||
```
|
||||
|
||||
The [BulletinBoard](https://github.com/raguay/BulletinBoard) application is a versital message board for static messages or dialogs to get information from the user for a script. It has a TUI for creating new dialogs that can latter be used to get information from the user. It's design is to stay running on your system and show the information as needed and then hide away. I have a process for watching a file on my system and sending the contents to BulletinBoard when changed. It works great with my workflows. There is also an [Alfred workflow](https://github.com/raguay/MyAlfred/blob/master/Alfred%205/EmailIt.alfredworkflow) for sending information to the program. The workflow is also for working with [EmailIt](https://github.com/raguay/EmailIt).
|
||||
O aplicativo [BulletinBoard](https://github.com/raguay/BulletinBoard) é um quadro de mensagens versitais para mensagens estáticas ou diálogos para obter informações do usuário para um script. Ele tem uma TUI para criar novas caixas de diálogo que podem ser usadas por último para obter informações do usuário. É um design que fica em execução no seu sistema e mostra as informações conforme necessário e depois se esconde. Tenho um processo para assistir um arquivo no meu sistema e enviar o conteúdo para o BulletinBoard quando alterado. Funciona bem com meus fluxos de trabalho. Há também um [fluxo de trabalho Alfred](https://github.com/raguay/MyAlfred/blob/master/Alfred%205/EmailIt.alfredworkflow) para enviar informações ao programa. O fluxo de trabalho também é para trabalhar com [EmailIt](https://github.com/raguay/EmailIt).
|
||||
|
@ -7,4 +7,4 @@
|
||||
</p>
|
||||
```
|
||||
|
||||
[EmailIt](https://github.com/raguay/EmailIt/) is a Wails 2 program that is a markdown based email sender only with nine notepads, scripts to manipulate the text, and templates. It also has a scripts terminal to run scripts in EmailIt on files in your system. The scripts and templates can be used from the commandline itself or with the Alfred, Keyboard Maestro, Dropzone, or PopClip extensions. It also supports scripts and themes downloaded form GitHub. Documentation is not complete, but the programs works. It’s built using Wails2 and Svelte, and the download is a universal macOS application.
|
||||
[EmailIt](https://github.com/raguay/EmailIt/) é um programa Wails 2 que é um remetente de e-mail baseado em markdown com apenas nove notepads, scripts para manipular o texto e templates. Ele também tem um terminal para rodar scripts em EmailIt em arquivos do seu sistema. Os scripts e modelos podem ser usados na própria linha de comando ou com as extensões Alfred, Keyboard Maestro, Dropzone ou PopClip. Ele também suporta scripts e temas baixados no formulário GitHub. A documentação não está completa, mas os programas funcionam. É construído usando Wails2 e Svelte, e o download é um aplicativo macOS universal.
|
||||
|
@ -13,4 +13,4 @@ O Utilitário de Exportação FileHound permite os admnistradores FileHound a ca
|
||||
|
||||
Backend construído com: Go 1.15 Wails 1.11.0 go-sqlite3 1.14.6 go-linq 3.2
|
||||
|
||||
Frontend with: Vue 2.6.11 Vuex 3.4.0 TypeScript Tailwind 1.9.6
|
||||
Frontend com: Vue 2.6.11 Vuex 3.4.0 TypeScript Tailwind 1.9.6
|
||||
|
@ -7,4 +7,4 @@
|
||||
</p>
|
||||
```
|
||||
|
||||
[hiposter](https://github.com/obity/hiposter) is a simple and efficient http API testing client tool. Based on Wails, Go and sveltejs.
|
||||
[hiposter](https://github.com/obity/hiposter) é uma ferramenta simples e eficiente de teste de cliente http API. Baseado em Wails, Go and sveltejs.
|
||||
|
@ -9,6 +9,6 @@
|
||||
</p>
|
||||
```
|
||||
|
||||
[Gerenciador de Arquivos Modal](https://github.com/raguay/ModalFileManager) é um gerenciador de arquivos dual pane usando tecnologias da web. Meu design original foi baseado em NW.js e pode ser encontrado [aqui](https://github.com/raguay/ModalFileManager-NWjs). Esta versão usa o mesmo código de frontend baseado em Svelte (mas foi muito modificado desde a partida do NW.), mas o backend implementado com [Wails 2](https://wails.io/). By using this implementation, I no longer use command line `rm`, `cp`, etc. commands, but a git install has to be on the system to download themes and extensions. Está totalmente codificado usando Go e roda muito mais rápido do que as versões anteriores.
|
||||
[Gerenciador de Arquivos Modal](https://github.com/raguay/ModalFileManager) é um gerenciador de arquivos dual pane usando tecnologias da web. Meu design original foi baseado em NW.js e pode ser encontrado [aqui](https://github.com/raguay/ModalFileManager-NWjs). Esta versão usa o mesmo código de frontend baseado em Svelte (mas foi muito modificado desde a partida do NW.), mas o backend implementado com [Wails 2](https://wails.io/). Ao usar esta implementação, não uso mais comandos de linha de comando `rm`, `cp`, etc., mas um git install deve estar no sistema para baixar temas e extensões. Está totalmente codificado usando Go e roda muito mais rápido do que as versões anteriores.
|
||||
|
||||
Este gerenciador de arquivos é projetado em torno do mesmo princípio do Vim: uma ação controlada pelo teclado. O número de estados não é fixo, mas muito programável. Portanto, um número infinito de configurações de teclado pode ser criado e usado. Esta é a principal diferença em relação a outros gerenciadores de arquivos. There are themes and extensions available to download from GitHub.
|
||||
Este gerenciador de arquivos é projetado em torno do mesmo princípio do Vim: uma ação controlada pelo teclado. O número de estados não é fixo, mas muito programável. Portanto, um número infinito de configurações de teclado pode ser criado e usado. Esta é a principal diferença em relação a outros gerenciadores de arquivos. Existem temas e extensões disponíveis para download do GitHub.
|
||||
|
@ -7,4 +7,4 @@
|
||||
</p>
|
||||
```
|
||||
|
||||
[ScriptBar](https://GitHub.com/raguay/ScriptBarApp) is a program to show the output of scripts or [Node-Red](https://nodered.org) server. It runs scripts defined in EmailIt program and shows the output. Scripts from xBar or TextBar can be used, but currently on the TextBar scripts work well. Também exibe a saída de scripts no seu sistema. ScriptBar não os coloca na barra de menus, mas os tenha todos em uma janela convidada para fácil visualização. Você pode ter várias abas para ter muitas coisas diferentes mostradas. Você também pode manter os links para os sites mais visitados.
|
||||
[ScriptBar](https://GitHub.com/raguay/ScriptBarApp) é um programa que mostra a saída dos scripts ou o servidor [Node-Red](https://nodered.org). Ele executa scripts definidos no programa EmailIt e mostra a saída. Scripts de xBar ou TextBar podem ser usados, mas atualmente em scripts da TextBar funcionam bem. Também exibe a saída de scripts no seu sistema. ScriptBar não os coloca na barra de menus, mas os tenha todos em uma janela convidada para fácil visualização. Você pode ter várias abas para ter muitas coisas diferentes mostradas. Você também pode manter os links para os sites mais visitados.
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Minecraft launcher for WarMine
|
||||
# Launcher Minecraft para WarMine
|
||||
|
||||
```mdx-code-block
|
||||
<p style={{ "text-align": "center" }}>
|
||||
@ -12,8 +12,8 @@
|
||||
</p>
|
||||
```
|
||||
|
||||
[Minecraft launcher for WarMine](https://warmine.ru/) is a Wails application, that allows you to easily join modded game servers and manage your game accounts.
|
||||
[Minecraft Launcher para WarMine](https://warmine.ru/) é uma aplicação Wails que permite que você entre nos servidores de jogos modificados facilmente e gerencie suas contas de jogo.
|
||||
|
||||
The Launcher downloads the game files, checks their integrity and launches the game with a wide range of customization options for the launch arguments from the backend.
|
||||
O Launcher baixa os arquivos do jogo, verifica sua integridade e lança o jogo com uma grande variedade de opções de personalização para os argumentos de lançamento pelo backend.
|
||||
|
||||
Frontend is written in Svelte, whole launcher fits in 9MB and supports Windows 7-11.
|
||||
Frontend está escrito em Svelte, todo o launcher se enquadra em 9MB e suporta Windows 7-11.
|
||||
|
@ -25,13 +25,13 @@ Se você não tiver certeza sobre um template, inspecione `package.json` e `wail
|
||||
- [wails-template-vue](https://github.com/misitebao/wails-template-vue) - Wails template based on Vue ecology (Integrated TypeScript, Dark theme, Internationalization, Single page routing, TailwindCSS)
|
||||
- [wails-vite-vue-ts](https://github.com/codydbentley/wails-vite-vue-ts) - Vue 3 TypeScript with Vite (and instructions to add features)
|
||||
- [wails-vite-vue-the-works](https://github.com/codydbentley/wails-vite-vue-the-works) - Vue 3 TypeScript with Vite, Vuex, Vue Router, Sass, and ESLint + Prettier
|
||||
- [wails-template-quasar-js](https://github.com/sgosiaco/wails-template-quasar-js) - A template using JavaScript + Quasar V2 (Vue 3, Vite, Sass, Pinia, ESLint, Prettier)
|
||||
- [wails-template-quasar-ts](https://github.com/sgosiaco/wails-template-quasar-ts) - A template using TypeScript + Quasar V2 (Vue 3, Vite, Sass, Pinia, ESLint, Prettier, Composition API with <script setup>)
|
||||
- [wails-template-naive](https://github.com/tk103331/wails-template-naive) - Wails template based on Naive UI (A Vue 3 Component Library)
|
||||
- [wails-template-quasar-js](https://github.com/sgosiaco/wails-template-quasar-js) - Um template usando JavaScript + Quasar V2 (Vue 3, Vite, Sass, Pinia, ESLint, Prettier)
|
||||
- [wails-template-quasar-ts](https://github.com/sgosiaco/wails-template-quasar-ts) - Um modelo usando TypeScript + Quasar V2 (Vue 3, Vite, Sass, Pinia, ESLint, Prettier, API de composição com <configuração de script>)
|
||||
- [wails-template-naive](https://github.com/tk103331/wails-template-naive) - Modelo de ervas baseado em Naive UI (biblioteca de componentes Vue 3)
|
||||
|
||||
## Angular
|
||||
|
||||
- [wails-template-angular](https://github.com/mateothegreat/wails-template-angular) - Angular 15+ action packed & ready to roll to production.
|
||||
- [A-modelo de wails-angular](https://github.com/mateothegreat/wails-template-angular) - ação Angular 15 + compactada & pronta para ser rolada para produção.
|
||||
- [wails-angular-template](https://github.com/TAINCER/wails-angular-template) - Angular with TypeScript, Sass, Hot-Reload, Code-Splitting and i18n
|
||||
|
||||
## React
|
||||
@ -40,26 +40,30 @@ Se você não tiver certeza sobre um template, inspecione `package.json` e `wail
|
||||
- [wails-react-template](https://github.com/flin7/wails-react-template) - A minimal template for React that supports live development
|
||||
- [wails-template-nextjs](https://github.com/LGiki/wails-template-nextjs) - A template using Next.js and TypeScript
|
||||
- [wails-vite-react-ts-tailwind-template](https://github.com/hotafrika/wails-vite-react-ts-tailwind-template) - A template for React + TypeScript + Vite + TailwindCSS
|
||||
- [wails-vite-react-ts-tailwind-shadcnui-template](https://github.com/Mahcks/wails-vite-react-tailwind-shadcnui-ts) - A template with Vite, React, TypeScript, TailwindCSS, and shadcn/ui
|
||||
- [wails-vite-react-ts-tailwind-shadcnui-template](https://github.com/Mahcks/wails-vite-react-tailwind-shadcnui-ts) - Um modelo com Vite, React, TypeScript, TailwindCSS, e shadcn/ui
|
||||
|
||||
## Svelte
|
||||
|
||||
- [wails-svelte-template](https://github.com/raitonoberu/wails-svelte-template) - A template using Svelte
|
||||
- [wails-vite-svelte-template](https://github.com/BillBuilt/wails-vite-svelte-template) - A template using Svelte and Vite
|
||||
- [wails-vite-svelte-tailwind-template](https://github.com/BillBuilt/wails-vite-svelte-tailwind-template) - A template using Svelte and Vite with TailwindCSS v3
|
||||
- [wails-svelte-tailwind-vite-template](https://github.com/PylotLight/wails-vite-svelte-tailwind-template/tree/master) - An updated template using Svelte v4.2.0 and Vite with TailwindCSS v3.3.3
|
||||
- [wails-svelte-tailwind-vite-template](https://github.com/PylotLight/wails-vite-svelte-tailwind-template/tree/master) - Um modelo atualizado usando Svelte v4.2.0 e Vite com TailwindCSS v3.3.3
|
||||
- [wails-sveltekit-template](https://github.com/h8gi/wails-sveltekit-template) - A template using SvelteKit
|
||||
|
||||
## Solid
|
||||
|
||||
- [wails-template-vite-solid-ts](https://github.com/xijaja/wails-template-solid-ts) - A template using Solid + Ts + Vite
|
||||
- [wails-template-vite-solid-js](https://github.com/xijaja/wails-template-solid-js) - A template using Solid + Js + Vite
|
||||
- [wails-template-vite-solid-ts](https://github.com/xijaja/wails-template-solid-ts) - Um modelo usando Sólido + Ts + Vite
|
||||
- [wails-template-vite-solid-js](https://github.com/xijaja/wails-template-solid-js) - Um modelo usando Sólid + Js + Vite
|
||||
|
||||
## Elm
|
||||
|
||||
- [wails-elm-template](https://github.com/benjamin-thomas/wails-elm-template) - Develop your GUI app with functional programming and a **snappy** hot-reload setup :tada: :rocket:
|
||||
- [wails-template-elm-tailwind](https://github.com/rnice01/wails-template-elm-tailwind) - Combine the powers :muscle: of Elm + Tailwind CSS + Wails! Hot reloading supported.
|
||||
|
||||
## HTMX
|
||||
|
||||
- [wails-htmx-templ-chi-tailwind](https://github.com/PylotLight/wails-hmtx-templ-template) - Use a unique combination of pure htmx for interactivity plus templ for creating components and forms
|
||||
|
||||
## Pure JavaScript (Vanilla)
|
||||
|
||||
- [wails-pure-js-template](https://github.com/KiddoV/wails-pure-js-template) - A template with nothing but just basic JavaScript, HTML, and CSS
|
||||
|
@ -7,7 +7,7 @@ sidebar_position: 5
|
||||
Você pode executar sua aplicação no modo de desenvolvimento executando `wails dev` no diretório do seu projeto. Isso fará o seguinte:
|
||||
|
||||
- Construa seu aplicativo e o execute
|
||||
- Bind your Go code to the frontend so it can be called from JavaScript
|
||||
- Vincule seu código Go para o frontend para que ele possa ser chamado a partir de JavaScript
|
||||
- Usando o poder do [Vite](https://vitejs.dev/), observará modificações em seus arquivos Go e reconstruir/re-executar na alteração
|
||||
- Configure um [servidor web](http://localhost:34115) que irá servir seu aplicativo em um navegador. Isso permite usar suas extensões de navegador favoritas. Você pode até mesmo chamar seu código Go do console
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
# Angular
|
||||
|
||||
Whilst Wails does not have an Angular template, it is possible to use Angular with Wails.
|
||||
Embora as Wails não tenham um modelo angular, é possível usar Angular com Wails.
|
||||
|
||||
## Dev Mode
|
||||
## Modo Desenvolvedor
|
||||
|
||||
To get dev mode working with Angular, you need to add the following to your `wails.json`:
|
||||
Para que o modo de desenvolvimento funcione com Angular, você precisa adicionar o seguinte ao seu `wails.json`:
|
||||
|
||||
```json
|
||||
"frontend:build": "npx ng build",
|
||||
|
@ -189,16 +189,16 @@ O servidor de desenvolvimento utiliza uma técnica chamada "debwaring" que signi
|
||||
|
||||
Alguns frameworks vêm com seu próprio servidor ao vivo, no entanto, eles não serão capazes de tirar proveito das ligações Go/Wails. Neste cenário, é melhor executar um script de observador que reconstrui o projeto no diretório build, que Wails estará assistindo. Por exemplo, veja o modelo padrão do svelte que usa [rollup](https://rollupjs.org/guide/en/).
|
||||
|
||||
### Create React App
|
||||
### Criar Aplicativo React
|
||||
|
||||
The process for a Create-React-App project is slightly more complicated. In order to support live frontend reloading the following configuration needs to be added to your `wails.json`:
|
||||
O processo para um projeto Create-React-App é um pouco mais complicado. Para ajudar o frontend a recarregar ao vivo a seguinte configuração precisa ser adicionado ao seu `wails.json`:
|
||||
|
||||
```json
|
||||
"frontend:dev:watcher": "yarn start",
|
||||
"frontend:dev:serverUrl": "http://localhost:3000",
|
||||
```
|
||||
|
||||
The `frontend:dev:watcher` command will start the Create-React-App development server (hosted on port `3000` typically). The `frontend:dev:serverUrl` command then instructs Wails to serve assets from the development server when loading the frontend rather than from the build folder. In addition to the above, the `index.html` needs to be updated with the following:
|
||||
O comando `frontend: dev:watcher` iniciará o servidor de desenvolvimento Create-React-App (hospedado na porta `3000` normalmente). O comando `frontend: dev:serverUrl` e instrui a Wails a servir assets do servidor de desenvolvimento ao carregar o frontend em vez de a partir da pasta de compilação. Além do acima acima o `index.html` precisa ser atualizado com o seguinte:
|
||||
|
||||
```html
|
||||
<head>
|
||||
@ -208,7 +208,7 @@ The `frontend:dev:watcher` command will start the Create-React-App development s
|
||||
</head>
|
||||
```
|
||||
|
||||
This is required as the watcher command that rebuilds the frontend prevents Wails from injecting the required scripts. This circumvents that issue by ensuring the scripts are always injected. With this configuration, `wails dev` can be run which will appropriately build the frontend and backend with hot-reloading enabled. Additionally, when accessing the application from a browser the React developer tools can now be used on a non-minified version of the application for straightforward debugging. Finally, for faster builds, `wails dev -s` can be run to skip the default building of the frontend by Wails as this is an unnecessary step.
|
||||
Isso é necessário pois o comando do observador que reconstrui o frontend impede que o Wails injete os scripts necessários. Isso contorna esse problema garantindo os scripts são sempre injetados. Com esta configuração, `ondas de desenvolvimento` pode ser executado, o que irá construir adequadamente o frontend e o backend com o carregamento de quente ativado. Além disso, ao acessar o aplicativo a partir de um navegador, as ferramentas de desenvolvedor do React agora podem ser usadas em uma versão não minificada do aplicativo para simplificar depuração. Finalmente, para compilações mais rápidas, `wail dev -s` pode ser executado para ignorar o edifício padrão do frontend pelas Wails, pois este é um passo desnecessário.
|
||||
|
||||
## Go Module
|
||||
|
||||
|
@ -0,0 +1,66 @@
|
||||
# Crossplatform build with Github Actions
|
||||
|
||||
To build a Wails project for all the available platforms, you need to create an application build for each operating system. One effective method to achieve this is by utilizing GitHub Actions.
|
||||
|
||||
An action that facilitates building a Wails app is available at:
|
||||
https://github.com/dAppServer/wails-build-action
|
||||
|
||||
In case the existing action doesn't fulfill your requirements, you can select only the necessary steps from the source:
|
||||
https://github.com/dAppServer/wails-build-action/blob/main/action.yml
|
||||
|
||||
Below is a comprehensive example that demonstrates building an app upon the creation of a new Git tag and subsequently uploading it to the Actions artifacts:
|
||||
|
||||
```yaml
|
||||
name: Wails build
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
# Match any new tag
|
||||
- '*'
|
||||
|
||||
env:
|
||||
# Necessary for most environments as build failure can occur due to OOM issues
|
||||
NODE_OPTIONS: "--max-old-space-size=4096"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
# Failure in one platform build won't impact the others
|
||||
fail-fast: false
|
||||
matrix:
|
||||
build:
|
||||
- name: 'App'
|
||||
platform: 'linux/amd64'
|
||||
os: 'ubuntu-latest'
|
||||
- name: 'App'
|
||||
platform: 'windows/amd64'
|
||||
os: 'windows-latest'
|
||||
- name: 'App'
|
||||
platform: 'darwin/universal'
|
||||
os: 'macos-latest'
|
||||
|
||||
runs-on: ${{ matrix.build.os }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Build wails
|
||||
uses: dAppServer/wails-build-action@v2.2
|
||||
id: build
|
||||
with:
|
||||
build-name: ${{ matrix.build.name }}
|
||||
build-platform: ${{ matrix.build.platform }}
|
||||
package: false
|
||||
go-version: '1.20'
|
||||
```
|
||||
|
||||
This example offers opportunities for various enhancements, including:
|
||||
|
||||
- Caching dependencies
|
||||
- Code signing
|
||||
- Uploading to platforms like S3, Supbase, etc.
|
||||
- Injecting secrets as environment variables
|
||||
- Utilizing environment variables as build variables (such as version variable extracted from the current Git tag)
|
@ -1,12 +1,12 @@
|
||||
# Dynamic Assets
|
||||
# Recursos Dinâmicos
|
||||
|
||||
If you want to load or generate assets for your frontend dynamically, you can achieve that using the [AssetsHandler](../reference/options#assetshandler) option. The AssetsHandler is a generic `http.Handler` which will be called for any non GET request on the assets server and for GET requests which can not be served from the bundled assets because the file is not found.
|
||||
Se você deseja carregar ou gerar assets para seu frontend de forma dinâmica, você pode conseguir isso usando a opção [AssetsHandler](../reference/options#assetshandler). O AssetsHandler é um `http.Handler` genérico que irá ser chamado para qualquer solicitação não GET no servidor de ativos e para solicitações GET que não podem ser atendidas pelo ativos agrupados porque o arquivo não foi encontrado.
|
||||
|
||||
By installing a custom AssetsHandler, you can serve your own assets using a custom asset server.
|
||||
Ao instalar um AssetsHandler personalizado, você pode servir seus próprios assets usando um servidor de arquivos personalizado.
|
||||
|
||||
## Example
|
||||
## Exemplo
|
||||
|
||||
In our example project, we will create a simple assets handler which will load files off disk:
|
||||
Em nosso projeto de exemplo, vamos criar um gerenciador de arquivos simples que irá carregar arquivos fora do disco:
|
||||
|
||||
```go title=main.go {17-36,49}
|
||||
package main
|
||||
@ -72,7 +72,7 @@ func main() {
|
||||
}
|
||||
```
|
||||
|
||||
When we run the application in dev mode using `wails dev`, we will see the following output:
|
||||
Quando executarmos o aplicativo no modo de desenvolvimento usando `wail dev`, veremos a seguinte saída:
|
||||
|
||||
```
|
||||
DEB | [ExternalAssetHandler] Loading 'http://localhost:3001/favicon.ico'
|
||||
@ -80,15 +80,15 @@ DEB | [ExternalAssetHandler] Loading 'http://localhost:3001/favicon.ico' failed,
|
||||
Requesting file: favicon.ico
|
||||
```
|
||||
|
||||
As you can see, the assets handler is called when the default assets server is unable to serve the `favicon.ico` file.
|
||||
Como você pode ver, o manipulador de assets é chamado quando o servidor de assets padrão não consegue servir o arquivo `favicon.ico`.
|
||||
|
||||
If you right click the main application and select "inspect" to bring up the devtools, you can test this feature out by typing the following into the console:
|
||||
Se você clicar com o botão direito no aplicativo principal e selecionar "inspeção" para abrir as devtools, você pode testar esta função digitando o seguinte no console:
|
||||
|
||||
```
|
||||
let response = await fetch('does-not-exist.txt');
|
||||
```
|
||||
|
||||
This will generate an error in the devtools. We can see that the error is what we expect, returned by our custom assets handler:
|
||||
Isto irá gerar um erro no devtools. Podemos ver que o erro é o que esperamos, retornado por nosso manipulador de ativos personalizados:
|
||||
|
||||
```mdx-code-block
|
||||
<p className="text--center">
|
||||
@ -98,7 +98,7 @@ This will generate an error in the devtools. We can see that the error is what w
|
||||
</p>
|
||||
```
|
||||
|
||||
However, if we request `go.mod`, we will see the following output:
|
||||
No entanto, se requisitarmos `go.mod`, veremos a seguinte saída:
|
||||
|
||||
```mdx-code-block
|
||||
<p className="text--center">
|
||||
@ -106,19 +106,19 @@ However, if we request `go.mod`, we will see the following output:
|
||||
</p>
|
||||
```
|
||||
|
||||
This technique can be used to load images directly into the page. If we updated our default vanilla template and replaced the logo image:
|
||||
Esta técnica pode ser usada para carregar imagens diretamente para a página. Se atualizarmos nosso modelo padrão do vanilla e substituirmos a imagem do logotipo:
|
||||
|
||||
```html
|
||||
<img id="logo" class="logo" />
|
||||
```
|
||||
|
||||
with:
|
||||
com:
|
||||
|
||||
```html
|
||||
<img src="build/appicon.png" style="width: 300px" />
|
||||
```
|
||||
|
||||
Then we would see the following:
|
||||
Veremos então o seguinte:
|
||||
|
||||
```mdx-code-block
|
||||
<p className="text--center">
|
||||
@ -131,6 +131,6 @@ Then we would see the following:
|
||||
|
||||
:::warning
|
||||
|
||||
Exposing your filesystem in this way is a security risk. It is recommended that you properly manage access to your filesystem.
|
||||
Expor seu sistema de arquivos desta forma é um risco à segurança. É recomendável que você gerencie corretamente o acesso ao seu sistema de arquivos.
|
||||
|
||||
:::
|
||||
|
@ -0,0 +1,199 @@
|
||||
# File Association
|
||||
|
||||
File association feature allows you to associate specific file types with your app so that when users open those files,
|
||||
your app is launched to handle them. This can be particularly useful for text editors, image viewers, or any application
|
||||
that works with specific file formats. In this guide, we'll walk through the steps to implement file association in Wails app.
|
||||
|
||||
## Set Up File Association:
|
||||
|
||||
To set up file association, you need to modify your application's wails.json file.
|
||||
In "info" section add a "fileAssociations" section specifying the file types your app should be associated with.
|
||||
|
||||
For example:
|
||||
|
||||
```json
|
||||
{
|
||||
"info": {
|
||||
"fileAssociations": [
|
||||
{
|
||||
"ext": "wails",
|
||||
"name": "Wails",
|
||||
"description": "Wails Application File",
|
||||
"iconName": "wailsFileIcon",
|
||||
"role": "Editor"
|
||||
},
|
||||
{
|
||||
"ext": "jpg",
|
||||
"name": "JPEG",
|
||||
"description": "Image File",
|
||||
"iconName": "jpegFileIcon",
|
||||
"role": "Editor"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
| Property | Description |
|
||||
| :---------- | :------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| ext | The extension (minus the leading period). e.g. png |
|
||||
| name | The name. e.g. PNG File |
|
||||
| iconName | The icon name without extension. Icons should be located in build folder. Proper icons will be generated from .png file for both macOS and Windows |
|
||||
| description | Windows-only. The description. It is displayed on the `Type` column on Windows Explorer. |
|
||||
| role | macOS-only. The app’s role with respect to the type. Corresponds to CFBundleTypeRole. |
|
||||
|
||||
## Platform Specifics:
|
||||
|
||||
### macOS
|
||||
|
||||
When you open file (or files) with your app, the system will launch your app and call the `OnFileOpen` function in your Wails app. Example:
|
||||
|
||||
```go title="main.go"
|
||||
func main() {
|
||||
// Create application with options
|
||||
err := wails.Run(&options.App{
|
||||
Title: "wails-open-file",
|
||||
Width: 1024,
|
||||
Height: 768,
|
||||
AssetServer: &assetserver.Options{
|
||||
Assets: assets,
|
||||
},
|
||||
BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1},
|
||||
Mac: &mac.Options{
|
||||
OnFileOpen: func(filePaths []string) { println(filestring) },
|
||||
},
|
||||
Bind: []interface{}{
|
||||
app,
|
||||
},
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
println("Error:", err.Error())
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Windows
|
||||
|
||||
On Windows file association is supported only with NSIS installer. During installation, the installer will create a
|
||||
registry entry for your file associations. When you open file with your app, new instance of app is launched and file path is passed
|
||||
as argument to your app. To handle this you should parse command line arguments in your app. Example:
|
||||
|
||||
```go title="main.go"
|
||||
func main() {
|
||||
argsWithoutProg := os.Args[1:]
|
||||
|
||||
if len(argsWithoutProg) != 0 {
|
||||
println("launchArgs", argsWithoutProg)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Linux
|
||||
|
||||
Currently, Wails doesn't support bundling for Linux. So, you need to create file associations manually.
|
||||
For example if you distribute your app as a .deb package, you can create file associations by adding required files in you bundle.
|
||||
You can use [nfpm](https://nfpm.goreleaser.com/) to create .deb package for your app.
|
||||
|
||||
1. Create a .desktop file for your app and specify file associations there. Example:
|
||||
|
||||
```ini
|
||||
[Desktop Entry]
|
||||
Categories=Office
|
||||
Exec=/usr/bin/wails-open-file %u
|
||||
Icon=wails-open-file.png
|
||||
Name=wails-open-file
|
||||
Terminal=false
|
||||
Type=Application
|
||||
MimeType=application/x-wails;application/x-test
|
||||
```
|
||||
|
||||
2. Create mime types file. Example:
|
||||
|
||||
```xml
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
|
||||
<mime-type type="application/x-wails">
|
||||
<comment>Wails Application File</comment>
|
||||
<glob pattern="*.wails"/>
|
||||
</mime-type>
|
||||
</mime-info>
|
||||
```
|
||||
|
||||
3. Create icons for your file types. SVG icons are recommended.
|
||||
4. Prepare postInstall/postRemove scripts for your package. Example:
|
||||
|
||||
```sh
|
||||
# reload mime types to register file associations
|
||||
update-mime-database /usr/share/mime
|
||||
# reload desktop database to load app in list of available
|
||||
update-desktop-database /usr/share/applications
|
||||
# update icons
|
||||
update-icon-caches /usr/share/icons/*
|
||||
```
|
||||
|
||||
5. Configure nfpm to use your scripts and files. Example:
|
||||
|
||||
```yaml
|
||||
name: "wails-open-file"
|
||||
arch: "arm64"
|
||||
platform: "linux"
|
||||
version: "1.0.0"
|
||||
section: "default"
|
||||
priority: "extra"
|
||||
maintainer: "FooBarCorp <FooBarCorp@gmail.com>"
|
||||
description: "Sample Package"
|
||||
vendor: "FooBarCorp"
|
||||
homepage: "http://example.com"
|
||||
license: "MIT"
|
||||
contents:
|
||||
- src: ../bin/wails-open-file
|
||||
dst: /usr/bin/wails-open-file
|
||||
- src: ./main.desktop
|
||||
dst: /usr/share/applications/wails-open-file.desktop
|
||||
- src: ./application-wails-mime.xml
|
||||
dst: /usr/share/mime/packages/application-x-wails.xml
|
||||
- src: ./application-test-mime.xml
|
||||
dst: /usr/share/mime/packages/application-x-test.xml
|
||||
- src: ../appicon.svg
|
||||
dst: /usr/share/icons/hicolor/scalable/apps/wails-open-file.svg
|
||||
- src: ../wailsFileIcon.svg
|
||||
dst: /usr/share/icons/hicolor/scalable/mimetypes/application-x-wails.svg
|
||||
- src: ../testFileIcon.svg
|
||||
dst: /usr/share/icons/hicolor/scalable/mimetypes/application-x-test.svg
|
||||
# copy icons to Yaru theme as well. For some reason Ubuntu didn't pick up fileicons from hicolor theme
|
||||
- src: ../appicon.svg
|
||||
dst: /usr/share/icons/Yaru/scalable/apps/wails-open-file.svg
|
||||
- src: ../wailsFileIcon.svg
|
||||
dst: /usr/share/icons/Yaru/scalable/mimetypes/application-x-wails.svg
|
||||
- src: ../testFileIcon.svg
|
||||
dst: /usr/share/icons/Yaru/scalable/mimetypes/application-x-test.svg
|
||||
scripts:
|
||||
postinstall: ./postInstall.sh
|
||||
postremove: ./postRemove.sh
|
||||
```
|
||||
|
||||
6. Build your .deb package using nfpm:
|
||||
|
||||
```sh
|
||||
nfpm pkg --packager deb --target .
|
||||
```
|
||||
|
||||
7. Now when your package is installed, your app will be associated with specified file types. When you open file with your app,
|
||||
new instance of app is launched and file path is passed as argument to your app.
|
||||
To handle this you should parse command line arguments in your app. Example:
|
||||
|
||||
```go title="main.go"
|
||||
func main() {
|
||||
argsWithoutProg := os.Args[1:]
|
||||
|
||||
if len(argsWithoutProg) != 0 {
|
||||
println("launchArgs", argsWithoutProg)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Limitations:
|
||||
|
||||
On Windows and Linux when associated file is opened, new instance of your app is launched.
|
||||
Currently, Wails doesn't support opening files in already running app. There is plugin for single instance support for v3 in development.
|
@ -1,8 +1,8 @@
|
||||
# Frameless Applications
|
||||
# Aplicações sem frames
|
||||
|
||||
Wails supports application that have no frames. This can be achieved by using the [frameless](../reference/options.mdx#frameless) field in [Application Options](../reference/options.mdx#application-options).
|
||||
O Wails suporta aplicativos que não possuem frames. Isso pode ser conseguido usando o campo [sem frameless](../reference/options.mdx#frameless) no [Application Options](../reference/options.mdx#application-options).
|
||||
|
||||
Wails offers a simple solution for dragging the window: Any HTML element that has the CSS style `--wails-draggable:drag` will act as a "drag handle". This property applies to all child elements. If you need to indicate that a nested element should not drag, then use the attribute '--wails-draggable:no-drag' on that element.
|
||||
Wails oferece uma solução simples para arrastar a janela: qualquer elemento HTML que tenha o estilo CSS `--wails-draggable:drag` irá atuar como uma "alça de arrastar". Esta propriedade se aplica a todos os elementos filhos. Se você precisar indicar que um elemento aninhado não deve arrastar, então use o atributo '--wails-draggable:no-drag' nesse elemento.
|
||||
|
||||
```html
|
||||
<html>
|
||||
@ -23,7 +23,7 @@ Wails offers a simple solution for dragging the window: Any HTML element that ha
|
||||
</html>
|
||||
```
|
||||
|
||||
For some projects, using a CSS variable may not be possible due to dynamic styling. In this case, you can use the `CSSDragProperty` and `CSSDragValue` application options to define a property and value that will be used to indicate draggable regions:
|
||||
Para alguns projetos, usar uma variável CSS pode não ser possível devido a um estilo dinâmico. Neste caso, você pode usar o aplicativo `CSSDragProperty` e `CSSDragValue` opções para definir uma propriedade e valor que serão usados para indicar regiões arrastáveis:
|
||||
|
||||
```go title=main.go
|
||||
package main
|
||||
@ -80,8 +80,8 @@ func main() {
|
||||
</html>
|
||||
```
|
||||
|
||||
:::info Fullscreen
|
||||
:::info Tela Cheia
|
||||
|
||||
If you allow your application to go fullscreen, this drag functionality will be disabled.
|
||||
Se você permitir que seu aplicativo vá para tela cheia, esta funcionalidade de arrastar será desativada.
|
||||
|
||||
:::
|
||||
|
@ -1,36 +1,36 @@
|
||||
# Local Development
|
||||
# Desenvolvimento Local
|
||||
|
||||
## Overview
|
||||
## Visão geral
|
||||
|
||||
Wails is in constant development and new releases are regularly "tagged". This usually happens when all the newer code on `master` has been tested and confirmed working. If you need a bugfix or feature that has not yet made it to a release, it's possible to use the latest "bleeding edge" version using the following steps:
|
||||
Os dispositivos estão em constante desenvolvimento e novos lançamentos são regularmente "marcados". Isso geralmente acontece quando todo o código no `master` foi testado e confirmado funcionando. Se você precisar de uma correção de bug ou recurso que ainda não foi lançado, é possível usar a versão mais recente "bleeding edge" seguindo as seguintes etapas:
|
||||
|
||||
- `git clone https://github.com/wailsapp/wails`
|
||||
- `cd wails/v2/cmd/wails`
|
||||
- `go install`
|
||||
|
||||
NOTE: The directory that you cloned the project into will now be called "clonedir".
|
||||
NOTA: O diretório para o qual você clonou o projeto será agora chamado de "clonedir".
|
||||
|
||||
The Wails CLI will now be at the very latest version.
|
||||
A CLI do Wails estará na versão mais recente.
|
||||
|
||||
### Updating your project
|
||||
### Atualizando seu projeto
|
||||
|
||||
To update projects to use the latest version of the Wails library, update the project's `go.mod` and ensure the following line is at the bottom of the file:
|
||||
Para atualizar projetos para usar a versão mais recente da biblioteca Wails, atualize o `do projeto. od` e certifique-se que a seguinte linha está no final do arquivo:
|
||||
|
||||
`replace github.com/wailsapp/wails/v2 => <clonedir>`
|
||||
|
||||
Example:
|
||||
Exemplo:
|
||||
|
||||
On Windows: `replace github.com/wailsapp/wails/v2 => C:\Users\leaan\Documents\wails-v2-beta\wails\v2`
|
||||
Windows: `substitua github.com/wailsapp/wails/v2 => C:\Users\leaan\Documents\wails-v2-beta\wails\v2`
|
||||
|
||||
On 'nix: `replace github.com/wailsapp/wails/v2 => /home/me/projects/wails/v2`
|
||||
Em 'nix: `substitui github.com/wailsapp/wails/v2 => /home/me/projects/wails/v2`
|
||||
|
||||
To revert to a stable version, run:
|
||||
Para reverter para uma versão estável, execute:
|
||||
|
||||
`go install github.com/wailsapp/wails/v2/cmd/wails@latest`
|
||||
|
||||
## Testing a Branch
|
||||
## Testando uma Branch
|
||||
|
||||
If you want to test a branch, follow the instructions above, but ensure you switch the branch you want to test before installing:
|
||||
Se você deseja testar um branch, siga as instruções acima, mas certifique-se de alternar o branch que você deseja testar antes de instalar:
|
||||
|
||||
- `git clone https://github.com/wailsapp/wails`
|
||||
- `cd wails`
|
||||
@ -38,11 +38,11 @@ If you want to test a branch, follow the instructions above, but ensure you swit
|
||||
- `cd v2/cmd/wails`
|
||||
- `go install`
|
||||
|
||||
Make sure you [update your project](#updating-your-project) as described above.
|
||||
Certifique-se de [atualizar seu projeto](#updating-your-project) conforme descrito acima.
|
||||
|
||||
## Testing a PR
|
||||
## Testando uma PR
|
||||
|
||||
If you want to test a PR, follow the instructions above, but ensure you fetch the PR and switch the branch before installing. Please replace `[IDofThePR]` with the ID of the PR shown on github.com:
|
||||
Se você deseja testar um branch, siga as instruções acima, mas certifique-se de alternar o branch que você deseja testar antes de instalar. Por favor, substitua `[IDofThePR]` pelo ID do PR mostrado no github.com:
|
||||
|
||||
- `git clone https://github.com/wailsapp/wails`
|
||||
- `cd wails`
|
||||
@ -52,4 +52,4 @@ If you want to test a PR, follow the instructions above, but ensure you fetch th
|
||||
- `cd v2/cmd/wails`
|
||||
- `go install`
|
||||
|
||||
Make sure you [update your project](#updating-your-project) as described above.
|
||||
Certifique-se de [atualizar seu projeto](#updating-your-project) conforme descrito acima.
|
||||
|
@ -1,42 +1,42 @@
|
||||
# Mac App Store Guide
|
||||
# Guia para Mac App Store
|
||||
|
||||
This page gives a brief overview of how to submit your Wails App to the Mac App Store.
|
||||
Esta página dá uma breve visão geral de como enviar seu App Wails para a Mac App Store.
|
||||
|
||||
## Prerequisites
|
||||
## Pré-requisitos
|
||||
|
||||
- You will need to have an Apple Developer account. Please find more information on the [Apple Developer Program](https://developer.apple.com/support/compare-memberships/) site
|
||||
- You will need to have your Certificates, Identifiers, and App created on the developer portal. More on this below
|
||||
- Xcode command line tools will need to be installed on your local machine
|
||||
- Você precisará ter uma conta para o Apple Develop. Encontre mais informações no site [do Programa de Desenvolvedor Apple](https://developer.apple.com/support/compare-memberships/)
|
||||
- Você precisará ter seus Certificados, Identificadores e App criados no portal de desenvolvimento. Mais sobre isto abaixo
|
||||
- Ferramentas de linha de comando Xcode precisarão ser instaladas na sua máquina local
|
||||
|
||||
#### Create Certificates and Identifiers
|
||||
#### Criar certificados e identificadores
|
||||
|
||||
1. Go to your [Apple Developer Account](https://developer.apple.com/account/)
|
||||
2. Under `Certificates, Identifiers & Profiles`, click `Identifiers` and Register a New App ID. Use the format (com.example.app)
|
||||
3. Under the same page click `Certificates` and generate new Certificates for Mac App Store Distribution. Download them and import the certificates into Keychain on your local machine.
|
||||
1. Vá para sua [Conta de desenvolvedor Apple](https://developer.apple.com/account/)
|
||||
2. Sob `Certificados, Identificadores & Perfis`, clique em `Identificadores` e Registrar um Novo App ID. Use o formato (com.exemplo.app)
|
||||
3. Sob a mesma página, clique `Certificados` e gere novos Certificados para a Distribuição da Loja de Aplicativos Mac. Baixe-os e importe os certificados para o Keychain em sua máquina local.
|
||||
|
||||
#### Create App Submission
|
||||
#### Criar Envio de App
|
||||
|
||||
1. Go to the [App Store Connect Site](https://appstoreconnect.apple.com/apps)
|
||||
2. Register a new application and link the bundle ID that you created in the previous step
|
||||
3. Populate your app with the correct screen shots, descriptions, etc. as required by Apple
|
||||
4. Create a new version of your app
|
||||
1. Ir para [App Store Connect Site](https://appstoreconnect.apple.com/apps)
|
||||
2. Registre um novo aplicativo e vincule o ID do pacote que você criou no passo anterior
|
||||
3. Preencher seu aplicativo com as capturas de tela corretas, descrições, etc. conforme exigido pela Apple
|
||||
4. Criar uma nova versão do seu aplicativo
|
||||
|
||||
#### Create Provisioning Profile
|
||||
1. Go to the [Apple Developer Profiles](https://developer.apple.com/account/resources/profiles/list) page
|
||||
2. Add a new provisioning profile for Mac App Store Distribution
|
||||
3. Set the Profile Type as Mac and select the App ID for the application created above
|
||||
4. Select the Mac App Distribution certificate
|
||||
5. Name the Provisioning Profile embedded and download the created profile.
|
||||
#### Criar perfil de provisionamento
|
||||
1. Vá para a página [Apple Developer Profiles](https://developer.apple.com/account/resources/profiles/list)
|
||||
2. Adicionar um novo perfil de provisionamento para Mac App Store de distribuição
|
||||
3. Defina o tipo de perfil como Mac e selecione o ID do aplicativo criado acima
|
||||
4. Selecione o certificado de Distribuição de Aplicativos Mac
|
||||
5. Nomeie o Perfil de Provisão incorporado e baixe o perfil criado.
|
||||
|
||||
## Mac App Store Process
|
||||
## Guia para Mac App Store
|
||||
|
||||
#### Enable Apple's App Sandbox
|
||||
#### Ativar a App Sandbox da Apple
|
||||
|
||||
Apps submitted to the Mac App Store must run under Apple's [App Sandbox](https://developer.apple.com/app-sandboxing/). You must create an `entitlements.plist` file for this to work. The recommendation is to create this file under this path `{PROJECT_DIR}/build/darwin/entitlements.plist`.
|
||||
Os aplicativos enviados para Mac App Store devem ser executados na [App Sandbox](https://developer.apple.com/app-sandboxing/) da Apple. Você deve criar um arquivo `entitlements.plist` para que isso funcione. A recomendação é criar este arquivo sob este caminho `{PROJECT_DIR}/build/darwin/entitlements.plist`.
|
||||
|
||||
**Example Entitlements File**
|
||||
**Exemplo de arquivo de direitos**
|
||||
|
||||
This is an example entitlements file from the [RiftShare](https://github.com/achhabra2/riftshare) app. For reference please put in the entitlements your app requires. Refer to [this site](https://developer.apple.com/documentation/bundleresources/entitlements) for more information. You will need to replace the Team ID and Application Name with the ones you registered above.
|
||||
Este é um exemplo de titularidade de arquivo do aplicativo [RiftShare](https://github.com/achhabra2/riftshare). Para referência, por favor coloque os direitos que seu aplicativo exigir. Consulte [este site](https://developer.apple.com/documentation/bundleresources/entitlements) para obter mais informações. Você precisará substituir a ID da Equipe e o Nome da Aplicação pelos que você se registrou acima.
|
||||
|
||||
```xml title="entitlements.plist"
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
@ -61,13 +61,13 @@ This is an example entitlements file from the [RiftShare](https://github.com/ach
|
||||
</plist>
|
||||
```
|
||||
|
||||
**Add the Embedded Provisioning Profile** The Provisioning Profile created above needs to be added to the root of the applicaton. It needs to be named embedded.provisionprofile.
|
||||
**Adicionar Perfil de Provisão Embutido** O Perfil de Provisionamento criado acima precisa ser adicionado à raiz da aplicação. Precisa ser nomeado como embedded.provisionprofile.
|
||||
|
||||
#### Build and Sign the App Package
|
||||
#### Construa e assine o Pacote de Aplicativos
|
||||
|
||||
The following is an example script for building and signing your app for Mac App Store submission. It assumes you are running the script from your root project directory.
|
||||
O seguinte é um exemplo de script para construir e assinar seu aplicativo para o envio da Mac App Store. Ele presume que você está executando o script do diretório do seu projeto raiz.
|
||||
|
||||
Note the certificates for signing the app and signing the installer are different. Please make sure both are imported into Keychain. Find the strings in Keychain and insert them below. Populate your certificate names, and app name below. Running the following script will generate a signed `app.pkg` file in the root directory of your app.
|
||||
Observe que os certificados para a assinatura do aplicativo e a assinatura do instalador são diferentes. Certifique-se de que ambos são importados para o Keychain. Encontre as sequências de caracteres no Keychain e insira-as abaixo. Preencha os nomes do seu certificado e o nome do app abaixo. Executar o seguinte script irá gerar um arquivo `assinado app.pkg` no diretório raiz do seu aplicativo.
|
||||
|
||||
```bash title="macappstore-build.sh"
|
||||
#!/bin/bash
|
||||
@ -85,13 +85,13 @@ codesign --timestamp --options=runtime -s "$APP_CERTIFICATE" -v --entitlements .
|
||||
productbuild --sign "$PKG_CERTIFICATE" --component ./build/bin/$APP_NAME.app /Applications ./$APP_NAME.pkg
|
||||
```
|
||||
|
||||
#### Upload App Bundle
|
||||
#### Enviar pacote de aplicativos
|
||||
|
||||
You will need to upload the generated package file and associate it to your Application before you will be able to submit it for review.
|
||||
Você precisará enviar o arquivo do pacote gerado e associá-lo à sua Aplicação antes de poder enviá-lo para revisão.
|
||||
|
||||
1. Download the [Transporter App](https://apps.apple.com/us/app/transporter/id1450874784) from the Mac App Store
|
||||
2. Open it and sign in with your Apple ID
|
||||
3. Click the + sign and select the `APP_NAME.pkg` file that you generated in the previous step. Upload it
|
||||
4. Go back to the [App Store Connect](https://appstoreconnect.apple.com/apps) site and navigate back into your app submission. Select the version that you are ready to make available on the App Store. Under `Build` select the package that you uploaded via Transporter.
|
||||
1. Baixe o [aplicativo Transporter](https://apps.apple.com/us/app/transporter/id1450874784) na Mac App Store
|
||||
2. Abra e inicie sessão com a sua Apple ID
|
||||
3. Clique no sinal + e selecione o arquivo `APP_NAME.pkg` que você gerou na etapa anterior. Carregar isto
|
||||
4. Volte para [Loja de Apps Conectar](https://appstoreconnect.apple.com/apps) e navegue de volta para a submissão de seu aplicativo. Selecione a versão que você está pronto para disponibilizar na App Store. Em `Build` selecione o pacote que você enviou via Transporter.
|
||||
|
||||
That's it! You can now use the site to submit your App for review. After a few business days if all goes well you should see your App live on the Mac App Store.
|
||||
É isso! Agora você pode usar o site para enviar seu Aplicativo para análise. Após alguns dias úteis, se tudo correr bem, você verá seu App ao vivo na Mac App Store.
|
||||
|
@ -1,14 +1,14 @@
|
||||
# Migrating from v1
|
||||
# Migrando da v1
|
||||
|
||||
## Overview
|
||||
## Visão geral
|
||||
|
||||
Wails v2 is a significant change from v1. This document aims to highlight the changes and the steps in migrating an existing project.
|
||||
Wails v2 é uma mudança significativa em relação à v1. Este documento visa destacar as mudanças e as etapas na migração de um projeto existente.
|
||||
|
||||
### Creating the Application
|
||||
### Criando uma aplicação Cli
|
||||
|
||||
In v1, the main application is created using `wails.CreateApp`, bindings are added with `app.Bind`, then the application is run using `app.Run()`.
|
||||
Na v1, o aplicativo principal é criado usando `wails.CreateApp`, as ligações são adicionadas com `app.Bind` e, em seguida, o o aplicativo é executado usando `app.Run()`.
|
||||
|
||||
Example:
|
||||
Exemplo:
|
||||
|
||||
```go title="v1"
|
||||
app := wails.CreateApp(&wails.AppConfig{
|
||||
@ -23,7 +23,7 @@ Example:
|
||||
app.Run()
|
||||
```
|
||||
|
||||
In v2, there is just a single method, `wails.Run()`, that accepts [application options](../reference/options.mdx#application-options).
|
||||
Na v2, há apenas um único método, `wails.Run()`, que aceita as opções de aplicação [](../reference/options.mdx#application-options).
|
||||
|
||||
```go title="v2"
|
||||
err := wails.Run(&options.App{
|
||||
@ -39,9 +39,9 @@ In v2, there is just a single method, `wails.Run()`, that accepts [application o
|
||||
})
|
||||
```
|
||||
|
||||
### Binding
|
||||
### Mapeamento
|
||||
|
||||
In v1, it was possible to bind both arbitrary functions and structs. In v2, this has been simplified to only binding structs. The struct instances that were previously passed to the `Bind()` method in v1, are now specified in the `Bind` field of the [application options](../reference/options.mdx#application-options):
|
||||
Na v1, foi possível vincular funções e estruturas arbitrárias. Em v2, foi simplificado apenas para estruturas vinculativas. As instâncias de construção que foram passadas anteriormente para o método `Bind()` na v1, estão agora especificados no campo `Vincular` do as opções de aplicação [](../reference/options.mdx#application-options):
|
||||
|
||||
```go title="v1"
|
||||
app := wails.CreateApp(/* options */)
|
||||
@ -57,19 +57,19 @@ In v1, it was possible to bind both arbitrary functions and structs. In v2, this
|
||||
})
|
||||
```
|
||||
|
||||
In v1, bound methods were available to the frontend at `window.backend`. This has changed to `window.go`.``
|
||||
Na v1, métodos vinculados estavam disponíveis para o frontend em `window.backend`. Isto mudou para `window.go`
|
||||
|
||||
### Application Lifecycle
|
||||
### Ciclo de vida da Aplicação
|
||||
|
||||
In v1, there were 2 special methods in a bound struct: `WailsInit()` and `WailsShutdown()`. These have been replaced with 3 lifecycle hooks as part of the [application options](../reference/options.mdx#application-options):
|
||||
Na v1, havia 2 métodos especiais em uma estrutura vinculada: `WailsInit()` e `WailsShutdown()`. Foi substituído por três ganchos de ciclo de vida como parte das [opções do aplicativo](../reference/options.mdx#application-options):
|
||||
|
||||
- [OnStartup](../reference/options.mdx#onstartup)
|
||||
- [OnShutdown](../reference/options.mdx#onshutdown)
|
||||
- [OnDomReady](../reference/options.mdx#ondomready)
|
||||
|
||||
Note: [OnDomReady](../reference/options.mdx#ondomready) replaces the `wails:ready` system event in v1.
|
||||
Nota: [OnDomReady](../reference/options.mdx#ondomready) substitui o evento do sistema `wails:ready` na v1.
|
||||
|
||||
These methods can be standard functions, but a common practice is to have them part of a struct:
|
||||
Estes métodos podem ser funções padrão, mas uma prática comum é tê-los incluído numa estrutura:
|
||||
|
||||
```go title="v2"
|
||||
basic := NewBasicApp()
|
||||
@ -89,11 +89,11 @@ func (b *Basic) startup(ctx context.Context) {
|
||||
...
|
||||
```
|
||||
|
||||
### Runtime
|
||||
### Tempo de execução
|
||||
|
||||
The runtime in v2 is much richer than v1 with support for menus, window manipulation and better dialogs. The signature of the methods has changed slightly - please refer the the [Runtime Reference](../reference/runtime/intro.mdx).
|
||||
O tempo de execução na v2 é muito mais rico que a v1 com suporte para menus, manipulação de janelas e melhores diálogos. A assinatura dos métodos mudou ligeiramente - consulte a [Referência de tempo de execução](../reference/runtime/intro.mdx).
|
||||
|
||||
In v1, the [runtime](../reference/runtime/intro.mdx) was available via a struct passed to `WailsInit()`. In v2, the runtime has been moved out to its own package. Each method in the runtime takes the `context.Context` that is passed to the [OnStartup](../reference/options.mdx#onstartup) method.
|
||||
Na v1, o [runtime](../reference/runtime/intro.mdx) estava disponível através de uma struct passada para `WailsInit()`. Em v2, o tempo de execução foi movido para o seu próprio pacote. Cada método no tempo de execução leva o `context.Context` que é passado para o método [OnStartup](../reference/options.mdx#onstartup).
|
||||
|
||||
```go title="Runtime Example"
|
||||
package main
|
||||
@ -114,22 +114,22 @@ func (a *App) startup(ctx context.Context) {
|
||||
|
||||
### Assets
|
||||
|
||||
The _biggest_ change in v2 is how assets are handled.
|
||||
A _maior mudança_ na v2 é como os ativos são geridos.
|
||||
|
||||
In v1, assets were passed via 2 application options:
|
||||
Na v1, os ativos foram passados via 2 opções de aplicativo:
|
||||
|
||||
- `JS` - The application's JavaScript
|
||||
- `CSS` - The application's CSS
|
||||
- `JS` - O JavaScript do aplicativo
|
||||
- `CSS` - O CSS da aplicação
|
||||
|
||||
This meant that the responsibility of generating a single JS and CSS file was on the developer. This essentially required the use of complicated packers such as webpack.
|
||||
Isso significava que a responsabilidade de gerar um único arquivo JS e CSS era do desenvolvedor. Isto exigia essencialmente a utilização de embalagens complicadas como o webpack.
|
||||
|
||||
In v2, Wails makes no assumptions about your frontend assets, just like a webserver. All of your application assets are passed to the application options as an `embed.FS`.
|
||||
Na v2, Wails não faz suposições sobre seus ativos no frontend, como um servidor web. Todos os seus ativos de aplicação são passados para as opções de aplicação como um `embed.FS`.
|
||||
|
||||
**This means there is no requirement to bundle your assets, encode images as Base64 or attempt the dark art of bundler configuration to use custom fonts**.
|
||||
**Isso significa que não há necessidade de agrupar seus ativos, codificar imagens como Base64 ou experimente a arte obscura da configuração do bundler para usar fontes personalizadas**.
|
||||
|
||||
At startup, Wails will scan the given `embed.FS` for `index.html` and use its location as the root path for all the other application assets - just like a webserver would.
|
||||
Na inicialização, Wails verificará o `embed.FS` fornecido em busca de `index.html` e usará sua localização como caminho raiz para todos os outros ativos do aplicativo - assim como faria um servidor web.
|
||||
|
||||
Example: An application has the following project layout. All final assets are placed in the `frontend/dist` directory:
|
||||
Exemplo: Uma aplicação tem o seguinte layout do projeto. Todos os arquivos finais são colocados no diretório `frontend/dist`:
|
||||
|
||||
```shell
|
||||
.
|
||||
@ -144,7 +144,7 @@ Example: An application has the following project layout. All final assets are p
|
||||
└── wails.json
|
||||
```
|
||||
|
||||
Those assets may be used by the application by simply creating an `embed.FS`:
|
||||
Esses ativos podem ser usados pelo aplicativo simplesmente criando um `embed.FS`:
|
||||
|
||||
```go title="Assets Example"
|
||||
//go:embed all:frontend/dist
|
||||
@ -160,13 +160,13 @@ func main() {
|
||||
}
|
||||
```
|
||||
|
||||
Of course, bundlers can be used if you wish to. The only requirement is to pass the final application assets directory to Wails using an `embed.FS` in the `Assets` key of the [application options](../reference/options.mdx#application-options).
|
||||
Claro, empacotadores podem ser usados se você quiser. O único requisito é passar o diretório final de ativos do aplicativo para Wails usando um `embed.FS` no `Assets` chave das [opções do aplicativo](../reference/options.mdx#application-options).
|
||||
|
||||
### Project Configuration
|
||||
### Configuração do Projeto
|
||||
|
||||
In v1, the project configuration was stored in the `project.json` file in the project root. In v2, the project configuration is stored in the `wails.json` file in the project root.
|
||||
Na v1, a configuração do projeto foi armazenada no arquivo `project.json` na raiz do projeto. Na v2, a configuração do projeto é armazenada no arquivo `wails.json` na raiz do projeto.
|
||||
|
||||
The format of the file is slightly different. Here is a comparison:
|
||||
O formato do arquivo é ligeiramente diferente. Aqui está uma comparação:
|
||||
|
||||
<p align="center">
|
||||
|
||||
@ -185,7 +185,7 @@ The format of the file is slightly different. Here is a comparison:
|
||||
| frontend / serve | | Removed |
|
||||
| tags | | Removed |
|
||||
| | wailsjsdir | The directory to generate wailsjs modules |
|
||||
| | assetdir | The directory of the compiled frontend assets for `dev` mode. This is normally inferred and could be left empty. |
|
||||
| | reloaddirs | Comma separated list of additional directories to watch for changes and to trigger reloads in `dev` mode. This is only needed for some more advanced asset configurations. |
|
||||
| | assetdir | The directory of the compiled frontend assets for `dev` mode. Normalmente, isto é inferido e pode ser deixado vazio. |
|
||||
| | reloaddirs | Lista separada por vírgulas de diretórios adicionais para observar alterações e acionar recarregamentos no modo `dev`. Isso só é necessário para algumas configurações de ativos mais avançadas. |
|
||||
|
||||
</p>
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Mouse Buttons
|
||||
# Botões do Mouse
|
||||
|
||||
The Wails runtime intercepts mouse clicks to determine whether a frameless window needs resizing or a window needs to be moved. It has been asked how to detect when a mouse click has occurred, because `window.onclick` doesn't report the mouse buttons correctly. The following code shows how to detect mouse clicks:
|
||||
As Wails runtime interceptam cliques do mouse para determinar se uma janela precisa ser redimensionada ou uma janela precisa ser movida. Foi perguntado como detectar quando um clique do mouse ocorreu, porque `window.onclick` não relata os botões do mouse corretamente. O código a seguir mostra como detectar cliques do mouse:
|
||||
|
||||
```javascript
|
||||
window.addEventListener("mousedown", handleMouseButtonDown);
|
||||
|
@ -1,32 +1,32 @@
|
||||
# Obfuscated Builds
|
||||
# Builds ofuscadas
|
||||
|
||||
Wails includes support for obfuscating your application using [garble](https://github.com/burrowers/garble).
|
||||
Wails inclui suporte para ofuscar a sua aplicação usando [garble](https://github.com/burrowers/garble).
|
||||
|
||||
To produce an obfuscated build, you can use the `-obfuscate` flag with the `wails build` command:
|
||||
Para produzir uma compilação ofuscada, você pode usar o sinalizador `-obfuscate` com o comando `wails build`:
|
||||
|
||||
```bash
|
||||
wails build -obfuscated
|
||||
```
|
||||
|
||||
To customise the obfuscation settings, you can use the `-garbleargs` flag:
|
||||
Para personalizar a configuração de ofuscação, pode-se utilizar a flag: `-garbleargs`:
|
||||
|
||||
```bash
|
||||
wails build -obfuscated -garbleargs "-literals -tiny -seed=myrandomseed"
|
||||
```
|
||||
|
||||
These settings may be persisted in your [project config](../reference/project-config).
|
||||
Essas configurações podem estar persistentes na configuração do seu [projeto](../reference/project-config).
|
||||
|
||||
## How it works
|
||||
## Como funciona
|
||||
|
||||
In a standard build, all bound methods are available in the frontend under the `window.go` variable. When these methods are called, the corresponding backend method is called using the fully qualified function name. When using an obfuscated build, methods are bound using an ID instead of a name. The bindings generated in the `wailsjs` directory use these IDs to call the backend functions.
|
||||
Em uma compilação padrão, todos os métodos vinculados estão disponíveis no frontend sob a variável `window.go`. Quando esses métodos são chamados, o método backend correspondente é chamado usando o nome da função totalmente qualificada. Quando usando uma compilação ofuscada, os métodos são vinculados usando um ID em vez de um nome. Os bindings gerados no diretório `wailsjs` usam esses IDs para chamar as funções de backend.
|
||||
|
||||
:::note
|
||||
|
||||
To ensure that your application will work in obfuscated mode, you must use the generated bindings under the `wailsjs` directory in your application.
|
||||
Para garantir que o seu aplicativo irá funcionar no modo ofuscado, você deve usar os bindings geradas sob o diretório `wailsjs` no seu aplicativo.
|
||||
|
||||
:::
|
||||
|
||||
## Example
|
||||
## Exemplo
|
||||
|
||||
Importing the "Greet" method from the bindings like this:
|
||||
|
||||
@ -37,4 +37,4 @@ import { Greet } from "../../wailsjs/go/main/App";
|
||||
Greet("World");
|
||||
```
|
||||
|
||||
will ensure that the method will work correctly in obfuscated mode, as the bindings will be regenerated with IDs and the call mechanism updated.
|
||||
irá garantir que o método funcionará corretamente no modo ofuscado, como os bindings serão regenerados com IDs e o mecanismo de chamada atualizado.
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Overscroll
|
||||
# Rolar demais
|
||||
|
||||
[Overscroll](https://developer.mozilla.org/en-US/docs/Web/CSS/overscroll-behavior) is the "bounce effect" you sometimes get when you scroll beyond a page's content boundaries. This is common in mobile apps. This can be disabled using CSS:
|
||||
[Overscroll](https://developer.mozilla.org/en-US/docs/Web/CSS/overscroll-behavior) é o "efeito de salto" que você às vezes obtém quando você rola além dos limites de conteúdo de uma página. This is common in mobile apps. Isso pode ser desativado usando CSS:
|
||||
|
||||
```css
|
||||
html {
|
||||
|
@ -27,7 +27,7 @@ RouterModule.forRoot(routes, { useHash: true });
|
||||
|
||||
## React
|
||||
|
||||
The recommended approach for routing in React is [HashRouter](https://reactrouter.com/en/main/router-components/hash-router):
|
||||
A abordagem recomendada para roteamento em React é [HashRouter](https://reactrouter.com/en/main/router-components/hash-router):
|
||||
|
||||
```jsx
|
||||
import { HashRouter } from "react-router-dom";
|
||||
|
@ -1,66 +1,66 @@
|
||||
# SvelteKit
|
||||
|
||||
This guide will go into:
|
||||
Este guia será para:
|
||||
|
||||
1. Miminal Installation Steps - The steps needed to get a minimum Wails setup working for SvelteKit.
|
||||
2. Install Script - Bash script for accomplishing the Minimal Installation Steps with optional Wails branding.
|
||||
3. Important Notes - Issues that can be encountered when using SvelteKit + Wails and fixes.
|
||||
1. Passos de instalação do Miminal - Os passos necessários para obter uma instalação mínima de Wails funcionando para o SvelteKit.
|
||||
2. Script de Instalação - Bash script para cumprir os passos de Instalação Mínima com a marca opcional de Wails.
|
||||
3. Notas importantes - Problemas que podem ser encontrados ao usar o SvelteKit + Wails e correções.
|
||||
|
||||
## 1. Minimal Installation Steps
|
||||
## 1. Passos mínimos de instalação
|
||||
|
||||
##### Install Wails for Svelte.
|
||||
##### Instalar Wails para Svelte.
|
||||
|
||||
- `wails init -n myapp -t svelte`
|
||||
|
||||
##### Delete the svelte frontend.
|
||||
##### Exclua o front-end do Svelte.
|
||||
|
||||
- Navigate into your newly created myapp folder.
|
||||
- Delete the folder named "frontend"
|
||||
- Navegue até a pasta myapp recém-criada.
|
||||
- Excluir a pasta chamada "frontend"
|
||||
|
||||
##### While in the Wails project root. Use your favorite package manager and install SvelteKit as the new frontend. Follow the prompts.
|
||||
##### Enquanto estiver na raiz do projeto Wails. Use o seu gerenciador de pacotes favorito e instale o SvelteKit como o novo frontend. Siga as instruções.
|
||||
|
||||
- `npm create svelte@latest frontend`
|
||||
|
||||
##### Modify wails.json.
|
||||
##### Modificar o wails.json.
|
||||
|
||||
- Add `"wailsjsdir": "./frontend/src/lib",` Do note that this is where your Go and runtime functions will appear.
|
||||
- Change your package manager frontend here if not using npm.
|
||||
- Add `"wailsjsdir": "./frontend/src/lib",` Observe que é aqui que suas funções Go e runtime aparecerão.
|
||||
- Mude o frontend do seu gerenciador de pacotes se não estiver usando npm.
|
||||
|
||||
##### Modify main.go.
|
||||
##### Modificar o main.go.
|
||||
|
||||
- The first comment `//go:embed all:frontend/dist` needs to be changed to `//go:embed all:frontend/build`
|
||||
- O primeiro comentário `//go:embed all:frontend/dist` precisa ser alterado para `//go:embed all:frontend/build`
|
||||
|
||||
##### Install/remove dependencies using your favorite package manager.
|
||||
##### Instalar/remover dependências usando seu gerenciador de pacote favorito.
|
||||
|
||||
- Navigate into your "frontend" folder.
|
||||
- Entre na sua pasta "frontend".
|
||||
- `npm i`
|
||||
- `npm uninstall @sveltejs/adapter-auto`
|
||||
- `npm i -D @sveltejs/adapter-static`
|
||||
|
||||
##### Change adapter in svelte.config.js
|
||||
##### Alterar adaptador em svelte.config.js
|
||||
|
||||
- First line of file change `import adapter from '@sveltejs/adapter-auto';` to `import adapter from '@sveltejs/adapter-static';`
|
||||
- A primeira linha de arquivo altera `import adapter from '@sveltejs/adapter-auto';` to `import adapter from '@sveltejs/adapter-static';`
|
||||
|
||||
##### Put SvelteKit into SPA mode with prerendering.
|
||||
##### Coloque o SvelteKit no modo SPA com pré-renderização.
|
||||
|
||||
- Create a file under myapp/frontend/src/routes/ named +layout.ts/+layout.js.
|
||||
- Add two lines into the newly created file `export const prerender = true` and `export const ssr = false`
|
||||
- Crie um arquivo sob myapp/frontend/src/routes/ chamado +layout.ts/+layout.js.
|
||||
- Adicione duas linhas ao recém-criado arquivo `export const prerender = true` e `export const ssr = false`
|
||||
|
||||
##### Test installation.
|
||||
##### Testar instalação.
|
||||
|
||||
- Navigate back into the Wails project root (one directory up).
|
||||
- run `wails dev`
|
||||
- If the application doesn't run please check through the previous steps.
|
||||
- Navegue de volta à raiz do projeto Wails (um diretório para cima).
|
||||
- execute `wails dev`
|
||||
- Se a aplicação não executar, por favor verifique os passos anteriores.
|
||||
|
||||
## 2. Install Script
|
||||
## 2. Script de Instalação
|
||||
|
||||
##### This Bash Script does the steps listed above. Make sure to read over the script and understand what the script is doing on your computer.
|
||||
##### Este Script do Bash faz as etapas listadas acima. Certifique-se de ler o script e de entender o que o script está fazendo no seu computador.
|
||||
|
||||
- Create a file sveltekit-wails.sh
|
||||
- Copy the below code into the new file then save it.
|
||||
- Make it executable with `chmod +x sveltekit-wails.sh`
|
||||
- Brand is an optional param below that adds back in the wails branding. Leave third param blank to not insert the Wails branding.
|
||||
- Example usage: `./sveltekit-wails.sh pnpm newapp brand`
|
||||
- Criar um arquivo sveltekit-wails.sh
|
||||
- Copie o código abaixo para o novo arquivo e o salve.
|
||||
- Torná-lo executável com `chmod +x sveltekit-wails.sh`
|
||||
- A marca é um parâmetro opcional abaixo que adiciona de volta na marca de fregueses. Deixe o terceiro parâmetro em branco para não inserir a marca das Wails.
|
||||
- Exemplo de uso: `./sveltekit-wails.sh pnpm newapp brand`
|
||||
|
||||
##### sveltekit-wails.sh:
|
||||
|
||||
@ -96,17 +96,17 @@ cd ..
|
||||
wails dev
|
||||
```
|
||||
|
||||
## 3. Important Notes
|
||||
## 3. Notas importantes
|
||||
|
||||
##### Server files will cause build failures.
|
||||
##### Os arquivos do servidor causarão falhas de construção.
|
||||
|
||||
- \+layout.server.ts, +page.server.ts, +server.ts or any file with "server" in the name will fail to build as all routes are prerendered.
|
||||
- \+layout.server.ts, +page.server.ts, +server.ts ou qualquer arquivo com "server" em nome falhará na construção enquanto todas as rotas forem pré-renderizadas.
|
||||
|
||||
##### The Wails runtime unloads with full page navigations!
|
||||
##### O tempo de execução do Wails descarrega com navegações de página inteira!
|
||||
|
||||
- Anything that causes full page navigations: `window.location.href = '/<some>/<page>'` or Context menu reload when using wails dev. What this means is that you can end up losing the ability to call any runtime breaking the app. There are two ways to work around this.
|
||||
- Use `import { goto } from '$app/navigation'` then call `goto('/<some>/<page>')` in your +page.svelte. This will prevent a full page navigation.
|
||||
- If full page navigation can't be prevented the Wails runtime can be added to all pages by adding the below into the `<head>` of myapp/frontend/src/app.html
|
||||
- Tudo que causa navegações de página completa: `window.location.href = '/<some>/<page>'` ou recarga do menu de contexto ao usar wails dev. Isso significa que você pode acabar perdendo a capacidade de chamar qualquer falha no aplicativo em tempo de execução. Há duas formas de trabalhar em torno desta questão.
|
||||
- Use `import { goto } from '$app/navigation'` e então chame `goto('/<some>/<page>')` em sua + page.svelte. Isso impedirá uma navegação de página completa.
|
||||
- Se a navegação por página inteira não puder ser impedido que o tempo de execução do Wails seja adicionado a todas as páginas, adicionando o abaixo ao `<head>` de myapp/frontend/src/app. Mt
|
||||
|
||||
```
|
||||
<head>
|
||||
@ -118,17 +118,17 @@ wails dev
|
||||
</head>
|
||||
```
|
||||
|
||||
See https://wails.io/docs/guides/frontend for more information.
|
||||
Veja https://wails.io/docs/guides/frontend para mais informações.
|
||||
|
||||
##### Inital data can be loaded and refreshed from +page.ts/+page.js to +page.svelte.
|
||||
##### Os dados de e-mail podem ser carregados e atualizados a partir de +page.ts/+page.js para +page.svelte.
|
||||
|
||||
- \+page.ts/+page.js works well with load() https://kit.svelte.dev/docs/load#page-data
|
||||
- invalidateAll() in +page.svelte will call load() from +page.ts/+page.js https://kit.svelte.dev/docs/load#rerunning-load-functions-manual-invalidation.
|
||||
- \+page.ts/+page.js funciona bem com o load() https://kit.svelte.dev/docs/load#page-data
|
||||
- invalidateAll() em +page.svelte irá chamar load() de +page.ts/+page.js https://kit.svelte.dev/docs/load#rerunning-load-functions-manual-invalidation.
|
||||
|
||||
##### Error Handling
|
||||
##### Tratamento de erros
|
||||
|
||||
- Expected errors using Throw error works in +page.ts/+page.js with a +error.svelte page. https://kit.svelte.dev/docs/errors#expected-errors
|
||||
- Unexpected errors will cause the application to become unusable. Only recovery option (known so far) from unexpected errors is to reload the app. To do this create a file myapp/frontend/src/hooks.client.ts then add the below code to the file.
|
||||
- Erros esperados usando o erro Throw funcionam em +page.ts/+page.js com uma página +error.svelte. https://kit.svelte.dev/docs/errors#expected-errors
|
||||
- Erros inesperados farão com que o aplicativo se torne inutilizável. Somente a opção de recuperação (conhecida até agora) de erros inesperados é recarregar o aplicativo. Para fazer isso, crie um arquivo myapp/frontend/src/hooks.client.ts e adicione o código abaixo ao arquivo.
|
||||
|
||||
```
|
||||
import { WindowReloadApp } from '$lib/wailsjs/runtime/runtime'
|
||||
@ -137,10 +137,10 @@ export async function handleError() {
|
||||
}
|
||||
```
|
||||
|
||||
##### Using Forms and handling functions
|
||||
##### Usando formas e funções de manipulação
|
||||
|
||||
- The simplest way is to call a function from the form is the standard, bind:value your variables and prevent submission `<form method="POST" on:submit|preventDefault={handle}>`
|
||||
- The more advanced way is to use:enhance (progressive enhancement) which will allow for convenient access to formData, formElement, submitter. The important note is to always cancel() the form which prevents server side behavior. https://kit.svelte.dev/docs/form-actions#progressive-enhancement Example:
|
||||
- A maneira mais simples é chamar uma função do formulário é o padrão, vincular:valor suas variáveis e evitar submissão `<form method="POST" on:submit|preventDefault={handle}>`
|
||||
- A maneira mais avançada é use:enhance (aprimoramento progressivo) que permitirá acesso conveniente a formData, formElemento, emissor. A nota importante é sempre cancel() o formulário que impede o comportamento do lado do servidor. https://kit.svelte.dev/docs/form-actions#progressive-enhancement Exemplo:
|
||||
|
||||
```
|
||||
<form method="POST" use:enhance={({cancel, formData, formElement, submitter}) => {
|
||||
|
@ -1,17 +1,17 @@
|
||||
# Templates
|
||||
|
||||
Wails generates projects from pre-created templates. In v1, this was a difficult to maintain set of projects that were subject to going out of date. In v2, to empower the community, a couple of new features have been added for templates:
|
||||
Wails gera projetos a partir de modelos pré-criados. Na v1, este era um conjunto de projetos que estavam sujeitos a sair de moda. No v2, para capacitar a comunidade, alguns novos recursos foram adicionados para os templates:
|
||||
|
||||
- Ability to generate projects from [Remote Templates](../reference/cli.mdx#remote-templates)
|
||||
- Tooling to help create your own templates
|
||||
- Capacidade de gerar projetos a partir de [Modelos Remotos](../reference/cli.mdx#remote-templates)
|
||||
- Ferramentas para ajudar a criar seus próprios modelos
|
||||
|
||||
## Creating Templates
|
||||
## Criando Templates
|
||||
|
||||
To create a template, you can use the `wails generate template` command. To generate a default template, run:
|
||||
Para criar um template, você pode usar o comando `wails generate template`. Para gerar um modelo padrão, execute:
|
||||
|
||||
`wails generate template -name mytemplate`
|
||||
|
||||
This creates the directory "mytemplate" with default files:
|
||||
Isso cria o diretório "mytemplate" com os arquivos padrão:
|
||||
|
||||
```shell title=mytemplate/
|
||||
.
|
||||
@ -35,31 +35,31 @@ This creates the directory "mytemplate" with default files:
|
||||
`-- wails.tmpl.json
|
||||
```
|
||||
|
||||
### Template Overview
|
||||
### Visão Geral do Modelo
|
||||
|
||||
The default template consists of the following files and directories:
|
||||
O modelo padrão consiste nos seguintes arquivos e diretórios:
|
||||
|
||||
| Filename / Dir | Description |
|
||||
| --------------- | -------------------------------------------- |
|
||||
| NEXTSTEPS.md | Instructions on how to complete the template |
|
||||
| README.md | The README published with the template |
|
||||
| app.tmpl.go | `app.go` template file |
|
||||
| frontend/ | The directory containing frontend assets |
|
||||
| go.mod.tmpl | `go.mod` template file |
|
||||
| main.tmpl.go | `main.go` template file |
|
||||
| template.json | The template metadata |
|
||||
| wails.tmpl.json | `wails.json` template file |
|
||||
| Nome do arquivo / diretório | Descrição |
|
||||
| --------------------------- | -------------------------------------------- |
|
||||
| NEXTSTEPS.md | Instruções sobre como completar o modelo |
|
||||
| README.md | O README publicado com o modelo |
|
||||
| app.tmpl.go | Arquivo de modelo `app.go` |
|
||||
| frontend/ | O diretório que contém os assets do frontend |
|
||||
| go.mod.tmpl | Arquivo de modelo `go.mod` |
|
||||
| main.tmpl.go | Arquivo de modelo `main.go` |
|
||||
| template.json | Os metadados do modelo |
|
||||
| wails.tmpl.json | Arquivo de modelo `wails.json` |
|
||||
|
||||
At this point it is advisable to follow the steps in `NEXTSTEPS.md`.
|
||||
Neste ponto é aconselhável seguir os passos em `NEXTSTEPS.md`.
|
||||
|
||||
## Creating a Template from an Existing Project
|
||||
## Criando um Template de um Projeto Existente
|
||||
|
||||
It's possible to create a template from an existing frontend project by passing the path to the project when generating the template. We will now walk through how to create a Vue 3 template:
|
||||
É possível criar um modelo a partir de um projeto de frontend existente, passando o caminho para o projeto ao gerar o template. Vamos agora andar sobre como criar um modelo do Vue 3:
|
||||
|
||||
- Install the vue cli: `npm install -g @vue/cli`
|
||||
- Create the default project: `vue create vue3-base`
|
||||
- Select `Default (Vue 3) ([Vue 3] babel, eslint)`
|
||||
- After the project has been generated, run:
|
||||
- Instale o vue cli: `npm install -g @vue/cli`
|
||||
- Crie o projeto padrão: `vue create vue3-base`
|
||||
- Selecione `Padrão (Vue 3) ([Vue 3] babel, eslint)`
|
||||
- Depois que o projeto for gerado, execute:
|
||||
|
||||
```shell
|
||||
> wails generate template -name wails-vue3-template -frontend .\vue3-base\
|
||||
@ -71,11 +71,11 @@ Updating package-lock.json data...
|
||||
Renaming package-lock.json -> package-lock.tmpl.json...
|
||||
```
|
||||
|
||||
- The template may now be customised as specified in the `NEXTSTEPS.md` file
|
||||
- Once the files are ready, it can be tested by running: `wails init -n my-vue3-project -t .\wails-vue3-template\`
|
||||
- To test the new project, run: `cd my-vue3-project` then `wails build`
|
||||
- Once the project has compiled, run it: `.\build\bin\my-vue3-project.exe`
|
||||
- You should have a fully functioning Vue3 application:
|
||||
- O template agora pode ser personalizado conforme especificado no arquivo `NEXTSTEPS.md`
|
||||
- Uma vez que os arquivos estão prontos, eles podem ser testados executando: `wails init -n my-vue3-project -t .\wails-vue3-template\`
|
||||
- Para testar o novo projeto, execute: `cd meu-vue3-projeto` e `wails constroem`
|
||||
- Uma vez que o projeto tenha compilado, execute-o: `.\build\bin\my-vue3-project.exe`
|
||||
- Você deve ter um aplicativo Vue3 que funcione plenamente:
|
||||
|
||||
```mdx-code-block
|
||||
<div className="text--center">
|
||||
@ -86,12 +86,12 @@ Renaming package-lock.json -> package-lock.tmpl.json...
|
||||
</div>
|
||||
```
|
||||
|
||||
## Publishing Templates
|
||||
## Publicando Templates
|
||||
|
||||
Publishing a template is simply pushing the files to GitHub. The following best practice is encouraged:
|
||||
A publicação de um template está simplesmente enviando os arquivos para o GitHub. São encorajadas as seguintes melhores práticas:
|
||||
|
||||
- Remove any unwanted files and directories (such as `.git`) from your frontend directory
|
||||
- Ensure that `template.json` is complete, especially `helpurl`
|
||||
- Push the files to GitHub
|
||||
- Create a PR on the [Community Templates](../community/templates.mdx) page
|
||||
- Announce the template on the [Template Announcement](https://github.com/wailsapp/wails/discussions/825) discussion board
|
||||
- Remova todos os arquivos e diretórios indesejados (como `.git`) do seu diretório no frontend
|
||||
- Certifique-se de que `template.json` esteja completo, especialmente `helpurl`
|
||||
- Faça push dos arquivos para o GitHub
|
||||
- Crie um PR na página [Templates de Comunidade](../community/templates.mdx)
|
||||
- Anuncie o modelo no fórum de discussão [de Anúncio de Modelo](https://github.com/wailsapp/wails/discussions/825)
|
||||
|
@ -1,25 +1,25 @@
|
||||
# Troubleshooting
|
||||
# Resolução de Problemas
|
||||
|
||||
An assortment of troubleshooting tips.
|
||||
Uma variedade de dicas de solução de problemas.
|
||||
|
||||
## The `wails` command appears to be missing?
|
||||
## O comando `wail` parece estar faltando?
|
||||
|
||||
If your system is reporting that the `wails` command is missing, make sure you have followed the Go installation guide correctly. Normally, it means that the `go/bin` directory in your User's home directory is not in the `PATH` environment variable. You will also normally need to close and reopen any open command prompts so that changes to the environment made by the installer are reflected at the command prompt.
|
||||
Se o sistema está relatando que o comando `wails` está faltando, verifique se você seguiu o guia de instalação do Go corretamente. Normalmente, isso significa que o diretório `go/bin` no diretório inicial do seu usuário não está na variável `PATH` ambiente. Você normalmente também precisará fechar e reabrir qualquer prompt de comando aberto para que as alterações no ambiente feitas pelo instalador sejam refletidas no prompt de comando.
|
||||
|
||||
## My application is displaying a white/blank screen
|
||||
## Meu aplicativo está exibindo uma tela branca/em branco
|
||||
|
||||
Check that your application includes the assets from the correct directory. In your `main.go` file, you will have something similar to the following code:
|
||||
Verifique se sua aplicação inclui os conteúdos do diretório correto. No seu arquivo `main.go`, você terá algo semelhante ao seguinte código:
|
||||
|
||||
```go
|
||||
//go:embed all:frontend/dist
|
||||
var assets embed.FS
|
||||
```
|
||||
|
||||
Check that `frontend/dist` contains your application assets.
|
||||
Verifique que `frontend/dist` contém os ativos da aplicação.
|
||||
|
||||
### Mac
|
||||
|
||||
If this happens on Mac, try adding the following to your `Info.plist`:
|
||||
Se isso acontecer no Mac, tente adicionar o seguinte ao seu `Info.plist`:
|
||||
|
||||
```xml
|
||||
<key>NSAppTransportSecurity</key>
|
||||
@ -31,9 +31,9 @@ If this happens on Mac, try adding the following to your `Info.plist`:
|
||||
|
||||
Reference: https://github.com/wailsapp/wails/issues/1504#issuecomment-1174317433
|
||||
|
||||
## Mac application not valid
|
||||
## Aplicativo Mac inválido
|
||||
|
||||
If your built application looks like this in finder:
|
||||
Se a sua aplicação construída se parece com isso no buscador:
|
||||
|
||||
```mdx-code-block
|
||||
<p className="text--center">
|
||||
@ -45,17 +45,17 @@ If your built application looks like this in finder:
|
||||
</p>
|
||||
```
|
||||
|
||||
it's likely that your application's `info.plist` is invalid. Update the file in `build/<yourapp>.app/Contents/info.plist` and check if the data is valid, EG check the binary name is correct. To persist the changes, copy the file back to the `build/darwin` directory.
|
||||
é provável que o `info.plist` do seu aplicativo seja inválido. Atualize o arquivo em `build/<yourapp>.app/Contents/info.plist` e verifique se os dados são válidos, verifique se o nome binário está correto. Para persistir nas alterações, copie o arquivo de volta para o diretório `build/darwin`.
|
||||
|
||||
## My application is not displaying the correct icon in Windows Explorer
|
||||
## Meu aplicativo não está exibindo o ícone correto no Windows Explorer
|
||||
|
||||
If your application is not displaying the correct icon, try deleting the hidden `IconCache.db` file located in the `C:\Users\<your username>\AppData\Local` directory. This will force Windows to rebuild the icon cache.
|
||||
Se seu aplicativo não estiver exibindo o ícone correto, tente excluir o arquivo `IconCache.db` oculto localizado na pasta Diretório `C:\Users\<seu nome de usuário>\AppData\Local`. Isto irá forçar o Windows a reconstruir o cache de ícones.
|
||||
|
||||
Source: https://github.com/wailsapp/wails/issues/2360#issuecomment-1556070036
|
||||
Reference: https://github.com/wailsapp/wails/issues/2360#issuecomment-1556070036
|
||||
|
||||
## Cannot call backend method from frontend with variadic arguments
|
||||
## Não é possível chamar o método backend no frontend com argumentos variados
|
||||
|
||||
If you have a backend method defined with variadic parameters, eg:
|
||||
Se você tem um método de backend definido com parâmetros variadicos, por exemplo:
|
||||
|
||||
```go
|
||||
func (a *App) TestFunc(msg string, args ...interface{}) error {
|
||||
@ -63,7 +63,7 @@ func (a *App) TestFunc(msg string, args ...interface{}) error {
|
||||
}
|
||||
```
|
||||
|
||||
calling this method from the frontend like this will fail:
|
||||
chamar esse método a partir do frontend como isso irá falhar:
|
||||
|
||||
```js
|
||||
var msg = "Hello: ";
|
||||
@ -77,7 +77,7 @@ window.go.main.App.TestFunc(msg, ...args)
|
||||
});
|
||||
```
|
||||
|
||||
Workaround:
|
||||
Gambiarra:
|
||||
|
||||
```js
|
||||
var msg = "Hello ";
|
||||
@ -94,30 +94,30 @@ window.go.main.App.TestFunc(msg, args)
|
||||
|
||||
Credit: https://github.com/wailsapp/wails/issues/1186
|
||||
|
||||
## I'm having getting proxy errors when trying to install Wails
|
||||
## Estou recebendo erros de proxy ao tentar instalar o Wails
|
||||
|
||||
If you are getting errors like this:
|
||||
Se você estiver recebendo erros como este:
|
||||
|
||||
```
|
||||
"https://proxy.golang.org/github.com/wailsapp/wails/cmd/wails/@v/list": dial tcp 172.217.163.49:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
|
||||
```
|
||||
|
||||
it's probably because the official Go Proxy is being blocked (Users in China have reported this). The solution is to set up the proxy manually, eg:
|
||||
é provavelmente porque o Proxy oficial Go está sendo bloqueado (usuários na China relataram isto). A solução é configurar o proxy manualmente, por exemplo:
|
||||
|
||||
```
|
||||
go env -w GO111MODULE=on
|
||||
go env -w GOPROXY=https://goproxy.cn,direct
|
||||
```
|
||||
|
||||
Source: https://github.com/wailsapp/wails/issues/1233
|
||||
Reference: https://github.com/wailsapp/wails/issues/1233
|
||||
|
||||
## The generated TypeScript doesn't have the correct types
|
||||
## O TypeScript gerado não tem os tipos corretos
|
||||
|
||||
Sometimes the generated TypeScript doesn't have the correct types. To mitigate this, it is possible to specify what types should be generated using the `ts_type` struct tag. For more details, please read [this](https://github.com/tkrajina/typescriptify-golang-structs#custom-types).
|
||||
Às vezes, o TypeScript gerado não tem os tipos corretos. Para mitigar isso, é possível especificar quais tipos devem ser gerados usando a tag de struct `ts_type`. Para mais detalhes do, leia [isto](https://github.com/tkrajina/typescriptify-golang-structs#custom-types).
|
||||
|
||||
## When I navigate away from `index.html`, I am unable to call methods on the frontend
|
||||
## Quando navego longe do `index.html`, não consigo chamar métodos no frontend
|
||||
|
||||
If you navigate away from `index.html` to a new html file, the context will be lost. This can be fixed by adding the following imports to the `<head>` section of any new page you navigate to:
|
||||
Se você navegar do `index.html` para um novo arquivo html, o contexto será perdido. Isso pode ser corrigido adicionando as seguintes importações para a seção `<head>` de qualquer nova página que você navegar:
|
||||
|
||||
```html
|
||||
<head>
|
||||
@ -126,17 +126,17 @@ If you navigate away from `index.html` to a new html file, the context will be l
|
||||
</head>
|
||||
```
|
||||
|
||||
Source: https://github.com/wailsapp/wails/discussions/1512
|
||||
Reference: https://github.com/wailsapp/wails/discussions/1512
|
||||
|
||||
## I get `too many open files` errors on my Mac when I run `wails dev`
|
||||
## Eu recebo `muitos arquivos abertos` erros no meu Mac quando eu rodo `wails`
|
||||
|
||||
By default, macOS will only allow you to open a maximum of 256 files. This can affect the `wails dev` command. This limit can be increased by running: `ulimit -n 1024` in the terminal.
|
||||
Por padrão, o macOS só permitirá que você abra um máximo de 256 arquivos. Isso pode afetar o comando `wails dev`. Este limite pode ser aumentado em execução: `ulimit -n 1024` no terminal.
|
||||
|
||||
FSNotify is [looking to move to Apple's fsevents](https://github.com/fsnotify/fsnotify/issues/11) for Mac. If this isn't completed soon, we will create our own implementation, tracked [here](https://github.com/wailsapp/wails/issues/1733).
|
||||
FSNotify é [procurando mudar para os fsevents](https://github.com/fsnotify/fsnotify/issues/11) da Apple para Mac. Se isso não estiver concluído em breve, criaremos nossa própria implementação, monitorada [aqui](https://github.com/wailsapp/wails/issues/1733).
|
||||
|
||||
## My Mac app gives me weird compilation errors
|
||||
## Meu aplicativo para Mac me dá erros estranhos de compilação
|
||||
|
||||
A few users have reported seeing compilation errors such as the following:
|
||||
Alguns usuários relataram ver erros de compilação como os seguintes:
|
||||
|
||||
```shell
|
||||
# github.com/wailsapp/wails/v2/internal/frontend/desktop/darwin
|
||||
@ -149,31 +149,53 @@ In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/Sy
|
||||
#define NS_FORMAT_ARGUMENT(A) __attribute__ ((format_arg(A)))
|
||||
```
|
||||
|
||||
This is _normally_ due to a mismatch with the OS version you are running and the version of the XCode Command Line Tools installed. If you see an error like this, try upgrading your XCode Command Line Tools to the latest version.
|
||||
Isto é _normalmente_ devido a uma incompatibilidade com a versão do sistema operacional que você está executando e a versão das Ferramentas de Comando XCode instalada. Se você vir um erro como este, tente atualizar suas Ferramentas de Linha de Comando XCode para a versão mais recente.
|
||||
|
||||
If reinstalling Xcode Command Tools still fails, you can check the path where the toolkit is located using:
|
||||
Se reinstalar as Ferramentas de Comando Xcode ainda falhar, você pode verificar o caminho onde o kit de ferramentas está usando:
|
||||
|
||||
`xcode-select -p`
|
||||
|
||||
If `/Applications/Xcode.app/Contents/Developer` is displayed, run `sudo xcode-select --switch /Library/Developer/CommandLineTools`
|
||||
Se `/Applications/Xcode.app/Contents/Developer` for exibido, rode `sudo xcode-select --switch /Library/Developer/CommandLineTools`
|
||||
|
||||
Fontes: https://github.com/wailsapp/wails/issues/1806 and https://github.com/wailsapp/wails/issues/1140#issuecomment-1290446496
|
||||
|
||||
## My application won't compile on Mac
|
||||
|
||||
Se você estiver recebendo erros como este:
|
||||
|
||||
```shell
|
||||
l1@m2 GoEasyDesigner % go build -tags dev -gcflags "all=-N -l"
|
||||
/Users/l1/sdk/go1.20.5/pkg/tool/darwin_arm64/link: running clang failed: exit status 1
|
||||
Undefined symbols for architecture arm64:
|
||||
"_OBJC_CLASS_$_UTType", referenced from:
|
||||
objc-class-ref in 000016.o
|
||||
ld: symbol(s) not found for architecture arm64
|
||||
clang: error: linker command failed with exit code 1 (use -v to see invocation)
|
||||
```
|
||||
Ensure you have the latest SDK installed. If so and you're still experiencing this issue, try the following:
|
||||
|
||||
```shell
|
||||
export CGO_LDFLAGS="-framework UniformTypeIdentifiers" && go build -tags dev -gcflags "all=-N -l"
|
||||
```
|
||||
|
||||
Sources: https://github.com/wailsapp/wails/pull/2925#issuecomment-1726828562
|
||||
|
||||
Sources: https://github.com/wailsapp/wails/issues/1806 and https://github.com/wailsapp/wails/issues/1140#issuecomment-1290446496
|
||||
|
||||
--
|
||||
|
||||
## Cannot start service: Host version "x.x.x does not match binary version "x.x.x"
|
||||
## Não foi possível iniciar o serviço: A versão do host "x.x.x não coincide com a versão binária "x.x.x"
|
||||
|
||||
It's preferable to add `frontend/node_modules` and `frontend/package-lock.json` to your `.gitignore`. Otherwise when opening your repository on another machine that may have different versions of Node installed, you may not be able to run your application.
|
||||
É preferível adicionar `frontend/node_modules` e `frontend/package-lock.json` ao seu `.gitignore`. Caso contrário, ao abrir o repositório em outra máquina que pode ter diferentes versões do Node instaladas, talvez você não seja capaz de executar seu aplicativo.
|
||||
|
||||
If this does happen, simply delete `frontend/node_modules` and `frontend/package-lock.json` and run your `wails build` or `wails dev` command again.
|
||||
Se isso acontecer, simplesmente exclua `frontend/node_modules` e `frontend/pacote-lock. soa` e corra os seus wails `constroem` ou `wails dev` comando.
|
||||
|
||||
## Build process stuck on "Generating bindings"
|
||||
## Processo de compilação travado em "Gerando vinculações"
|
||||
|
||||
Bindings generation process runs your application in a special mode. If application, intentionally or unintentionally, contains an endless loop (i.e. not exiting after `wails.Run()` finished), this can lead to build process stuck on the stage of bindings generation. Please make sure your code exits properly.
|
||||
Processo de geração de Bindings executa sua aplicação em um modo especial. Se o aplicativo, intencionalmente ou não intencionalmente, contém um laço infinito (ou seja, não sair após `wails.Run()` terminado), isto pode levar a construção do processo travado na geração do palco de amarras. Por favor, certifique-se de que seu código sai corretamente.
|
||||
|
||||
## Mac application flashes white at startup
|
||||
## Aplicação Mac pisca branco na inicialização
|
||||
|
||||
This is due to the default background of the webview being white. If you want to use the window background colour instead, you can make the webview background transparent using the following config:
|
||||
Isto é devido ao plano de fundo padrão do webview ser branco. Se você quiser usar a cor de fundo da janela, você pode tornar o plano de fundo do webview transparente usando a seguinte configuração:
|
||||
|
||||
```go
|
||||
err := wails.Run(&options.App{
|
||||
@ -185,4 +207,162 @@ This is due to the default background of the webview being white. If you want to
|
||||
WebviewIsTransparent: true,
|
||||
},
|
||||
})
|
||||
```
|
||||
```
|
||||
|
||||
## I get a "Microsoft Edge can't read or write to its data directory" error when running my program as admin on Windows
|
||||
|
||||
You set your program to require admin permissions and it worked great! Unfortunately, some users are seeing a "Microsoft Edge can't read or write to its data directory" error when running it.
|
||||
|
||||
When a Windows machine has two local accounts:
|
||||
|
||||
- Alice, an admin
|
||||
- Bob, a regular user
|
||||
|
||||
Bob sees a UAC prompt when running your program. Bob enters Alice's admin credentials into this prompt. The app launches with admin permissions under Alice's account.
|
||||
|
||||
Wails instructs WebView2 to store user data at the specified `WebviewUserDataPath`. It defaults to `%APPDATA%\[BinaryName.exe]`.
|
||||
|
||||
Because the application is running under Alice's account, `%APPDATA%\[BinaryName.exe]` resolves to `C:\Users\Alice\AppData\Roaming\[BinaryName.exe]`.
|
||||
|
||||
WebView2 [creates some child processes under Bob's logged-in account instead of Alice's admin account](https://github.com/MicrosoftEdge/WebView2Feedback/issues/932#issue-807464179). Since Bob cannot access `C:\Users\Alice\AppData\Roaming\[BinaryName.exe]`, the "Microsoft Edge can't read or write to its data directory" error is shown.
|
||||
|
||||
Possible solution #1:
|
||||
|
||||
Refactor your application to work without constant admin permissions. If you just need to perform a small set of admin tasks (such as running an updater), you can run your application with the minimum permissions and then use the `runas` command to run these tasks with admin permissions as needed:
|
||||
|
||||
```go
|
||||
//go:build windows
|
||||
|
||||
package sample
|
||||
|
||||
import (
|
||||
"golang.org/x/sys/windows"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// Calling RunAs("C:\path\to\my\updater.exe") shows Bob a UAC prompt. Bob enters Alice's admin credentials. The updater launches with admin permissions under Alice's account.
|
||||
func RunAs(path string) error {
|
||||
verbPtr, _ := syscall.UTF16PtrFromString("runas")
|
||||
exePtr, _ := syscall.UTF16PtrFromString(path)
|
||||
cwdPtr, _ := syscall.UTF16PtrFromString("")
|
||||
argPtr, _ := syscall.UTF16PtrFromString("")
|
||||
|
||||
var showCmd int32 = 1 //SW_NORMAL
|
||||
|
||||
err := windows.ShellExecute(0, verbPtr, exePtr, argPtr, cwdPtr, showCmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
```
|
||||
|
||||
Possible solution #2:
|
||||
|
||||
Run your application with extended permissions. If you absolutely must run with constant admin permissions, WebView2 will function correctly if you use a data directory accessible by both users and you also launch your app with the `SeBackupPrivilege`, `SeDebugPrivilege`, and `SeRestorePrivilege` permissions. Here's an example:
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"os"
|
||||
"runtime"
|
||||
|
||||
"github.com/fourcorelabs/wintoken"
|
||||
"github.com/hectane/go-acl"
|
||||
"github.com/wailsapp/wails/v2"
|
||||
"github.com/wailsapp/wails/v2/pkg/options"
|
||||
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
|
||||
"github.com/wailsapp/wails/v2/pkg/options/windows"
|
||||
)
|
||||
|
||||
//go:embed all:frontend/dist
|
||||
var assets embed.FS
|
||||
|
||||
const (
|
||||
fixedTokenKey = "SAMPLE_RANDOM_KEY"
|
||||
fixedTokenVal = "with-fixed-token"
|
||||
webviewDir = "C:\\ProgramData\\Sample"
|
||||
)
|
||||
|
||||
func runWithFixedToken() {
|
||||
println("Re-launching self")
|
||||
token, err := wintoken.OpenProcessToken(0, wintoken.TokenPrimary) //pass 0 for own process
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer token.Close()
|
||||
|
||||
token.EnableTokenPrivileges([]string{
|
||||
"SeBackupPrivilege",
|
||||
"SeDebugPrivilege",
|
||||
"SeRestorePrivilege",
|
||||
})
|
||||
|
||||
cmd := exec.Command(os.Args[0])
|
||||
cmd.Args = os.Args
|
||||
cmd.Env = os.Environ()
|
||||
cmd.Env = append(cmd.Env, fmt.Sprintf("%v=%v", fixedTokenKey, fixedTokenVal))
|
||||
cmd.Stdin = os.Stdin
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{Token: syscall.Token(token.Token())}
|
||||
if err := cmd.Run(); err != nil {
|
||||
println("Error after launching self:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
println("Clean self launch :)")
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
func main() {
|
||||
if runtime.GOOS == "windows" && os.Getenv(fixedTokenKey) != fixedTokenVal {
|
||||
runWithFixedToken()
|
||||
}
|
||||
|
||||
println("Setting data dir to", webviewDir)
|
||||
if err := os.MkdirAll(webviewDir, os.ModePerm); err != nil {
|
||||
println("Failed creating dir:", err)
|
||||
}
|
||||
if err := acl.Chmod(webviewDir, 0777); err != nil {
|
||||
println("Failed setting ACL on dir:", err)
|
||||
}
|
||||
|
||||
app := NewApp()
|
||||
|
||||
err := wails.Run(&options.App{
|
||||
Title: "sample-data-dir",
|
||||
Width: 1024,
|
||||
Height: 768,
|
||||
AssetServer: &assetserver.Options{
|
||||
Assets: assets,
|
||||
},
|
||||
Bind: []interface{}{
|
||||
app,
|
||||
},
|
||||
Windows: &windows.Options{
|
||||
WebviewUserDataPath: webviewDir,
|
||||
},
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
println("Error:", err.Error())
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If you use a data directory accessible by both users but not the extended privileges, you will receive a WebView2 `80010108 The object invoked has disconnected from its clients` error.
|
||||
|
||||
Possible future solution #3: [run WebView2 using an in-memory mode if implemented](https://github.com/MicrosoftEdge/WebView2Feedback/issues/3637#issuecomment-1728300982).
|
||||
|
||||
## WebView2 installation succeeded, but the wails doctor command shows that it is not installed
|
||||
|
||||
If you have installed WebView2, but the `wails doctor` command shows that it is not installed, it is likely that the WebView2 runtime installed was for a different architecture. You can download the correct runtime from [here](https://developer.microsoft.com/en-us/microsoft-edge/webview2/).
|
||||
|
||||
Source: https://github.com/wailsapp/wails/issues/2917
|
||||
|
||||
## WebVie2wProcess failed with kind
|
||||
|
||||
If your Windows app generates this kind of error, you can check out what the error means [here](https://docs.microsoft.com/en-us/microsoft-edge/webview2/reference/winrt/microsoft_web_webview2_core/corewebview2processfailedkind?view=webview2-winrt-1.0.2045.28).
|
||||
|
||||
|
@ -49,35 +49,35 @@ If you are unsure about a template, inspect `package.json` and `wails.json` for
|
||||
|
||||
`wails build` é usado para compilar seu projeto para um binário pronto para produção.
|
||||
|
||||
| Flag | Descrição | Padrão |
|
||||
|:-------------------- |:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |:----------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| -clean | Limpa o diretório `compilação/bin` | |
|
||||
| -compiler "compiler" | Use um compilador de ida diferente para realizar build, por exemplo, go1.15beta1 | go |
|
||||
| -debug | Retains debug information in the application and shows the debug console. Permite o uso das ferramentas devtools na janela do aplicativo | |
|
||||
| -devtools | Allows the use of the devtools in the application window in production (when -debug is not used) | |
|
||||
| -dryrun | Prints the build command without executing it | |
|
||||
| -f | Forçar compilação de aplicação | |
|
||||
| -garbleargs | Argumentos para passar para o garble | `-literals -tiny -seed=random` |
|
||||
| -ldflags "flags" | Ldflags adicionais para passar para o compilador | |
|
||||
| -m | Skip mod tidy before compile | |
|
||||
| -nopackage | Não empacotar aplicação | |
|
||||
| -nocolour | Disable colour in output | |
|
||||
| -nosyncgomod | Do not sync go.mod with the Wails version | |
|
||||
| -nsis | Generate NSIS installer for Windows | |
|
||||
| -o nome de arquivo | Nome do Arquivo de Saída | |
|
||||
| -obfuscated | Ofuscar a aplicação usando [garble](https://github.com/burrowers/garble) | |
|
||||
| -platform | Compila para as plataformas [(delimitadas por vírgula)](../reference/cli.mdx#platforms) por exemplo. `windows/arm64`. Note, se você não der arquitetura, `runtime.GOARCH` é usado. | platform = `variável de ambiente GOOS` se determinado `runtime.GOOS`.<br/>arch = `GOARCH` variável de envrionment se for dado `runtime.GOARCH`. |
|
||||
| -race | Realiza build com o Go race detector | |
|
||||
| -s | Pular build do frontend | |
|
||||
| -skipbindings | Skip bindings generation | |
|
||||
| -tags "extra tags" | Compilar tags para passar para o compilador Go. Deve ser citado. Separados por espaço ou vírgula (mas não ambos) | |
|
||||
| -trimpath | Remove todos os caminhos do sistema de arquivo do executável resultante. | |
|
||||
| -u | Atualiza o `go.mod` do seu projeto para usar a mesma versão de Wails que o CLI | |
|
||||
| -upx | Comprimir binário final usando "upx" | |
|
||||
| -upxflags | Flags para passar para o upx | |
|
||||
| -v int | Nível de verbosidade(0 - silencioso, 1 - padrão, 2 - verbose) | 1 |
|
||||
| -webview2 | Estratégia de instalação WebView2: download,embed,browser,error | baixar |
|
||||
| -windowsconsole | Manter a janela de console para builds do Windows | |
|
||||
| Flag | Descrição | Padrão |
|
||||
|:-------------------- |:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |:----------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| -clean | Limpa o diretório `compilação/bin` | |
|
||||
| -compiler "compiler" | Use um compilador de ida diferente para realizar build, por exemplo, go1.15beta1 | go |
|
||||
| -debug | Retains debug information in the application and shows the debug console. Permite o uso das ferramentas devtools na janela do aplicativo | |
|
||||
| -devtools | Allows the use of the devtools in the application window in production (when -debug is not used). Ctrl/Cmd+Shift+F12 may be used to open the devtools window. *NOTE*: This option will make your application FAIL Mac appstore guidelines. Use for debugging only. | |
|
||||
| -dryrun | Prints the build command without executing it | |
|
||||
| -f | Forçar compilação de aplicação | |
|
||||
| -garbleargs | Argumentos para passar para o garble | `-literals -tiny -seed=random` |
|
||||
| -ldflags "flags" | Ldflags adicionais para passar para o compilador | |
|
||||
| -m | Skip mod tidy before compile | |
|
||||
| -nopackage | Não empacotar aplicação | |
|
||||
| -nocolour | Disable colour in output | |
|
||||
| -nosyncgomod | Do not sync go.mod with the Wails version | |
|
||||
| -nsis | Generate NSIS installer for Windows | |
|
||||
| -o nome de arquivo | Nome do Arquivo de Saída | |
|
||||
| -obfuscated | Ofuscar a aplicação usando [garble](https://github.com/burrowers/garble) | |
|
||||
| -platform | Compila para as plataformas [(delimitadas por vírgula)](../reference/cli.mdx#platforms) por exemplo. `windows/arm64`. Note, se você não der arquitetura, `runtime.GOARCH` é usado. | platform = `variável de ambiente GOOS` se determinado `runtime.GOOS`.<br/>arch = `GOARCH` variável de envrionment se for dado `runtime.GOARCH`. |
|
||||
| -race | Realiza build com o Go race detector | |
|
||||
| -s | Pular build do frontend | |
|
||||
| -skipbindings | Skip bindings generation | |
|
||||
| -tags "extra tags" | Compilar tags para passar para o compilador Go. Deve ser citado. Separados por espaço ou vírgula (mas não ambos) | |
|
||||
| -trimpath | Remove todos os caminhos do sistema de arquivo do executável resultante. | |
|
||||
| -u | Atualiza o `go.mod` do seu projeto para usar a mesma versão de Wails que o CLI | |
|
||||
| -upx | Comprimir binário final usando "upx" | |
|
||||
| -upxflags | Flags para passar para o upx | |
|
||||
| -v int | Nível de verbosidade(0 - silencioso, 1 - padrão, 2 - verbose) | 1 |
|
||||
| -webview2 | Estratégia de instalação WebView2: download,embed,browser,error | baixar |
|
||||
| -windowsconsole | Manter a janela de console para builds do Windows | |
|
||||
|
||||
Para uma descrição detalhada do sinalizador `webview2`, consulte o guia [Windows](../guides/windows.mdx).
|
||||
|
||||
@ -166,8 +166,8 @@ Your system is ready for Wails development!
|
||||
- Um servidor web foi iniciado em `http://localhost:34115` que serve sua aplicação (não apenas frontend) sobre http. Isso permite que você use suas extensões de desenvolvimento de navegador favoritas
|
||||
- Todos os conteúdos do aplicativo são carregados do disco. Se forem alterados, o aplicativo irá recarregar automaticamente (não reconstruir). Todos os navegadores conectados também recarregarão
|
||||
- A JS module is generated that provides the following:
|
||||
- JavaScript wrappers of your Go methods with autogenerated JSDoc, providing code hinting
|
||||
- TypeScript versions of your Go structs, that can be constructed and passed to your go methods
|
||||
- JavaScript wrappers of your Go methods with autogenerated JSDoc, providing code hinting
|
||||
- TypeScript versions of your Go structs, that can be constructed and passed to your go methods
|
||||
- A second JS module is generated that provides a wrapper + TS declaration for the runtime
|
||||
- On macOS, it will bundle the application into a `.app` file and run it. It will use a `build/darwin/Info.dev.plist` for development.
|
||||
|
||||
|
@ -4,9 +4,9 @@ sidebar_position: 4
|
||||
|
||||
# Menus
|
||||
|
||||
It is possible to add an application menu to Wails projects. This is achieved by defining a [Menu](#menu) struct and setting it in the [`Menu`](../reference/options.mdx#menu) application config, or by calling the runtime method [MenuSetApplicationMenu](../reference/runtime/menu.mdx#menusetapplicationmenu).
|
||||
É possível adicionar um menu de aplicação aos projetos do Wails. Isso é conseguido definindo uma struct [Menu](#menu) e configurando-a no configuração do aplicativo [`Menu`](../reference/options.mdx#menu) ou chamando o método [MenuSetApplicationMenu](../reference/runtime/menu.mdx#menusetapplicationmenu).
|
||||
|
||||
An example of how to create a menu:
|
||||
Um exemplo de como criar um menu:
|
||||
|
||||
```go
|
||||
|
||||
@ -36,13 +36,13 @@ An example of how to create a menu:
|
||||
// ...
|
||||
```
|
||||
|
||||
It is also possible to dynamically update the menu, by updating the menu struct and calling [MenuUpdateApplicationMenu](../reference/runtime/menu.mdx#menuupdateapplicationmenu).
|
||||
Também é possível atualizar dinamicamente o menu, atualizando o menu struct e chamando [MenuUpdateApplicationMenu](../reference/runtime/menu.mdx#menuupdateapplicationmenu).
|
||||
|
||||
The example above uses helper methods, however it's possible to build the menu structs manually.
|
||||
O exemplo acima usa métodos de ajuda, no entanto, é possível construir as construções do menu manualmente.
|
||||
|
||||
## Menu
|
||||
|
||||
A Menu is a collection of MenuItems:
|
||||
Um Menu é uma coleção de MenuItems:
|
||||
|
||||
```go title="Package: github.com/wailsapp/wails/v2/pkg/menu"
|
||||
type Menu struct {
|
||||
@ -50,19 +50,19 @@ type Menu struct {
|
||||
}
|
||||
```
|
||||
|
||||
For the Application menu, each MenuItem represents a single menu such as "Edit".
|
||||
Para o menu de Aplicação, cada MenuItem representa um único menu como "Editar".
|
||||
|
||||
A simple helper method is provided for building menus:
|
||||
Um método simples de ajuda é fornecido para menus de construção:
|
||||
|
||||
```go title="Package: github.com/wailsapp/wails/v2/pkg/menu"
|
||||
func NewMenuFromItems(first *MenuItem, rest ...*MenuItem) *Menu
|
||||
```
|
||||
|
||||
This makes the layout of the code more like that of a menu without the need to add the menu items manually after creating them. Alternatively, you can just create the menu items and add them to the menu manually.
|
||||
Isto torna o layout do código mais parecido com o de um menu sem a necessidade de adicionar os itens de menu manualmente depois de criá-los. Como alternativa, você pode apenas criar os itens de menu e adicioná-los ao menu manualmente.
|
||||
|
||||
## MenuItem
|
||||
|
||||
A MenuItem represents an item within a Menu.
|
||||
Um MenuItem representa um item dentro de um Menu.
|
||||
|
||||
```go title="Package: github.com/wailsapp/wails/v2/pkg/menu"
|
||||
// MenuItem represents a menu item contained in a menu
|
||||
@ -79,30 +79,30 @@ type MenuItem struct {
|
||||
}
|
||||
```
|
||||
|
||||
| Field | Type | Notes |
|
||||
| ----------- | ------------------------------------ | ------------------------------------------------------------- |
|
||||
| Label | string | The menu text |
|
||||
| Accelerator | [\*keys.Accelerator](#accelerator) | Key binding for this menu item |
|
||||
| Type | [Type](#type) | Type of MenuItem |
|
||||
| Disabled | bool | Disables the menu item |
|
||||
| Hidden | bool | Hides this menu item |
|
||||
| Checked | bool | Adds check to item (Checkbox & Radio types) |
|
||||
| SubMenu | [\*Menu](#menu) | Sets the submenu |
|
||||
| Click | [Callback](#callback) | Callback function when menu clicked |
|
||||
| Role | string | Defines a [role](#role) for this menu item. Mac only for now. |
|
||||
| Campo | Tipo | Notas |
|
||||
| ----------- | ------------------------------------ | -------------------------------------------------------------------------- |
|
||||
| Label | string | O texto do menu |
|
||||
| Accelerator | [\*keys.Accelerator](#accelerator) | Vinculação de teclas para este item de menu |
|
||||
| Tipo | [Tipo](#type) | Tipo de MenuItem |
|
||||
| Disabled | bool | Desativa o item de menu |
|
||||
| Hidden | bool | Oculta este item de menu |
|
||||
| Checked | bool | Adiciona uma seleção para o item ( & Tipos de Rádio) |
|
||||
| SubMenu | [\*Menu](#menu) | Define o submenu |
|
||||
| Click | [Callback](#callback) | Função Callback quando clicado no menu |
|
||||
| Role | string | Define um papel [](#role) para este item de menu. Mac apenas por enquanto. |
|
||||
|
||||
### Accelerator
|
||||
|
||||
Accelerators (sometimes called keyboard shortcuts) define a binding between a keystroke and a menu item. Wails defines an Accelerator as a combination or key + [Modifier](#modifier). They are available in the `"github.com/wailsapp/wails/v2/pkg/menu/keys"` package.
|
||||
Os aceleradores (às vezes chamados atalhos de teclado) definem uma ligação entre um toque de tecla e um item de menu. Lamentos define um Acelerador como uma combinação ou tecla + [Modificador](#modifier). Eles estão disponíveis no pacote `"github.com/wailsapp/wails/v2/pkg/menu/keys"`.
|
||||
|
||||
Example:
|
||||
Exemplo:
|
||||
|
||||
```go title="Package: github.com/wailsapp/wails/v2/pkg/menu/keys"
|
||||
// Defines cmd+o on Mac and ctrl-o on Window/Linux
|
||||
myShortcut := keys.CmdOrCtrl("o")
|
||||
```
|
||||
|
||||
Keys are any single character on a keyboard with the exception of `+`, which is defined as `plus`. Some keys cannot be represented as characters so there are a set of named characters that may be used:
|
||||
Teclas são qualquer caractere único em um teclado com exceção de `+`, que é definido como `plus`. Algumas chaves não podem ser representadas como caracteres, portanto há um conjunto de caracteres nomeados que podem ser usados:
|
||||
|
||||
| | | | |
|
||||
|:-----------:|:-----:|:-----:|:---------:|
|
||||
@ -122,18 +122,18 @@ Keys are any single character on a keyboard with the exception of `+`, which is
|
||||
| `page up` | `f14` | `f39` | |
|
||||
| `page down` | `f15` | `f30` | |
|
||||
|
||||
Wails also supports parsing accelerators using the same syntax as Electron. This is useful for storing accelerators in config files.
|
||||
Wails também suportam a análise de aceleradores usando a mesma sintaxe que o Electron. Isso é útil para armazenar aceleradores em arquivos de configuração.
|
||||
|
||||
Example:
|
||||
Exemplo:
|
||||
|
||||
```go title="Package: github.com/wailsapp/wails/v2/pkg/menu/keys"
|
||||
// Defines cmd+o on Mac and ctrl-o on Window/Linux
|
||||
myShortcut, err := keys.Parse("Ctrl+Option+A")
|
||||
```
|
||||
|
||||
#### Modifier
|
||||
#### Modificador
|
||||
|
||||
The following modifiers are keys that may be used in combination with the accelerator key:
|
||||
Os seguintes modificadores são chaves que podem ser usadas em combinação com a tecla de aceleração:
|
||||
|
||||
```go title="Package: github.com/wailsapp/wails/v2/pkg/menu/keys"
|
||||
const (
|
||||
@ -148,7 +148,7 @@ const (
|
||||
)
|
||||
```
|
||||
|
||||
A number of helper methods are available to create Accelerators using modifiers:
|
||||
Vários métodos de ajuda estão disponíveis para criar aceleradores usando modificadores:
|
||||
|
||||
```go title="Package: github.com/wailsapp/wails/v2/pkg/menu/keys"
|
||||
func CmdOrCtrl(key string) *Accelerator
|
||||
@ -157,16 +157,16 @@ func Shift(key string) *Accelerator
|
||||
func Control(key string) *Accelerator
|
||||
```
|
||||
|
||||
Modifiers can be combined using `keys.Combo(key string, modifier1 Modifier, modifier2 Modifier, rest ...Modifier)`:
|
||||
Modificadores podem ser combinados usando `keys.Combo(string de chaves, modificador 1 modificador, modificador modificador, rest ...Modificador)`:
|
||||
|
||||
```go title="Package: github.com/wailsapp/wails/v2/pkg/menu/keys"
|
||||
// Defines "Ctrl+Option+A" on Mac and "Ctrl+Alt+A" on Window/Linux
|
||||
myShortcut := keys.Combo("a", ControlKey, OptionOrAltKey)
|
||||
```
|
||||
|
||||
### Type
|
||||
### Tipo
|
||||
|
||||
Each menu item must have a type and there are 5 types available:
|
||||
Cada item de menu deve ter um tipo e existem 5 tipos disponíveis:
|
||||
|
||||
```go title="Package: github.com/wailsapp/wails/v2/pkg/menu"
|
||||
const (
|
||||
@ -178,7 +178,7 @@ const (
|
||||
)
|
||||
```
|
||||
|
||||
For convenience, helper methods are provided to quickly create a menu item:
|
||||
Para conveniência, métodos auxiliares são fornecidos para criar rapidamente um item de menu:
|
||||
|
||||
```go title="Package: github.com/wailsapp/wails/v2/pkg/menu"
|
||||
func Text(label string, accelerator *keys.Accelerator, click Callback) *MenuItem
|
||||
@ -188,7 +188,7 @@ func Checkbox(label string, checked bool, accelerator *keys.Accelerator, click C
|
||||
func SubMenu(label string, menu *Menu) *Menu
|
||||
```
|
||||
|
||||
You can also create menu items directly on a menu by using the "Add" helpers:
|
||||
Você também pode criar itens de menu diretamente em um menu, usando os ajudantes "Adicionar":
|
||||
|
||||
```go title="Package: github.com/wailsapp/wails/v2/pkg/menu"
|
||||
func (m *Menu) AddText(label string, accelerator *keys.Accelerator, click Callback) *MenuItem
|
||||
@ -198,11 +198,11 @@ func (m *Menu) AddCheckbox(label string, checked bool, accelerator *keys.Acceler
|
||||
func (m *Menu) AddSubMenu(label string, menu *Menu) *MenuI
|
||||
```
|
||||
|
||||
A note on radio groups: A radio group is defined as a number of radio menu items that are next to each other in the menu. This means that you do not need to group items together as it is automatic. However, that also means you cannot have 2 radio groups next to each other - there must be a non-radio item between them.
|
||||
Uma nota nos grupos de rádio: Um grupo de rádio é definido como um número de itens do menu de rádio que estão próximos um ao outro no menu. Isso significa que não é necessário agrupar os itens porque é automático. No entanto, isso também significa que você não pode ter 2 grupos lado a lado - deve haver um item que não seja de rádio entre eles.
|
||||
|
||||
### Callback
|
||||
|
||||
Each menu item may have a callback that is executed when the item is clicked:
|
||||
Cada item de menu pode ter um callback que é executado quando o item é clicado:
|
||||
|
||||
```go title="Package: github.com/wailsapp/wails/v2/pkg/menu"
|
||||
type Callback func(*CallbackData)
|
||||
@ -212,19 +212,19 @@ type CallbackData struct {
|
||||
}
|
||||
```
|
||||
|
||||
The function is given a `CallbackData` struct which indicates which menu item triggered the callback. This is useful when using radio groups that may share a callback.
|
||||
A função recebe uma instrução `CallbackData` que indica qual item de menu acionou a callback. Isso é útil quando usar grupos de rádio que podem compartilhar um callback.
|
||||
|
||||
### Role
|
||||
|
||||
:::info Roles
|
||||
:::info Regras
|
||||
|
||||
Roles are currently supported on Mac only.
|
||||
As regras que são atualmente suportados apenas no Mac.
|
||||
|
||||
:::
|
||||
|
||||
A menu item may have a role, which is essentially a pre-defined menu item. We currently support the following roles:
|
||||
Um item de menu pode ter uma função, que é essencialmente um item de menu pré-definido. Atualmente, apoiamos as seguintes funções:
|
||||
|
||||
| Role | Description |
|
||||
| ------------ | ------------------------------------------------------------------------ |
|
||||
| AppMenuRole | The standard Mac application menu. Can be created using `menu.AppMenu()` |
|
||||
| EditMenuRole | The standard Mac edit menu. Can be created using `menu.EditMenu()` |
|
||||
| Role | Descrição |
|
||||
| ------------ | --------------------------------------------------------------------------- |
|
||||
| AppMenuRole | Menu padrão do aplicativo para Mac. Pode ser criado usando `menu.AppMenu()` |
|
||||
| EditMenuRole | O menu de edição padrão para Mac. Pode ser criado usando `menu.EditMenu()` |
|
||||
|
@ -366,7 +366,7 @@ Name: CSSDragValue<br/> Type: `string`
|
||||
|
||||
EnableDefaultContextMenu enables the browser's default context-menu in production.
|
||||
|
||||
By default, the browser's default context-menu is only available in development and in a `-debug` or `-devtools` [build](../reference/cli.mdx#build) along with the devtools inspector, Using this option you can enable the default context-menu in `production` while the devtools inspector won't be available unless the `-devtools` build flag is used.
|
||||
By default, the browser's default context-menu is only available in development and in a `-debug` [build](../reference/cli.mdx#build) along with the devtools inspector, Using this option you can enable the default context-menu in `production` while the devtools inspector won't be available unless the `-devtools` build flag is used.
|
||||
|
||||
When this option is enabled, by default the context-menu will only be shown for text contexts (where Cut/Copy/Paste is needed), to override this behavior, you can use the CSS property `--default-contextmenu` on any HTML element (including the `body`) with the following values :
|
||||
|
||||
@ -593,6 +593,12 @@ Setting this to `true` will disable GPU hardware acceleration for the webview.
|
||||
|
||||
Name: WebviewGpuIsDisabled<br/> Type: `bool`
|
||||
|
||||
#### EnableSwipeGestures
|
||||
|
||||
Setting this to `true` will enable swipe gestures for the webview.
|
||||
|
||||
Name: EnableSwipeGestures<br/> Type: `bool`
|
||||
|
||||
### Mac
|
||||
|
||||
This defines [Mac specific options](#mac).
|
||||
@ -688,6 +694,42 @@ Setting this to `true` will make the window background translucent. Often combin
|
||||
|
||||
Name: WindowIsTranslucent<br/> Type: `bool`
|
||||
|
||||
#### Preferences
|
||||
|
||||
The Preferences struct provides the ability to configure the Webview preferences.
|
||||
|
||||
Name: Preferences<br/> Type: [`*mac.Preferences`](#preferences-struct)
|
||||
|
||||
##### Preferences struct
|
||||
|
||||
You can specify the webview preferences.
|
||||
|
||||
```go
|
||||
type Preferences struct {
|
||||
TabFocusesLinks u.Bool
|
||||
TextInteractionEnabled u.Bool
|
||||
FullscreenEnabled u.Bool
|
||||
}
|
||||
```
|
||||
|
||||
| Name | Description |
|
||||
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| TabFocusesLinks | A Boolean value that indicates whether pressing the tab key changes the focus to links and form controls. [Apple Docs](https://developer.apple.com/documentation/webkit/wkpreferences/2818595-tabfocuseslinks?language=objc) |
|
||||
| TextInteractionEnabled | A Boolean value that indicates whether to allow people to select or otherwise interact with text. [Apple Docs](https://developer.apple.com/documentation/webkit/wkpreferences/3727362-textinteractionenabled?language=objc) |
|
||||
| FullscreenEnabled | A Boolean value that indicates whether a web view can display content full screen. [Apple Docs](https://developer.apple.com/documentation/webkit/wkpreferences/3917769-elementfullscreenenabled?language=objc) |
|
||||
|
||||
Example:
|
||||
|
||||
```go
|
||||
Mac: &mac.Options{
|
||||
Preferences: &mac.Preferences{
|
||||
TabFocusesLinks: mac.Enabled,
|
||||
TextInteractionEnabled: mac.Disabled,
|
||||
FullscreenEnabled: mac.Enabled,
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### About
|
||||
|
||||
This configuration lets you set the title, message and icon for the "About" menu item in the app menu created by the "AppMenu" role.
|
||||
|
@ -4,35 +4,35 @@
|
||||
"description": "The label for version v2.3.1"
|
||||
},
|
||||
"sidebar.docs.category.Getting Started": {
|
||||
"message": "Getting Started",
|
||||
"message": "Guia de Introdução",
|
||||
"description": "The label for category Getting Started in sidebar docs"
|
||||
},
|
||||
"sidebar.docs.category.Reference": {
|
||||
"message": "Reference",
|
||||
"message": "Referência",
|
||||
"description": "The label for category Reference in sidebar docs"
|
||||
},
|
||||
"sidebar.docs.category.Runtime": {
|
||||
"message": "Runtime",
|
||||
"message": "Tempo de execução",
|
||||
"description": "The label for category Runtime in sidebar docs"
|
||||
},
|
||||
"sidebar.docs.category.Community": {
|
||||
"message": "Community",
|
||||
"message": "Comunidade",
|
||||
"description": "The label for category Community in sidebar docs"
|
||||
},
|
||||
"sidebar.docs.category.Showcase": {
|
||||
"message": "Showcase",
|
||||
"message": "Casos de sucesso",
|
||||
"description": "The label for category Showcase in sidebar docs"
|
||||
},
|
||||
"sidebar.docs.category.Guides": {
|
||||
"message": "Guides",
|
||||
"message": "Guias",
|
||||
"description": "The label for category Guides in sidebar docs"
|
||||
},
|
||||
"sidebar.docs.category.Tutorials": {
|
||||
"message": "Tutorials",
|
||||
"message": "Tutoriais",
|
||||
"description": "The label for category Tutorials in sidebar docs"
|
||||
},
|
||||
"sidebar.docs.link.Contributing": {
|
||||
"message": "Contributing",
|
||||
"message": "Contribuir",
|
||||
"description": "The label for link Contributing in sidebar docs, linking to /community-guide#ways-of-contributing"
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,28 @@ O formato é baseado em [Manter um Log de Alterações](https://keepachangelog.c
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Adicionado
|
||||
|
||||
- Added support for enabling/disabling swipe gestures for Windows WebView2. Added by @leaanthony in [PR](https://github.com/wailsapp/wails/pull/2878)
|
||||
- When building with `-devtools` flag, CMD/CTRL+SHIFT+F12 can be used to open the devtools. Added by @leaanthony in [PR](https://github.com/wailsapp/wails/pull/2915) – Added file association support for macOS and Windows. Added by @APshenkin in [PR](https://github.com/wailsapp/wails/pull/2918)
|
||||
- Added support for setting some of the Webview preferences, `textInteractionEnabled` and `tabFocusesLinks` on Mac. Added by @fkhadra in [PR](https://github.com/wailsapp/wails/pull/2937)
|
||||
- Added support for enabling/disabling fullscreen of the Webview on Mac. Added by @fkhadra in [PR](https://github.com/wailsapp/wails/pull/2953)
|
||||
- Added French README.fr.md page. Added by @nejos97 in [PR](https://github.com/wailsapp/wails/pull/2943)
|
||||
- New task created for linting v2 `task v2:lint`. Workflow updated to run the task. Added by @mikeee in [PR](https://github.com/wailsapp/wails/pull/2957)
|
||||
- Added new community template wails-htmx-templ-chi-tailwind. Added by [@pylotlight](https://github.com/pylotlight) in [PR](https://github.com/wailsapp/wails/pull/2984)
|
||||
- Added CPU/GPU/Memory detection for `wails doctor`. Added by @leaanthony in #d51268b8d0680430f3a614775b13e6cd2b906d1c
|
||||
|
||||
### Alterado
|
||||
|
||||
- AssetServer requests are now processed asynchronously without blocking the main thread on Windows. Changed by @stffabi in [PR](https://github.com/wailsapp/wails/pull/2926)
|
||||
- AssetServer requests are now processed concurrently by spawning a goroutine per request. Changed by @stffabi in [PR](https://github.com/wailsapp/wails/pull/2926)
|
||||
- Now building with `-devtools` flag doesn't enable the default context-menu. Changed by @mmghv in [PR](https://github.com/wailsapp/wails/pull/2923)
|
||||
- Change Window Level. Changed by @almas1992 in [PR](https://github.com/wailsapp/wails/pull/2944)
|
||||
#### Corrigido
|
||||
|
||||
- Fixed typo on docs/reference/options page. Added by [@pylotlight](https://github.com/pylotlight) in [PR](https://github.com/wailsapp/wails/pull/2887)
|
||||
- Fixed issue with npm being called npm20 on openSUSE-Tumbleweed. Fixed by @TuffenDuffen in [PR] in (https://github.com/wailsapp/wails/pull/2941)
|
||||
|
||||
## v2.6.0 - 2023-09-06
|
||||
|
||||
### Grandes Alterações
|
||||
@ -27,6 +49,7 @@ O formato é baseado em [Manter um Log de Alterações](https://keepachangelog.c
|
||||
- Fixed `SetBackgroundColour` so it sets the window's background color to reduce resize flickering on Linux. Added by @lyimmi in [PR](https://github.com/wailsapp/wails/pull/2853)
|
||||
- Fixed disable window resize option and wrong initial window size when its enabled. Added by @lyimmi in [PR](https://github.com/wailsapp/wails/pull/2863)
|
||||
- Fixed build hook command parsing. Added by @smac89 in [PR](https://github.com/wailsapp/wails/pull/2836)
|
||||
- Fixed filesystem watcher from filtering top level project directory if binary name is included in .gitignore. Added by [@haukened](https://github.com/haukened) in [PR #2869](https://github.com/wailsapp/wails/pull/2869)
|
||||
- Fixed `-reloaddir` flag to watch additional directories (non-recursively). [@haukened](https://github.com/haukened) in [PR #2871](https://github.com/wailsapp/wails/pull/2871)
|
||||
- Fixed support for Go 1.21 `go.mod` files. Fixed by @stffabi in [PR](https://github.com/wailsapp/wails/pull/2876)
|
||||
|
||||
@ -44,6 +67,7 @@ O formato é baseado em [Manter um Log de Alterações](https://keepachangelog.c
|
||||
- Added new community template wails-sveltekit-tailwind. Added by [@pylotlight](https://github.com/pylotlight) in [PR](https://github.com/wailsapp/wails/pull/2851)
|
||||
- Added support for print dialogs. Added by [@aangelisc](https://github.com/aangelisc) in [PR](https://github.com/wailsapp/wails/pull/2822)
|
||||
- Added new `wails dev -nogorebuild` flag to prevent restarts on back end file changes. [@haukened](https://github.com/haukened) in [PR #2870](https://github.com/wailsapp/wails/pull/2870)
|
||||
- Added a guide to describe a cross-platform build using GitHub Actions. Added by [@dennypenta](https://github.com/dennypenta) in [PR](https://github.com/wailsapp/wails/pull/2879)
|
||||
|
||||
### Alterado
|
||||
|
||||
@ -680,9 +704,6 @@ Experimental: &options.Experimental{
|
||||
|
||||
- [v2, nsis] Seems like / as path separator works only for some directives in a cross platform way by [@stffabi](https://github.com/stffabi) in #1227
|
||||
- import models on binding definition by [@adalessa](https://github.com/adalessa) in #123
|
||||
|
||||
1
|
||||
|
||||
- Use local search on website by [@leaanthony](https://github.com/leaanthony) in #1234
|
||||
- Ensure binary resources can be served by [@napalu](https://github.com/napalu) in #1240
|
||||
- Only retry loading assets when loading from disk by [@leaanthony](https://github.com/leaanthony) in #1241
|
||||
|
@ -60,6 +60,10 @@ sidebar_position: 1
|
||||
- [wails-elm-шаблон](https://github.com/benjamin-thomas/wails-elm-template) - Разработайте ваше GUI приложение с функциональным программированием и **snappy** настройками горячей перезагрузки :tada: :rocket:
|
||||
- [wails-template-elm-tailwind](https://github.com/rnice01/wails-template-elm-tailwind) - Объединение возможностей :muscle: Elm + Tailwind CSS + Wails! Поддерживается горячая перезагрузка.
|
||||
|
||||
## HTMX
|
||||
|
||||
- [wails-htmx-templ-chi-tailwind](https://github.com/PylotLight/wails-hmtx-templ-template) - Use a unique combination of pure htmx for interactivity plus templ for creating components and forms
|
||||
|
||||
## Чистый JavaScript (Vanilla)
|
||||
|
||||
- [wails-pure-js-шаблон](https://github.com/KiddoV/wails-pure-js-template) - шаблон, содержащий только базовый JavaScript, HTML и CSS
|
||||
|
@ -0,0 +1,66 @@
|
||||
# Crossplatform build with Github Actions
|
||||
|
||||
To build a Wails project for all the available platforms, you need to create an application build for each operating system. One effective method to achieve this is by utilizing GitHub Actions.
|
||||
|
||||
An action that facilitates building a Wails app is available at:
|
||||
https://github.com/dAppServer/wails-build-action
|
||||
|
||||
In case the existing action doesn't fulfill your requirements, you can select only the necessary steps from the source:
|
||||
https://github.com/dAppServer/wails-build-action/blob/main/action.yml
|
||||
|
||||
Below is a comprehensive example that demonstrates building an app upon the creation of a new Git tag and subsequently uploading it to the Actions artifacts:
|
||||
|
||||
```yaml
|
||||
name: Wails build
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
# Match any new tag
|
||||
- '*'
|
||||
|
||||
env:
|
||||
# Necessary for most environments as build failure can occur due to OOM issues
|
||||
NODE_OPTIONS: "--max-old-space-size=4096"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
# Failure in one platform build won't impact the others
|
||||
fail-fast: false
|
||||
matrix:
|
||||
build:
|
||||
- name: 'App'
|
||||
platform: 'linux/amd64'
|
||||
os: 'ubuntu-latest'
|
||||
- name: 'App'
|
||||
platform: 'windows/amd64'
|
||||
os: 'windows-latest'
|
||||
- name: 'App'
|
||||
platform: 'darwin/universal'
|
||||
os: 'macos-latest'
|
||||
|
||||
runs-on: ${{ matrix.build.os }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Build wails
|
||||
uses: dAppServer/wails-build-action@v2.2
|
||||
id: build
|
||||
with:
|
||||
build-name: ${{ matrix.build.name }}
|
||||
build-platform: ${{ matrix.build.platform }}
|
||||
package: false
|
||||
go-version: '1.20'
|
||||
```
|
||||
|
||||
This example offers opportunities for various enhancements, including:
|
||||
|
||||
- Caching dependencies
|
||||
- Code signing
|
||||
- Uploading to platforms like S3, Supbase, etc.
|
||||
- Injecting secrets as environment variables
|
||||
- Utilizing environment variables as build variables (such as version variable extracted from the current Git tag)
|
@ -0,0 +1,199 @@
|
||||
# File Association
|
||||
|
||||
File association feature allows you to associate specific file types with your app so that when users open those files,
|
||||
your app is launched to handle them. This can be particularly useful for text editors, image viewers, or any application
|
||||
that works with specific file formats. In this guide, we'll walk through the steps to implement file association in Wails app.
|
||||
|
||||
## Set Up File Association:
|
||||
|
||||
To set up file association, you need to modify your application's wails.json file.
|
||||
In "info" section add a "fileAssociations" section specifying the file types your app should be associated with.
|
||||
|
||||
For example:
|
||||
|
||||
```json
|
||||
{
|
||||
"info": {
|
||||
"fileAssociations": [
|
||||
{
|
||||
"ext": "wails",
|
||||
"name": "Wails",
|
||||
"description": "Wails Application File",
|
||||
"iconName": "wailsFileIcon",
|
||||
"role": "Editor"
|
||||
},
|
||||
{
|
||||
"ext": "jpg",
|
||||
"name": "JPEG",
|
||||
"description": "Image File",
|
||||
"iconName": "jpegFileIcon",
|
||||
"role": "Editor"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
| Property | Description |
|
||||
| :---------- | :------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| ext | The extension (minus the leading period). e.g. png |
|
||||
| name | The name. e.g. PNG File |
|
||||
| iconName | The icon name without extension. Icons should be located in build folder. Proper icons will be generated from .png file for both macOS and Windows |
|
||||
| description | Windows-only. The description. It is displayed on the `Type` column on Windows Explorer. |
|
||||
| role | macOS-only. The app’s role with respect to the type. Corresponds to CFBundleTypeRole. |
|
||||
|
||||
## Platform Specifics:
|
||||
|
||||
### macOS
|
||||
|
||||
When you open file (or files) with your app, the system will launch your app and call the `OnFileOpen` function in your Wails app. Example:
|
||||
|
||||
```go title="main.go"
|
||||
func main() {
|
||||
// Create application with options
|
||||
err := wails.Run(&options.App{
|
||||
Title: "wails-open-file",
|
||||
Width: 1024,
|
||||
Height: 768,
|
||||
AssetServer: &assetserver.Options{
|
||||
Assets: assets,
|
||||
},
|
||||
BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1},
|
||||
Mac: &mac.Options{
|
||||
OnFileOpen: func(filePaths []string) { println(filestring) },
|
||||
},
|
||||
Bind: []interface{}{
|
||||
app,
|
||||
},
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
println("Error:", err.Error())
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Windows
|
||||
|
||||
On Windows file association is supported only with NSIS installer. During installation, the installer will create a
|
||||
registry entry for your file associations. When you open file with your app, new instance of app is launched and file path is passed
|
||||
as argument to your app. To handle this you should parse command line arguments in your app. Example:
|
||||
|
||||
```go title="main.go"
|
||||
func main() {
|
||||
argsWithoutProg := os.Args[1:]
|
||||
|
||||
if len(argsWithoutProg) != 0 {
|
||||
println("launchArgs", argsWithoutProg)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Linux
|
||||
|
||||
Currently, Wails doesn't support bundling for Linux. So, you need to create file associations manually.
|
||||
For example if you distribute your app as a .deb package, you can create file associations by adding required files in you bundle.
|
||||
You can use [nfpm](https://nfpm.goreleaser.com/) to create .deb package for your app.
|
||||
|
||||
1. Create a .desktop file for your app and specify file associations there. Example:
|
||||
|
||||
```ini
|
||||
[Desktop Entry]
|
||||
Categories=Office
|
||||
Exec=/usr/bin/wails-open-file %u
|
||||
Icon=wails-open-file.png
|
||||
Name=wails-open-file
|
||||
Terminal=false
|
||||
Type=Application
|
||||
MimeType=application/x-wails;application/x-test
|
||||
```
|
||||
|
||||
2. Create mime types file. Example:
|
||||
|
||||
```xml
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
|
||||
<mime-type type="application/x-wails">
|
||||
<comment>Wails Application File</comment>
|
||||
<glob pattern="*.wails"/>
|
||||
</mime-type>
|
||||
</mime-info>
|
||||
```
|
||||
|
||||
3. Create icons for your file types. SVG icons are recommended.
|
||||
4. Prepare postInstall/postRemove scripts for your package. Example:
|
||||
|
||||
```sh
|
||||
# reload mime types to register file associations
|
||||
update-mime-database /usr/share/mime
|
||||
# reload desktop database to load app in list of available
|
||||
update-desktop-database /usr/share/applications
|
||||
# update icons
|
||||
update-icon-caches /usr/share/icons/*
|
||||
```
|
||||
|
||||
5. Configure nfpm to use your scripts and files. Example:
|
||||
|
||||
```yaml
|
||||
name: "wails-open-file"
|
||||
arch: "arm64"
|
||||
platform: "linux"
|
||||
version: "1.0.0"
|
||||
section: "default"
|
||||
priority: "extra"
|
||||
maintainer: "FooBarCorp <FooBarCorp@gmail.com>"
|
||||
description: "Sample Package"
|
||||
vendor: "FooBarCorp"
|
||||
homepage: "http://example.com"
|
||||
license: "MIT"
|
||||
contents:
|
||||
- src: ../bin/wails-open-file
|
||||
dst: /usr/bin/wails-open-file
|
||||
- src: ./main.desktop
|
||||
dst: /usr/share/applications/wails-open-file.desktop
|
||||
- src: ./application-wails-mime.xml
|
||||
dst: /usr/share/mime/packages/application-x-wails.xml
|
||||
- src: ./application-test-mime.xml
|
||||
dst: /usr/share/mime/packages/application-x-test.xml
|
||||
- src: ../appicon.svg
|
||||
dst: /usr/share/icons/hicolor/scalable/apps/wails-open-file.svg
|
||||
- src: ../wailsFileIcon.svg
|
||||
dst: /usr/share/icons/hicolor/scalable/mimetypes/application-x-wails.svg
|
||||
- src: ../testFileIcon.svg
|
||||
dst: /usr/share/icons/hicolor/scalable/mimetypes/application-x-test.svg
|
||||
# copy icons to Yaru theme as well. For some reason Ubuntu didn't pick up fileicons from hicolor theme
|
||||
- src: ../appicon.svg
|
||||
dst: /usr/share/icons/Yaru/scalable/apps/wails-open-file.svg
|
||||
- src: ../wailsFileIcon.svg
|
||||
dst: /usr/share/icons/Yaru/scalable/mimetypes/application-x-wails.svg
|
||||
- src: ../testFileIcon.svg
|
||||
dst: /usr/share/icons/Yaru/scalable/mimetypes/application-x-test.svg
|
||||
scripts:
|
||||
postinstall: ./postInstall.sh
|
||||
postremove: ./postRemove.sh
|
||||
```
|
||||
|
||||
6. Build your .deb package using nfpm:
|
||||
|
||||
```sh
|
||||
nfpm pkg --packager deb --target .
|
||||
```
|
||||
|
||||
7. Now when your package is installed, your app will be associated with specified file types. When you open file with your app,
|
||||
new instance of app is launched and file path is passed as argument to your app.
|
||||
To handle this you should parse command line arguments in your app. Example:
|
||||
|
||||
```go title="main.go"
|
||||
func main() {
|
||||
argsWithoutProg := os.Args[1:]
|
||||
|
||||
if len(argsWithoutProg) != 0 {
|
||||
println("launchArgs", argsWithoutProg)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Limitations:
|
||||
|
||||
On Windows and Linux when associated file is opened, new instance of your app is launched.
|
||||
Currently, Wails doesn't support opening files in already running app. There is plugin for single instance support for v3 in development.
|
@ -159,6 +159,28 @@ If `/Applications/Xcode.app/Contents/Developer` is displayed, run `sudo xcode-se
|
||||
|
||||
Sources: https://github.com/wailsapp/wails/issues/1806 and https://github.com/wailsapp/wails/issues/1140#issuecomment-1290446496
|
||||
|
||||
## My application won't compile on Mac
|
||||
|
||||
If you are getting errors like this:
|
||||
|
||||
```shell
|
||||
l1@m2 GoEasyDesigner % go build -tags dev -gcflags "all=-N -l"
|
||||
/Users/l1/sdk/go1.20.5/pkg/tool/darwin_arm64/link: running clang failed: exit status 1
|
||||
Undefined symbols for architecture arm64:
|
||||
"_OBJC_CLASS_$_UTType", referenced from:
|
||||
objc-class-ref in 000016.o
|
||||
ld: symbol(s) not found for architecture arm64
|
||||
clang: error: linker command failed with exit code 1 (use -v to see invocation)
|
||||
```
|
||||
Ensure you have the latest SDK installed. If so and you're still experiencing this issue, try the following:
|
||||
|
||||
```shell
|
||||
export CGO_LDFLAGS="-framework UniformTypeIdentifiers" && go build -tags dev -gcflags "all=-N -l"
|
||||
```
|
||||
|
||||
Sources: https://github.com/wailsapp/wails/pull/2925#issuecomment-1726828562
|
||||
|
||||
|
||||
--
|
||||
|
||||
## Cannot start service: Host version "x.x.x does not match binary version "x.x.x"
|
||||
@ -185,4 +207,162 @@ This is due to the default background of the webview being white. If you want to
|
||||
WebviewIsTransparent: true,
|
||||
},
|
||||
})
|
||||
```
|
||||
```
|
||||
|
||||
## I get a "Microsoft Edge can't read or write to its data directory" error when running my program as admin on Windows
|
||||
|
||||
You set your program to require admin permissions and it worked great! Unfortunately, some users are seeing a "Microsoft Edge can't read or write to its data directory" error when running it.
|
||||
|
||||
When a Windows machine has two local accounts:
|
||||
|
||||
- Alice, an admin
|
||||
- Bob, a regular user
|
||||
|
||||
Bob sees a UAC prompt when running your program. Bob enters Alice's admin credentials into this prompt. The app launches with admin permissions under Alice's account.
|
||||
|
||||
Wails instructs WebView2 to store user data at the specified `WebviewUserDataPath`. It defaults to `%APPDATA%\[BinaryName.exe]`.
|
||||
|
||||
Because the application is running under Alice's account, `%APPDATA%\[BinaryName.exe]` resolves to `C:\Users\Alice\AppData\Roaming\[BinaryName.exe]`.
|
||||
|
||||
WebView2 [creates some child processes under Bob's logged-in account instead of Alice's admin account](https://github.com/MicrosoftEdge/WebView2Feedback/issues/932#issue-807464179). Since Bob cannot access `C:\Users\Alice\AppData\Roaming\[BinaryName.exe]`, the "Microsoft Edge can't read or write to its data directory" error is shown.
|
||||
|
||||
Possible solution #1:
|
||||
|
||||
Refactor your application to work without constant admin permissions. If you just need to perform a small set of admin tasks (such as running an updater), you can run your application with the minimum permissions and then use the `runas` command to run these tasks with admin permissions as needed:
|
||||
|
||||
```go
|
||||
//go:build windows
|
||||
|
||||
package sample
|
||||
|
||||
import (
|
||||
"golang.org/x/sys/windows"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// Calling RunAs("C:\path\to\my\updater.exe") shows Bob a UAC prompt. Bob enters Alice's admin credentials. The updater launches with admin permissions under Alice's account.
|
||||
func RunAs(path string) error {
|
||||
verbPtr, _ := syscall.UTF16PtrFromString("runas")
|
||||
exePtr, _ := syscall.UTF16PtrFromString(path)
|
||||
cwdPtr, _ := syscall.UTF16PtrFromString("")
|
||||
argPtr, _ := syscall.UTF16PtrFromString("")
|
||||
|
||||
var showCmd int32 = 1 //SW_NORMAL
|
||||
|
||||
err := windows.ShellExecute(0, verbPtr, exePtr, argPtr, cwdPtr, showCmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
```
|
||||
|
||||
Possible solution #2:
|
||||
|
||||
Run your application with extended permissions. If you absolutely must run with constant admin permissions, WebView2 will function correctly if you use a data directory accessible by both users and you also launch your app with the `SeBackupPrivilege`, `SeDebugPrivilege`, and `SeRestorePrivilege` permissions. Here's an example:
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"os"
|
||||
"runtime"
|
||||
|
||||
"github.com/fourcorelabs/wintoken"
|
||||
"github.com/hectane/go-acl"
|
||||
"github.com/wailsapp/wails/v2"
|
||||
"github.com/wailsapp/wails/v2/pkg/options"
|
||||
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
|
||||
"github.com/wailsapp/wails/v2/pkg/options/windows"
|
||||
)
|
||||
|
||||
//go:embed all:frontend/dist
|
||||
var assets embed.FS
|
||||
|
||||
const (
|
||||
fixedTokenKey = "SAMPLE_RANDOM_KEY"
|
||||
fixedTokenVal = "with-fixed-token"
|
||||
webviewDir = "C:\\ProgramData\\Sample"
|
||||
)
|
||||
|
||||
func runWithFixedToken() {
|
||||
println("Re-launching self")
|
||||
token, err := wintoken.OpenProcessToken(0, wintoken.TokenPrimary) //pass 0 for own process
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer token.Close()
|
||||
|
||||
token.EnableTokenPrivileges([]string{
|
||||
"SeBackupPrivilege",
|
||||
"SeDebugPrivilege",
|
||||
"SeRestorePrivilege",
|
||||
})
|
||||
|
||||
cmd := exec.Command(os.Args[0])
|
||||
cmd.Args = os.Args
|
||||
cmd.Env = os.Environ()
|
||||
cmd.Env = append(cmd.Env, fmt.Sprintf("%v=%v", fixedTokenKey, fixedTokenVal))
|
||||
cmd.Stdin = os.Stdin
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{Token: syscall.Token(token.Token())}
|
||||
if err := cmd.Run(); err != nil {
|
||||
println("Error after launching self:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
println("Clean self launch :)")
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
func main() {
|
||||
if runtime.GOOS == "windows" && os.Getenv(fixedTokenKey) != fixedTokenVal {
|
||||
runWithFixedToken()
|
||||
}
|
||||
|
||||
println("Setting data dir to", webviewDir)
|
||||
if err := os.MkdirAll(webviewDir, os.ModePerm); err != nil {
|
||||
println("Failed creating dir:", err)
|
||||
}
|
||||
if err := acl.Chmod(webviewDir, 0777); err != nil {
|
||||
println("Failed setting ACL on dir:", err)
|
||||
}
|
||||
|
||||
app := NewApp()
|
||||
|
||||
err := wails.Run(&options.App{
|
||||
Title: "sample-data-dir",
|
||||
Width: 1024,
|
||||
Height: 768,
|
||||
AssetServer: &assetserver.Options{
|
||||
Assets: assets,
|
||||
},
|
||||
Bind: []interface{}{
|
||||
app,
|
||||
},
|
||||
Windows: &windows.Options{
|
||||
WebviewUserDataPath: webviewDir,
|
||||
},
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
println("Error:", err.Error())
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If you use a data directory accessible by both users but not the extended privileges, you will receive a WebView2 `80010108 The object invoked has disconnected from its clients` error.
|
||||
|
||||
Possible future solution #3: [run WebView2 using an in-memory mode if implemented](https://github.com/MicrosoftEdge/WebView2Feedback/issues/3637#issuecomment-1728300982).
|
||||
|
||||
## WebView2 installation succeeded, but the wails doctor command shows that it is not installed
|
||||
|
||||
If you have installed WebView2, but the `wails doctor` command shows that it is not installed, it is likely that the WebView2 runtime installed was for a different architecture. You can download the correct runtime from [here](https://developer.microsoft.com/en-us/microsoft-edge/webview2/).
|
||||
|
||||
Source: https://github.com/wailsapp/wails/issues/2917
|
||||
|
||||
## WebVie2wProcess failed with kind
|
||||
|
||||
If your Windows app generates this kind of error, you can check out what the error means [here](https://docs.microsoft.com/en-us/microsoft-edge/webview2/reference/winrt/microsoft_web_webview2_core/corewebview2processfailedkind?view=webview2-winrt-1.0.2045.28).
|
||||
|
||||
|
@ -49,35 +49,35 @@ If you are unsure about a template, inspect `package.json` and `wails.json` for
|
||||
|
||||
`wails build` is used for compiling your project to a production-ready binary.
|
||||
|
||||
| Flag | Description | Default |
|
||||
|:-------------------- |:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |:--------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| -clean | Cleans the `build/bin` directory | |
|
||||
| -compiler "compiler" | Use a different go compiler to build, eg go1.15beta1 | go |
|
||||
| -debug | Retains debug information in the application and shows the debug console. Allows the use of the devtools in the application window | |
|
||||
| -devtools | Allows the use of the devtools in the application window in production (when -debug is not used) | |
|
||||
| -dryrun | Prints the build command without executing it | |
|
||||
| -f | Force build application | |
|
||||
| -garbleargs | Arguments to pass to garble | `-literals -tiny -seed=random` |
|
||||
| -ldflags "flags" | Additional ldflags to pass to the compiler | |
|
||||
| -m | Skip mod tidy before compile | |
|
||||
| -nopackage | Do not package application | |
|
||||
| -nocolour | Disable colour in output | |
|
||||
| -nosyncgomod | Do not sync go.mod with the Wails version | |
|
||||
| -nsis | Generate NSIS installer for Windows | |
|
||||
| -o filename | Output filename | |
|
||||
| -obfuscated | Obfuscate the application using [garble](https://github.com/burrowers/garble) | |
|
||||
| -platform | Build for the given (comma delimited) [platforms](../reference/cli.mdx#platforms) eg. `windows/arm64`. Note, if you do not give the architecture, `runtime.GOARCH` is used. | platform = `GOOS` environment variable if given else `runtime.GOOS`.<br/>arch = `GOARCH` envrionment variable if given else `runtime.GOARCH`. |
|
||||
| -race | Build with Go's race detector | |
|
||||
| -s | Skip building the frontend | |
|
||||
| -skipbindings | Skip bindings generation | |
|
||||
| -tags "extra tags" | Build tags to pass to Go compiler. Must be quoted. Space or comma (but not both) separated | |
|
||||
| -trimpath | Remove all file system paths from the resulting executable. | |
|
||||
| -u | Updates your project's `go.mod` to use the same version of Wails as the CLI | |
|
||||
| -upx | Compress final binary using "upx" | |
|
||||
| -upxflags | Flags to pass to upx | |
|
||||
| -v int | Verbosity level (0 - silent, 1 - default, 2 - verbose) | 1 |
|
||||
| -webview2 | WebView2 installer strategy: download,embed,browser,error | download |
|
||||
| -windowsconsole | Keep the console window for Windows builds | |
|
||||
| Flag | Description | Default |
|
||||
|:-------------------- |:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |:--------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| -clean | Cleans the `build/bin` directory | |
|
||||
| -compiler "compiler" | Use a different go compiler to build, eg go1.15beta1 | go |
|
||||
| -debug | Retains debug information in the application and shows the debug console. Allows the use of the devtools in the application window | |
|
||||
| -devtools | Allows the use of the devtools in the application window in production (when -debug is not used). Ctrl/Cmd+Shift+F12 may be used to open the devtools window. *NOTE*: This option will make your application FAIL Mac appstore guidelines. Use for debugging only. | |
|
||||
| -dryrun | Prints the build command without executing it | |
|
||||
| -f | Force build application | |
|
||||
| -garbleargs | Arguments to pass to garble | `-literals -tiny -seed=random` |
|
||||
| -ldflags "flags" | Additional ldflags to pass to the compiler | |
|
||||
| -m | Skip mod tidy before compile | |
|
||||
| -nopackage | Do not package application | |
|
||||
| -nocolour | Disable colour in output | |
|
||||
| -nosyncgomod | Do not sync go.mod with the Wails version | |
|
||||
| -nsis | Generate NSIS installer for Windows | |
|
||||
| -o filename | Output filename | |
|
||||
| -obfuscated | Obfuscate the application using [garble](https://github.com/burrowers/garble) | |
|
||||
| -platform | Build for the given (comma delimited) [platforms](../reference/cli.mdx#platforms) eg. `windows/arm64`. Note, if you do not give the architecture, `runtime.GOARCH` is used. | platform = `GOOS` environment variable if given else `runtime.GOOS`.<br/>arch = `GOARCH` envrionment variable if given else `runtime.GOARCH`. |
|
||||
| -race | Build with Go's race detector | |
|
||||
| -s | Skip building the frontend | |
|
||||
| -skipbindings | Skip bindings generation | |
|
||||
| -tags "extra tags" | Build tags to pass to Go compiler. Must be quoted. Space or comma (but not both) separated | |
|
||||
| -trimpath | Remove all file system paths from the resulting executable. | |
|
||||
| -u | Updates your project's `go.mod` to use the same version of Wails as the CLI | |
|
||||
| -upx | Compress final binary using "upx" | |
|
||||
| -upxflags | Flags to pass to upx | |
|
||||
| -v int | Verbosity level (0 - silent, 1 - default, 2 - verbose) | 1 |
|
||||
| -webview2 | WebView2 installer strategy: download,embed,browser,error | download |
|
||||
| -windowsconsole | Keep the console window for Windows builds | |
|
||||
|
||||
For a detailed description of the `webview2` flag, please refer to the [Windows](../guides/windows.mdx) Guide.
|
||||
|
||||
@ -166,8 +166,8 @@ Your system is ready for Wails development!
|
||||
- A webserver is started on `http://localhost:34115` which serves your application (not just frontend) over http. This allows you to use your favourite browser development extensions
|
||||
- All application assets are loaded from disk. If they are changed, the application will automatically reload (not rebuild). All connected browsers will also reload
|
||||
- A JS module is generated that provides the following:
|
||||
- JavaScript wrappers of your Go methods with autogenerated JSDoc, providing code hinting
|
||||
- TypeScript versions of your Go structs, that can be constructed and passed to your go methods
|
||||
- JavaScript wrappers of your Go methods with autogenerated JSDoc, providing code hinting
|
||||
- TypeScript versions of your Go structs, that can be constructed and passed to your go methods
|
||||
- A second JS module is generated that provides a wrapper + TS declaration for the runtime
|
||||
- On macOS, it will bundle the application into a `.app` file and run it. It will use a `build/darwin/Info.dev.plist` for development.
|
||||
|
||||
|
@ -366,7 +366,7 @@ Name: CSSDragValue<br/> Type: `string`
|
||||
|
||||
EnableDefaultContextMenu enables the browser's default context-menu in production.
|
||||
|
||||
By default, the browser's default context-menu is only available in development and in a `-debug` or `-devtools` [build](../reference/cli.mdx#build) along with the devtools inspector, Using this option you can enable the default context-menu in `production` while the devtools inspector won't be available unless the `-devtools` build flag is used.
|
||||
By default, the browser's default context-menu is only available in development and in a `-debug` [build](../reference/cli.mdx#build) along with the devtools inspector, Using this option you can enable the default context-menu in `production` while the devtools inspector won't be available unless the `-devtools` build flag is used.
|
||||
|
||||
When this option is enabled, by default the context-menu will only be shown for text contexts (where Cut/Copy/Paste is needed), to override this behavior, you can use the CSS property `--default-contextmenu` on any HTML element (including the `body`) with the following values :
|
||||
|
||||
@ -593,6 +593,12 @@ Setting this to `true` will disable GPU hardware acceleration for the webview.
|
||||
|
||||
Name: WebviewGpuIsDisabled<br/> Type: `bool`
|
||||
|
||||
#### EnableSwipeGestures
|
||||
|
||||
Setting this to `true` will enable swipe gestures for the webview.
|
||||
|
||||
Name: EnableSwipeGestures<br/> Type: `bool`
|
||||
|
||||
### Mac
|
||||
|
||||
This defines [Mac specific options](#mac).
|
||||
@ -688,6 +694,42 @@ Setting this to `true` will make the window background translucent. Often combin
|
||||
|
||||
Name: WindowIsTranslucent<br/> Type: `bool`
|
||||
|
||||
#### Preferences
|
||||
|
||||
The Preferences struct provides the ability to configure the Webview preferences.
|
||||
|
||||
Name: Preferences<br/> Type: [`*mac.Preferences`](#preferences-struct)
|
||||
|
||||
##### Preferences struct
|
||||
|
||||
You can specify the webview preferences.
|
||||
|
||||
```go
|
||||
type Preferences struct {
|
||||
TabFocusesLinks u.Bool
|
||||
TextInteractionEnabled u.Bool
|
||||
FullscreenEnabled u.Bool
|
||||
}
|
||||
```
|
||||
|
||||
| Name | Description |
|
||||
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| TabFocusesLinks | A Boolean value that indicates whether pressing the tab key changes the focus to links and form controls. [Apple Docs](https://developer.apple.com/documentation/webkit/wkpreferences/2818595-tabfocuseslinks?language=objc) |
|
||||
| TextInteractionEnabled | A Boolean value that indicates whether to allow people to select or otherwise interact with text. [Apple Docs](https://developer.apple.com/documentation/webkit/wkpreferences/3727362-textinteractionenabled?language=objc) |
|
||||
| FullscreenEnabled | A Boolean value that indicates whether a web view can display content full screen. [Apple Docs](https://developer.apple.com/documentation/webkit/wkpreferences/3917769-elementfullscreenenabled?language=objc) |
|
||||
|
||||
Example:
|
||||
|
||||
```go
|
||||
Mac: &mac.Options{
|
||||
Preferences: &mac.Preferences{
|
||||
TabFocusesLinks: mac.Enabled,
|
||||
TextInteractionEnabled: mac.Disabled,
|
||||
FullscreenEnabled: mac.Enabled,
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### About
|
||||
|
||||
This configuration lets you set the title, message and icon for the "About" menu item in the app menu created by the "AppMenu" role.
|
||||
|
@ -13,6 +13,28 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
- Added support for enabling/disabling swipe gestures for Windows WebView2. Added by @leaanthony in [PR](https://github.com/wailsapp/wails/pull/2878)
|
||||
- When building with `-devtools` flag, CMD/CTRL+SHIFT+F12 can be used to open the devtools. Added by @leaanthony in [PR](https://github.com/wailsapp/wails/pull/2915) – Added file association support for macOS and Windows. Added by @APshenkin in [PR](https://github.com/wailsapp/wails/pull/2918)
|
||||
- Added support for setting some of the Webview preferences, `textInteractionEnabled` and `tabFocusesLinks` on Mac. Added by @fkhadra in [PR](https://github.com/wailsapp/wails/pull/2937)
|
||||
- Added support for enabling/disabling fullscreen of the Webview on Mac. Added by @fkhadra in [PR](https://github.com/wailsapp/wails/pull/2953)
|
||||
- Added French README.fr.md page. Added by @nejos97 in [PR](https://github.com/wailsapp/wails/pull/2943)
|
||||
- New task created for linting v2 `task v2:lint`. Workflow updated to run the task. Added by @mikeee in [PR](https://github.com/wailsapp/wails/pull/2957)
|
||||
- Added new community template wails-htmx-templ-chi-tailwind. Added by [@pylotlight](https://github.com/pylotlight) in [PR](https://github.com/wailsapp/wails/pull/2984)
|
||||
- Added CPU/GPU/Memory detection for `wails doctor`. Added by @leaanthony in #d51268b8d0680430f3a614775b13e6cd2b906d1c
|
||||
|
||||
### Changed
|
||||
|
||||
- AssetServer requests are now processed asynchronously without blocking the main thread on Windows. Changed by @stffabi in [PR](https://github.com/wailsapp/wails/pull/2926)
|
||||
- AssetServer requests are now processed concurrently by spawning a goroutine per request. Changed by @stffabi in [PR](https://github.com/wailsapp/wails/pull/2926)
|
||||
- Now building with `-devtools` flag doesn't enable the default context-menu. Changed by @mmghv in [PR](https://github.com/wailsapp/wails/pull/2923)
|
||||
- Change Window Level. Changed by @almas1992 in [PR](https://github.com/wailsapp/wails/pull/2944)
|
||||
#### Fixed
|
||||
|
||||
- Fixed typo on docs/reference/options page. Added by [@pylotlight](https://github.com/pylotlight) in [PR](https://github.com/wailsapp/wails/pull/2887)
|
||||
- Fixed issue with npm being called npm20 on openSUSE-Tumbleweed. Fixed by @TuffenDuffen in [PR] in (https://github.com/wailsapp/wails/pull/2941)
|
||||
|
||||
## v2.6.0 - 2023-09-06
|
||||
|
||||
### Breaking Changes
|
||||
@ -27,6 +49,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
- Fixed `SetBackgroundColour` so it sets the window's background color to reduce resize flickering on Linux. Added by @lyimmi in [PR](https://github.com/wailsapp/wails/pull/2853)
|
||||
- Fixed disable window resize option and wrong initial window size when its enabled. Added by @lyimmi in [PR](https://github.com/wailsapp/wails/pull/2863)
|
||||
- Fixed build hook command parsing. Added by @smac89 in [PR](https://github.com/wailsapp/wails/pull/2836)
|
||||
- Fixed filesystem watcher from filtering top level project directory if binary name is included in .gitignore. Added by [@haukened](https://github.com/haukened) in [PR #2869](https://github.com/wailsapp/wails/pull/2869)
|
||||
- Fixed `-reloaddir` flag to watch additional directories (non-recursively). [@haukened](https://github.com/haukened) in [PR #2871](https://github.com/wailsapp/wails/pull/2871)
|
||||
- Fixed support for Go 1.21 `go.mod` files. Fixed by @stffabi in [PR](https://github.com/wailsapp/wails/pull/2876)
|
||||
|
||||
@ -44,6 +67,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
- Added new community template wails-sveltekit-tailwind. Added by [@pylotlight](https://github.com/pylotlight) in [PR](https://github.com/wailsapp/wails/pull/2851)
|
||||
- Added support for print dialogs. Added by [@aangelisc](https://github.com/aangelisc) in [PR](https://github.com/wailsapp/wails/pull/2822)
|
||||
- Added new `wails dev -nogorebuild` flag to prevent restarts on back end file changes. [@haukened](https://github.com/haukened) in [PR #2870](https://github.com/wailsapp/wails/pull/2870)
|
||||
- Added a guide to describe a cross-platform build using GitHub Actions. Added by [@dennypenta](https://github.com/dennypenta) in [PR](https://github.com/wailsapp/wails/pull/2879)
|
||||
|
||||
### Changed
|
||||
|
||||
@ -680,9 +704,6 @@ Experimental: &options.Experimental{
|
||||
|
||||
- [v2, nsis] Seems like / as path separator works only for some directives in a cross platform way by [@stffabi](https://github.com/stffabi) in #1227
|
||||
- import models on binding definition by [@adalessa](https://github.com/adalessa) in #123
|
||||
|
||||
1
|
||||
|
||||
- Use local search on website by [@leaanthony](https://github.com/leaanthony) in #1234
|
||||
- Ensure binary resources can be served by [@napalu](https://github.com/napalu) in #1240
|
||||
- Only retry loading assets when loading from disk by [@leaanthony](https://github.com/leaanthony) in #1241
|
||||
|
431
website/i18n/vi/code.json
Normal file
431
website/i18n/vi/code.json
Normal file
@ -0,0 +1,431 @@
|
||||
{
|
||||
"homepage.Features.Title1": {
|
||||
"message": "Feature Rich"
|
||||
},
|
||||
"homepage.Features.Description1": {
|
||||
"message": "Build comprehensive cross-platform applications using native UI elements such as menus and dialogs."
|
||||
},
|
||||
"homepage.Features.Title2": {
|
||||
"message": "Familiar"
|
||||
},
|
||||
"homepage.Features.Description2": {
|
||||
"message": "Use the technologies you already know to build amazing applications."
|
||||
},
|
||||
"homepage.Features.Title3": {
|
||||
"message": "Fast"
|
||||
},
|
||||
"homepage.Features.Description3": {
|
||||
"message": "Quickly generate, build and package your projects using the Wails CLI."
|
||||
},
|
||||
"homepage.Tagline": {
|
||||
"message": "Build beautiful cross-platform applications using Go"
|
||||
},
|
||||
"homepage.ButtonText": {
|
||||
"message": "Get Started"
|
||||
},
|
||||
"homepage.LearnMoreButtonText": {
|
||||
"message": "Learn More"
|
||||
},
|
||||
"theme.ErrorPageContent.title": {
|
||||
"message": "This page crashed.",
|
||||
"description": "The title of the fallback page when the page crashed"
|
||||
},
|
||||
"theme.ErrorPageContent.tryAgain": {
|
||||
"message": "Try again",
|
||||
"description": "The label of the button to try again rendering when the React error boundary captures an error"
|
||||
},
|
||||
"theme.NotFound.title": {
|
||||
"message": "Page Not Found",
|
||||
"description": "The title of the 404 page"
|
||||
},
|
||||
"theme.NotFound.p1": {
|
||||
"message": "We could not find what you were looking for.",
|
||||
"description": "The first paragraph of the 404 page"
|
||||
},
|
||||
"theme.NotFound.p2": {
|
||||
"message": "Please contact the owner of the site that linked you to the original URL and let them know their link is broken.",
|
||||
"description": "The 2nd paragraph of the 404 page"
|
||||
},
|
||||
"theme.AnnouncementBar.closeButtonAriaLabel": {
|
||||
"message": "Close",
|
||||
"description": "The ARIA label for close button of announcement bar"
|
||||
},
|
||||
"theme.blog.archive.title": {
|
||||
"message": "Archive",
|
||||
"description": "The page & hero title of the blog archive page"
|
||||
},
|
||||
"theme.blog.archive.description": {
|
||||
"message": "Archive",
|
||||
"description": "The page & hero description of the blog archive page"
|
||||
},
|
||||
"theme.BackToTopButton.buttonAriaLabel": {
|
||||
"message": "Scroll back to top",
|
||||
"description": "The ARIA label for the back to top button"
|
||||
},
|
||||
"theme.blog.paginator.navAriaLabel": {
|
||||
"message": "Blog list page navigation",
|
||||
"description": "The ARIA label for the blog pagination"
|
||||
},
|
||||
"theme.blog.paginator.newerEntries": {
|
||||
"message": "Newer Entries",
|
||||
"description": "The label used to navigate to the newer blog posts page (previous page)"
|
||||
},
|
||||
"theme.blog.paginator.olderEntries": {
|
||||
"message": "Older Entries",
|
||||
"description": "The label used to navigate to the older blog posts page (next page)"
|
||||
},
|
||||
"theme.blog.post.readingTime.plurals": {
|
||||
"message": "One min read|{readingTime} min read",
|
||||
"description": "Pluralized label for \"{readingTime} min read\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)"
|
||||
},
|
||||
"theme.blog.post.readMoreLabel": {
|
||||
"message": "Read more about {title}",
|
||||
"description": "The ARIA label for the link to full blog posts from excerpts"
|
||||
},
|
||||
"theme.blog.post.readMore": {
|
||||
"message": "Read More",
|
||||
"description": "The label used in blog post item excerpts to link to full blog posts"
|
||||
},
|
||||
"theme.blog.post.paginator.navAriaLabel": {
|
||||
"message": "Blog post page navigation",
|
||||
"description": "The ARIA label for the blog posts pagination"
|
||||
},
|
||||
"theme.blog.post.paginator.newerPost": {
|
||||
"message": "Newer Post",
|
||||
"description": "The blog post button label to navigate to the newer/previous post"
|
||||
},
|
||||
"theme.blog.post.paginator.olderPost": {
|
||||
"message": "Older Post",
|
||||
"description": "The blog post button label to navigate to the older/next post"
|
||||
},
|
||||
"theme.blog.sidebar.navAriaLabel": {
|
||||
"message": "Blog recent posts navigation",
|
||||
"description": "The ARIA label for recent posts in the blog sidebar"
|
||||
},
|
||||
"theme.blog.post.plurals": {
|
||||
"message": "One post|{count} posts",
|
||||
"description": "Pluralized label for \"{count} posts\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)"
|
||||
},
|
||||
"theme.blog.tagTitle": {
|
||||
"message": "{nPosts} tagged with \"{tagName}\"",
|
||||
"description": "The title of the page for a blog tag"
|
||||
},
|
||||
"theme.tags.tagsPageLink": {
|
||||
"message": "View All Tags",
|
||||
"description": "The label of the link targeting the tag list page"
|
||||
},
|
||||
"theme.CodeBlock.copyButtonAriaLabel": {
|
||||
"message": "Copy code to clipboard",
|
||||
"description": "The ARIA label for copy code blocks button"
|
||||
},
|
||||
"theme.CodeBlock.copied": {
|
||||
"message": "Copied",
|
||||
"description": "The copied button label on code blocks"
|
||||
},
|
||||
"theme.CodeBlock.copy": {
|
||||
"message": "Copy",
|
||||
"description": "The copy button label on code blocks"
|
||||
},
|
||||
"theme.colorToggle.ariaLabel": {
|
||||
"message": "Switch between dark and light mode (currently {mode})",
|
||||
"description": "The ARIA label for the navbar color mode toggle"
|
||||
},
|
||||
"theme.colorToggle.ariaLabel.mode.dark": {
|
||||
"message": "dark mode",
|
||||
"description": "The name for the dark color mode"
|
||||
},
|
||||
"theme.colorToggle.ariaLabel.mode.light": {
|
||||
"message": "light mode",
|
||||
"description": "The name for the light color mode"
|
||||
},
|
||||
"theme.docs.DocCard.categoryDescription": {
|
||||
"message": "{count} items",
|
||||
"description": "The default description for a category card in the generated index about how many items this category includes"
|
||||
},
|
||||
"theme.docs.sidebar.expandButtonTitle": {
|
||||
"message": "Expand sidebar",
|
||||
"description": "The ARIA label and title attribute for expand button of doc sidebar"
|
||||
},
|
||||
"theme.docs.sidebar.expandButtonAriaLabel": {
|
||||
"message": "Expand sidebar",
|
||||
"description": "The ARIA label and title attribute for expand button of doc sidebar"
|
||||
},
|
||||
"theme.docs.paginator.navAriaLabel": {
|
||||
"message": "Docs pages navigation",
|
||||
"description": "The ARIA label for the docs pagination"
|
||||
},
|
||||
"theme.docs.paginator.previous": {
|
||||
"message": "Previous",
|
||||
"description": "The label used to navigate to the previous doc"
|
||||
},
|
||||
"theme.docs.paginator.next": {
|
||||
"message": "Next",
|
||||
"description": "The label used to navigate to the next doc"
|
||||
},
|
||||
"theme.docs.sidebar.collapseButtonTitle": {
|
||||
"message": "Collapse sidebar",
|
||||
"description": "The title attribute for collapse button of doc sidebar"
|
||||
},
|
||||
"theme.docs.sidebar.collapseButtonAriaLabel": {
|
||||
"message": "Collapse sidebar",
|
||||
"description": "The title attribute for collapse button of doc sidebar"
|
||||
},
|
||||
"theme.DocSidebarItem.toggleCollapsedCategoryAriaLabel": {
|
||||
"message": "Toggle the collapsible sidebar category '{label}'",
|
||||
"description": "The ARIA label to toggle the collapsible sidebar category"
|
||||
},
|
||||
"theme.docs.tagDocListPageTitle.nDocsTagged": {
|
||||
"message": "One doc tagged|{count} docs tagged",
|
||||
"description": "Pluralized label for \"{count} docs tagged\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)"
|
||||
},
|
||||
"theme.docs.tagDocListPageTitle": {
|
||||
"message": "{nDocsTagged} with \"{tagName}\"",
|
||||
"description": "The title of the page for a docs tag"
|
||||
},
|
||||
"theme.docs.versionBadge.label": {
|
||||
"message": "Version: {versionLabel}"
|
||||
},
|
||||
"theme.docs.versions.unreleasedVersionLabel": {
|
||||
"message": "This is unreleased documentation for {siteTitle} {versionLabel} version.",
|
||||
"description": "The label used to tell the user that he's browsing an unreleased doc version"
|
||||
},
|
||||
"theme.docs.versions.unmaintainedVersionLabel": {
|
||||
"message": "This is documentation for {siteTitle} {versionLabel}, which is no longer actively maintained.",
|
||||
"description": "The label used to tell the user that he's browsing an unmaintained doc version"
|
||||
},
|
||||
"theme.docs.versions.latestVersionSuggestionLabel": {
|
||||
"message": "For up-to-date documentation, see the {latestVersionLink} ({versionLabel}).",
|
||||
"description": "The label used to tell the user to check the latest version"
|
||||
},
|
||||
"theme.docs.versions.latestVersionLinkLabel": {
|
||||
"message": "latest version",
|
||||
"description": "The label used for the latest version suggestion link label"
|
||||
},
|
||||
"theme.common.editThisPage": {
|
||||
"message": "Edit this page",
|
||||
"description": "The link label to edit the current page"
|
||||
},
|
||||
"theme.common.headingLinkTitle": {
|
||||
"message": "Direct link to heading",
|
||||
"description": "Title for link to heading"
|
||||
},
|
||||
"theme.lastUpdated.atDate": {
|
||||
"message": " on {date}",
|
||||
"description": "The words used to describe on which date a page has been last updated"
|
||||
},
|
||||
"theme.lastUpdated.byUser": {
|
||||
"message": " by {user}",
|
||||
"description": "The words used to describe by who the page has been last updated"
|
||||
},
|
||||
"theme.lastUpdated.lastUpdatedAtBy": {
|
||||
"message": "Last updated{atDate}{byUser}",
|
||||
"description": "The sentence used to display when a page has been last updated, and by who"
|
||||
},
|
||||
"theme.navbar.mobileSidebarSecondaryMenu.backButtonLabel": {
|
||||
"message": "← Back to main menu",
|
||||
"description": "The label of the back button to return to main menu, inside the mobile navbar sidebar secondary menu (notably used to display the docs sidebar)"
|
||||
},
|
||||
"theme.navbar.mobileVersionsDropdown.label": {
|
||||
"message": "Versions",
|
||||
"description": "The label for the navbar versions dropdown on mobile view"
|
||||
},
|
||||
"theme.common.skipToMainContent": {
|
||||
"message": "Skip to main content",
|
||||
"description": "The skip to content label used for accessibility, allowing to rapidly navigate to main content with keyboard tab/enter navigation"
|
||||
},
|
||||
"theme.tags.tagsListLabel": {
|
||||
"message": "Tags:",
|
||||
"description": "The label alongside a tag list"
|
||||
},
|
||||
"theme.TOCCollapsible.toggleButtonLabel": {
|
||||
"message": "On this page",
|
||||
"description": "The label used by the button on the collapsible TOC component"
|
||||
},
|
||||
"theme.navbar.mobileLanguageDropdown.label": {
|
||||
"message": "Languages",
|
||||
"description": "The label for the mobile language switcher dropdown"
|
||||
},
|
||||
"theme.SearchBar.seeAll": {
|
||||
"message": "See all {count} results"
|
||||
},
|
||||
"theme.SearchBar.label": {
|
||||
"message": "Search",
|
||||
"description": "The ARIA label and placeholder for search button"
|
||||
},
|
||||
"theme.SearchPage.documentsFound.plurals": {
|
||||
"message": "One document found|{count} documents found",
|
||||
"description": "Pluralized label for \"{count} documents found\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)"
|
||||
},
|
||||
"theme.SearchPage.existingResultsTitle": {
|
||||
"message": "Search results for \"{query}\"",
|
||||
"description": "The search page title for non-empty query"
|
||||
},
|
||||
"theme.SearchPage.emptyResultsTitle": {
|
||||
"message": "Search the documentation",
|
||||
"description": "The search page title for empty query"
|
||||
},
|
||||
"theme.SearchPage.inputPlaceholder": {
|
||||
"message": "Type your search here",
|
||||
"description": "The placeholder for search page input"
|
||||
},
|
||||
"theme.SearchPage.inputLabel": {
|
||||
"message": "Search",
|
||||
"description": "The ARIA label for search page input"
|
||||
},
|
||||
"theme.SearchPage.algoliaLabel": {
|
||||
"message": "Search by Algolia",
|
||||
"description": "The ARIA label for Algolia mention"
|
||||
},
|
||||
"theme.SearchPage.noResultsText": {
|
||||
"message": "No results were found",
|
||||
"description": "The paragraph for empty search result"
|
||||
},
|
||||
"theme.SearchPage.fetchingNewResults": {
|
||||
"message": "Fetching new results...",
|
||||
"description": "The paragraph for fetching new search results"
|
||||
},
|
||||
"theme.tags.tagsPageTitle": {
|
||||
"message": "Tags",
|
||||
"description": "The title of the tag list page"
|
||||
},
|
||||
"theme.docs.breadcrumbs.home": {
|
||||
"message": "Home page",
|
||||
"description": "The ARIA label for the home page in the breadcrumbs"
|
||||
},
|
||||
"theme.docs.breadcrumbs.navAriaLabel": {
|
||||
"message": "Breadcrumbs",
|
||||
"description": "The ARIA label for the breadcrumbs"
|
||||
},
|
||||
"theme.CodeBlock.wordWrapToggle": {
|
||||
"message": "Toggle word wrap",
|
||||
"description": "The title attribute for toggle word wrapping button of code block lines"
|
||||
},
|
||||
"theme.admonition.note": {
|
||||
"message": "note",
|
||||
"description": "The default label used for the Note admonition (:::note)"
|
||||
},
|
||||
"theme.admonition.tip": {
|
||||
"message": "tip",
|
||||
"description": "The default label used for the Tip admonition (:::tip)"
|
||||
},
|
||||
"theme.admonition.danger": {
|
||||
"message": "danger",
|
||||
"description": "The default label used for the Danger admonition (:::danger)"
|
||||
},
|
||||
"theme.admonition.info": {
|
||||
"message": "info",
|
||||
"description": "The default label used for the Info admonition (:::info)"
|
||||
},
|
||||
"theme.admonition.caution": {
|
||||
"message": "caution",
|
||||
"description": "The default label used for the Caution admonition (:::caution)"
|
||||
},
|
||||
"theme.SearchModal.searchBox.resetButtonTitle": {
|
||||
"message": "Clear the query",
|
||||
"description": "The label and ARIA label for search box reset button"
|
||||
},
|
||||
"theme.SearchModal.searchBox.cancelButtonText": {
|
||||
"message": "Cancel",
|
||||
"description": "The label and ARIA label for search box cancel button"
|
||||
},
|
||||
"theme.SearchModal.startScreen.recentSearchesTitle": {
|
||||
"message": "Recent",
|
||||
"description": "The title for recent searches"
|
||||
},
|
||||
"theme.SearchModal.startScreen.noRecentSearchesText": {
|
||||
"message": "No recent searches",
|
||||
"description": "The text when no recent searches"
|
||||
},
|
||||
"theme.SearchModal.startScreen.saveRecentSearchButtonTitle": {
|
||||
"message": "Save this search",
|
||||
"description": "The label for save recent search button"
|
||||
},
|
||||
"theme.SearchModal.startScreen.removeRecentSearchButtonTitle": {
|
||||
"message": "Remove this search from history",
|
||||
"description": "The label for remove recent search button"
|
||||
},
|
||||
"theme.SearchModal.startScreen.favoriteSearchesTitle": {
|
||||
"message": "Favorite",
|
||||
"description": "The title for favorite searches"
|
||||
},
|
||||
"theme.SearchModal.startScreen.removeFavoriteSearchButtonTitle": {
|
||||
"message": "Remove this search from favorites",
|
||||
"description": "The label for remove favorite search button"
|
||||
},
|
||||
"theme.SearchModal.errorScreen.titleText": {
|
||||
"message": "Unable to fetch results",
|
||||
"description": "The title for error screen of search modal"
|
||||
},
|
||||
"theme.SearchModal.errorScreen.helpText": {
|
||||
"message": "You might want to check your network connection.",
|
||||
"description": "The help text for error screen of search modal"
|
||||
},
|
||||
"theme.SearchModal.footer.selectText": {
|
||||
"message": "to select",
|
||||
"description": "The explanatory text of the action for the enter key"
|
||||
},
|
||||
"theme.SearchModal.footer.selectKeyAriaLabel": {
|
||||
"message": "Enter key",
|
||||
"description": "The ARIA label for the Enter key button that makes the selection"
|
||||
},
|
||||
"theme.SearchModal.footer.navigateText": {
|
||||
"message": "to navigate",
|
||||
"description": "The explanatory text of the action for the Arrow up and Arrow down key"
|
||||
},
|
||||
"theme.SearchModal.footer.navigateUpKeyAriaLabel": {
|
||||
"message": "Arrow up",
|
||||
"description": "The ARIA label for the Arrow up key button that makes the navigation"
|
||||
},
|
||||
"theme.SearchModal.footer.navigateDownKeyAriaLabel": {
|
||||
"message": "Arrow down",
|
||||
"description": "The ARIA label for the Arrow down key button that makes the navigation"
|
||||
},
|
||||
"theme.SearchModal.footer.closeText": {
|
||||
"message": "to close",
|
||||
"description": "The explanatory text of the action for Escape key"
|
||||
},
|
||||
"theme.SearchModal.footer.closeKeyAriaLabel": {
|
||||
"message": "Escape key",
|
||||
"description": "The ARIA label for the Escape key button that close the modal"
|
||||
},
|
||||
"theme.SearchModal.footer.searchByText": {
|
||||
"message": "Search by",
|
||||
"description": "The text explain that the search is making by Algolia"
|
||||
},
|
||||
"theme.SearchModal.noResultsScreen.noResultsText": {
|
||||
"message": "No results for",
|
||||
"description": "The text explains that there are no results for the following search"
|
||||
},
|
||||
"theme.SearchModal.noResultsScreen.suggestedQueryText": {
|
||||
"message": "Try searching for",
|
||||
"description": "The text for the suggested query when no results are found for the following search"
|
||||
},
|
||||
"theme.SearchModal.noResultsScreen.reportMissingResultsText": {
|
||||
"message": "Believe this query should return results?",
|
||||
"description": "The text for the question where the user thinks there are missing results"
|
||||
},
|
||||
"theme.SearchModal.noResultsScreen.reportMissingResultsLinkText": {
|
||||
"message": "Let us know.",
|
||||
"description": "The text for the link to report missing results"
|
||||
},
|
||||
"theme.SearchModal.placeholder": {
|
||||
"message": "Search docs",
|
||||
"description": "The placeholder of the input of the DocSearch pop-up modal"
|
||||
},
|
||||
"theme.docs.sidebar.closeSidebarButtonAriaLabel": {
|
||||
"message": "Close navigation bar",
|
||||
"description": "The ARIA label for close button of mobile sidebar"
|
||||
},
|
||||
"theme.docs.sidebar.toggleSidebarButtonAriaLabel": {
|
||||
"message": "Toggle navigation bar",
|
||||
"description": "The ARIA label for hamburger menu button of mobile navigation"
|
||||
},
|
||||
"theme.NavBar.navAriaLabel": {
|
||||
"message": "Main",
|
||||
"description": "The ARIA label for the main navigation"
|
||||
},
|
||||
"theme.docs.sidebar.navAriaLabel": {
|
||||
"message": "Docs sidebar",
|
||||
"description": "The ARIA label for the sidebar navigation"
|
||||
}
|
||||
}
|
@ -0,0 +1,161 @@
|
||||
---
|
||||
slug: wails-v2-beta-for-windows
|
||||
title: Wails v2 Beta for Windows
|
||||
authors:
|
||||
- leaanthony
|
||||
tags:
|
||||
- wails
|
||||
- v2
|
||||
---
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
<img
|
||||
src={require("@site/static/img/wails.webp").default}
|
||||
width="40%"
|
||||
class="screenshot"
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
```
|
||||
|
||||
When I first announced Wails on Reddit, just over 2 years ago from a train in Sydney, I did not expect it to get much attention. A few days later, a prolific tech vlogger released a tutorial video, gave it a positive review and from that point on, interest in the project has skyrocketed.
|
||||
|
||||
It was clear that people were excited about adding web frontends to their Go projects, and almost immediately pushed the project beyond the proof of concept that I had created. At the time, Wails used the [webview](https://github.com/webview/webview) project to handle the frontend, and the only option for Windows was the IE11 renderer. Many bug reports were rooted in this limitation: poor JavaScript/CSS support and no dev tools to debug it. This was a frustrating development experience but there wasn't much that could have been done to rectify it.
|
||||
|
||||
For a long time, I'd firmly believed that Microsoft would eventually have to sort out their browser situation. The world was moving on, frontend development was booming and IE wasn't cutting it. When Microsoft announced the move to using Chromium as the basis for their new browser direction, I knew it was only a matter of time until Wails could use it, and move the Windows developer experience to the next level.
|
||||
|
||||
Today, I am pleased to announce: **Wails v2 Beta for Windows**! There's a huge amount to unpack in this release, so grab a drink, take a seat and we'll begin...
|
||||
|
||||
### No CGO Dependency!
|
||||
|
||||
No, I'm not joking: _No_ _CGO_ _dependency_ 🤯! The thing about Windows is that, unlike MacOS and Linux, it doesn't come with a default compiler. In addition, CGO requires a mingw compiler and there's a ton of different installation options. Removing the CGO requirement has massively simplified setup, as well as making debugging an awful lot easier. Whilst I have put a fair bit of effort in getting this working, the majority of the credit should go to [John Chadwick](https://github.com/jchv) for not only starting a couple of projects to make this possible, but also being open to someone taking those projects and building on them. Credit also to [Tad Vizbaras](https://github.com/tadvi) whose [winc](https://github.com/tadvi/winc) project started me down this path.
|
||||
|
||||
### WebView2 Chromium Renderer
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
<img
|
||||
src={require("@site/static/img/devtools.png").default}
|
||||
width="75%"
|
||||
class="screenshot"
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
```
|
||||
|
||||
Finally, Windows developers get a first class rendering engine for their applications! Gone are the days of contorting your frontend code to work on Windows. On top of that, you get a first-class developer tools experience!
|
||||
|
||||
The WebView2 component does, however, have a requirement to have the `WebView2Loader.dll` sitting alongside the binary. This makes distribution just that little bit more painful than we gophers are used to. All solutions and libraries (that I know of) that use WebView2 have this dependency.
|
||||
|
||||
However, I'm really excited to announce that Wails applications _have no such requirement_! Thanks to the wizardry of [John Chadwick](https://github.com/jchv), we are able to bundle this dll inside the binary and get Windows to load it as if it were present on disk.
|
||||
|
||||
Gophers rejoice! The single binary dream lives on!
|
||||
|
||||
### New Features
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
<img
|
||||
src={require("@site/static/img/wails-menus.webp").default}
|
||||
width="60%"
|
||||
class="screenshot"
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
```
|
||||
|
||||
There were a lot of requests for native menu support. Wails has finally got you covered. Application menus are now available and include support for most native menu features. This includes standard menu items, checkboxes, radio groups, submenus and separators.
|
||||
|
||||
There were a huge number of requests in v1 for the ability to have greater control of the window itself. I'm happy to announce that there's new runtime APIs specifically for this. It's feature-rich and supports multi-monitor configurations. There is also an improved dialogs API: Now, you can have modern, native dialogs with rich configuration to cater for all your dialog needs.
|
||||
|
||||
There is now the option to generate IDE configuration along with your project. This means that if you open your project in a supported IDE, it will already be configured for building and debugging your application. Currently VSCode is supported but we hope to support other IDEs such as Goland soon.
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
<img
|
||||
src={require("@site/static/img/vscode.webp").default}
|
||||
width="100%"
|
||||
class="screenshot"
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
```
|
||||
|
||||
### No requirement to bundle assets
|
||||
|
||||
A huge pain-point of v1 was the need to condense your entire application down to single JS & CSS files. I'm happy to announce that for v2, there is no requirement to bundle assets, in any way, shape or form. Want to load a local image? Use an `<img>` tag with a local src path. Want to use a cool font? Copy it in and add the path to it in your CSS.
|
||||
|
||||
> Wow, that sounds like a webserver...
|
||||
|
||||
Yes, it works just like a webserver, except it isn't.
|
||||
|
||||
> So how do I include my assets?
|
||||
|
||||
You just pass a single `embed.FS` that contains all your assets into your application configuration. They don't even need to be in the top directory - Wails will just work it out for you.
|
||||
|
||||
### New Development Experience
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
<img
|
||||
src={require("@site/static/img/browser.webp").default}
|
||||
width="60%"
|
||||
class="screenshot"
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
```
|
||||
|
||||
Now that assets don't need to be bundled, it's enabled a whole new development experience. The new `wails dev` command will build and run your application, but instead of using the assets in the `embed.FS`, it loads them directly from disk.
|
||||
|
||||
It also provides the additional features:
|
||||
|
||||
- Hot reload - Any changes to frontend assets will trigger and auto reload of the application frontend
|
||||
- Auto rebuild - Any changes to your Go code will rebuild and relaunch your application
|
||||
|
||||
In addition to this, a webserver will start on port 34115. This will serve your application to any browser that connects to it. All connected web browsers will respond to system events like hot reload on asset change.
|
||||
|
||||
In Go, we are used to dealing with structs in our applications. It's often useful to send structs to our frontend and use them as state in our application. In v1, this was a very manual process and a bit of a burden on the developer. I'm happy to announce that in v2, any application run in dev mode will automatically generate TypeScript models for all structs that are input or output parameters to bound methods. This enables seamless interchange of data models between the two worlds.
|
||||
|
||||
In addition to this, another JS module is dynamically generated wrapping all your bound methods. This provides JSDoc for your methods, providing code completion and hinting in your IDE. It's really cool when you get data models auto-imported when hitting tab in an auto-generated module wrapping your Go code!
|
||||
|
||||
### Remote Templates
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
<img
|
||||
src={require("@site/static/img/remote.webp").default}
|
||||
width="60%"
|
||||
class="screenshot"
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
```
|
||||
|
||||
Getting an application up and running quickly was always a key goal for the Wails project. When we launched, we tried to cover a lot of the modern frameworks at the time: react, vue and angular. The world of frontend development is very opinionated, fast moving and hard to keep on top of! As a result, we found our base templates getting out of date pretty quickly and this caused a maintenance headache. It also meant that we didn't have cool modern templates for the latest and greatest tech stacks.
|
||||
|
||||
With v2, I wanted to empower the community by giving you the ability to create and host templates yourselves, rather than rely on the Wails project. So now you can create projects using community supported templates! I hope this will inspire developers to create a vibrant ecosystem of project templates. I'm really quite excited about what our developer community can create!
|
||||
|
||||
### In Conclusion
|
||||
|
||||
Wails v2 represents a new foundation for the project. The aim of this release is to get feedback on the new approach, and to iron out any bugs before a full release. Your input would be most welcome. Please direct any feedback to the [v2 Beta](https://github.com/wailsapp/wails/discussions/828) discussion board.
|
||||
|
||||
There were many twists and turns, pivots and u-turns to get to this point. This was due partly to early technical decisions that needed changing, and partly because some core problems we had spent time building workarounds for were fixed upstream: Go’s embed feature is a good example. Fortunately, everything came together at the right time, and today we have the very best solution that we can have. I believe the wait has been worth it - this would not have been possible even 2 months ago.
|
||||
|
||||
I also need to give a huge thank you :pray: to the following people because without them, this release just wouldn't exist:
|
||||
|
||||
- [Misite Bao](https://github.com/misitebao) - An absolute workhorse on the Chinese translations and an incredible bug finder.
|
||||
- [John Chadwick](https://github.com/jchv) - His amazing work on [go-webview2](https://github.com/jchv/go-webview2) and [go-winloader](https://github.com/jchv/go-winloader) have made the Windows version we have today possible.
|
||||
- [Tad Vizbaras](https://github.com/tadvi) - Experimenting with his [winc](https://github.com/tadvi/winc) project was the first step down the path to a pure Go Wails.
|
||||
- [Mat Ryer](https://github.com/matryer) - His support, encouragement and feedback has really helped drive the project forward.
|
||||
|
||||
And finally, I'd like to give a special thank you to all the [project sponsors](/credits#sponsors), including [JetBrains](https://www.jetbrains.com?from=Wails), whose support drive the project in many ways behind the scenes.
|
||||
|
||||
I look forward to seeing what people build with Wails in this next exciting phase of the project!
|
||||
|
||||
Lea.
|
||||
|
||||
PS: MacOS and Linux users need not feel left out - porting to this new foundation is actively under way and most of the hard work has already been done. Hang in there!
|
||||
|
||||
PPS: If you or your company find Wails useful, please consider [sponsoring the project](https://github.com/sponsors/leaanthony). Thanks!
|
@ -0,0 +1,170 @@
|
||||
---
|
||||
slug: wails-v2-beta-for-mac
|
||||
title: Wails v2 Beta for MacOS
|
||||
authors:
|
||||
- leaanthony
|
||||
tags:
|
||||
- wails
|
||||
- v2
|
||||
---
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
<img
|
||||
src={require("@site/static/img/wails-mac.webp").default}
|
||||
width="60%"
|
||||
class="screenshot"
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
```
|
||||
|
||||
Today marks the first beta release of Wails v2 for Mac! It's taken quite a while to get to this point and I'm hoping that today's release will give you something that's reasonably useful. There have been a number of twists and turns to get to this point and I'm hoping, with your help, to iron out the crinkles and get the Mac port polished for the final v2 release.
|
||||
|
||||
You mean this isn't ready for production? For your use case, it may well be ready, but there are still a number of known issues so keep your eye on [this project board](https://github.com/wailsapp/wails/projects/7) and if you would like to contribute, you'd be very welcome!
|
||||
|
||||
So what's new for Wails v2 for Mac vs v1? Hint: It's pretty similar to the Windows Beta :wink:
|
||||
|
||||
### New Features
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
<img
|
||||
src={require("@site/static/img/wails-menus-mac.webp").default}
|
||||
width="80%"
|
||||
class="screenshot"
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
```
|
||||
|
||||
There were a lot of requests for native menu support. Wails has finally got you covered. Application menus are now available and include support for most native menu features. This includes standard menu items, checkboxes, radio groups, submenus and separators.
|
||||
|
||||
There were a huge number of requests in v1 for the ability to have greater control of the window itself. I'm happy to announce that there's new runtime APIs specifically for this. It's feature-rich and supports multi-monitor configurations. There is also an improved dialogs API: Now, you can have modern, native dialogs with rich configuration to cater for all your dialog needs.
|
||||
|
||||
### Mac Specific Options
|
||||
|
||||
In addition to the normal application options, Wails v2 for Mac also brings some Mac extras:
|
||||
|
||||
- Make your window all funky and translucent, like all the pretty swift apps!
|
||||
- Highly customisable titlebar
|
||||
- We support the NSAppearance options for the application
|
||||
- Simple config to auto-create an "About" menu
|
||||
|
||||
### No requirement to bundle assets
|
||||
|
||||
A huge pain-point of v1 was the need to condense your entire application down to single JS & CSS files. I'm happy to announce that for v2, there is no requirement to bundle assets, in any way, shape or form. Want to load a local image? Use an `<img>` tag with a local src path. Want to use a cool font? Copy it in and add the path to it in your CSS.
|
||||
|
||||
> Wow, that sounds like a webserver...
|
||||
|
||||
Yes, it works just like a webserver, except it isn't.
|
||||
|
||||
> So how do I include my assets?
|
||||
|
||||
You just pass a single `embed.FS` that contains all your assets into your application configuration. They don't even need to be in the top directory - Wails will just work it out for you.
|
||||
|
||||
### New Development Experience
|
||||
|
||||
Now that assets don't need to be bundled, it's enabled a whole new development experience. The new `wails dev` command will build and run your application, but instead of using the assets in the `embed.FS`, it loads them directly from disk.
|
||||
|
||||
It also provides the additional features:
|
||||
|
||||
- Hot reload - Any changes to frontend assets will trigger and auto reload of the application frontend
|
||||
- Auto rebuild - Any changes to your Go code will rebuild and relaunch your application
|
||||
|
||||
In addition to this, a webserver will start on port 34115. This will serve your application to any browser that connects to it. All connected web browsers will respond to system events like hot reload on asset change.
|
||||
|
||||
In Go, we are used to dealing with structs in our applications. It's often useful to send structs to our frontend and use them as state in our application. In v1, this was a very manual process and a bit of a burden on the developer. I'm happy to announce that in v2, any application run in dev mode will automatically generate TypeScript models for all structs that are input or output parameters to bound methods. This enables seamless interchange of data models between the two worlds.
|
||||
|
||||
In addition to this, another JS module is dynamically generated wrapping all your bound methods. This provides JSDoc for your methods, providing code completion and hinting in your IDE. It's really cool when you get data models auto-imported when hitting tab in an auto-generated module wrapping your Go code!
|
||||
|
||||
### Remote Templates
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
<img
|
||||
src={require("@site/static/img/remote-mac.webp").default}
|
||||
width="80%"
|
||||
class="screenshot"
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
```
|
||||
|
||||
Getting an application up and running quickly was always a key goal for the Wails project. When we launched, we tried to cover a lot of the modern frameworks at the time: react, vue and angular. The world of frontend development is very opinionated, fast moving and hard to keep on top of! As a result, we found our base templates getting out of date pretty quickly and this caused a maintenance headache. It also meant that we didn't have cool modern templates for the latest and greatest tech stacks.
|
||||
|
||||
With v2, I wanted to empower the community by giving you the ability to create and host templates yourselves, rather than rely on the Wails project. So now you can create projects using community supported templates! I hope this will inspire developers to create a vibrant ecosystem of project templates. I'm really quite excited about what our developer community can create!
|
||||
|
||||
### Native M1 Support
|
||||
|
||||
Thanks to the amazing support of [Mat Ryer](https://github.com/matryer/), the Wails project now supports M1 native builds:
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
<img
|
||||
src={require("@site/static/img/build-darwin-arm.webp").default}
|
||||
width="80%"
|
||||
class="screenshot"
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
```
|
||||
|
||||
You can also specify `darwin/amd64` as a target too:
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
<img
|
||||
src={require("@site/static/img/build-darwin-amd.webp").default}
|
||||
width="80%"
|
||||
class="screenshot"
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
```
|
||||
|
||||
Oh, I almost forgot.... you can also do `darwin/universal`.... :wink:
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
<img
|
||||
src={require("@site/static/img/build-darwin-universal.webp").default}
|
||||
width="80%"
|
||||
class="screenshot"
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
```
|
||||
|
||||
### Cross Compilation to Windows
|
||||
|
||||
Because Wails v2 for Windows is pure Go, you can target Windows builds without docker.
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
<img
|
||||
src={require("@site/static/img/build-cross-windows.webp").default}
|
||||
width="80%"
|
||||
class="screenshot"
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
```
|
||||
|
||||
### WKWebView Renderer
|
||||
|
||||
V1 relied on a (now deprecated) WebView component. V2 uses the most recent WKWebKit component so expect the latest and greatest from Apple.
|
||||
|
||||
### In Conclusion
|
||||
|
||||
As I'd said in the Windows release notes, Wails v2 represents a new foundation for the project. The aim of this release is to get feedback on the new approach, and to iron out any bugs before a full release. Your input would be most welcome! Please direct any feedback to the [v2 Beta](https://github.com/wailsapp/wails/discussions/828) discussion board.
|
||||
|
||||
And finally, I'd like to give a special thank you to all the [project sponsors](/credits#sponsors), including [JetBrains](https://www.jetbrains.com?from=Wails), whose support drive the project in many ways behind the scenes.
|
||||
|
||||
I look forward to seeing what people build with Wails in this next exciting phase of the project!
|
||||
|
||||
Lea.
|
||||
|
||||
PS: Linux users, you're next!
|
||||
|
||||
PPS: If you or your company find Wails useful, please consider [sponsoring the project](https://github.com/sponsors/leaanthony). Thanks!
|
@ -0,0 +1,114 @@
|
||||
---
|
||||
slug: wails-v2-beta-for-linux
|
||||
title: Wails v2 Beta for Linux
|
||||
authors:
|
||||
- leaanthony
|
||||
tags:
|
||||
- wails
|
||||
- v2
|
||||
---
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
<img
|
||||
src={require("@site/static/img/wails-linux.webp").default}
|
||||
width="40%"
|
||||
class="screenshot"
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
```
|
||||
|
||||
I'm pleased to finally announce that Wails v2 is now in beta for Linux! It is somewhat ironic that the very first experiments with v2 was on Linux and yet it has ended up as the last release. That being said, the v2 we have today is very different from those first experiments. So without further ado, let's go over the new features:
|
||||
|
||||
### New Features
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
<img
|
||||
src={require("@site/static/img/wails-menus-linux.webp").default}
|
||||
width="50%"
|
||||
class="screenshot"
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
```
|
||||
|
||||
There were a lot of requests for native menu support. Wails has finally got you covered. Application menus are now available and include support for most native menu features. This includes standard menu items, checkboxes, radio groups, submenus and separators.
|
||||
|
||||
There were a huge number of requests in v1 for the ability to have greater control of the window itself. I'm happy to announce that there's new runtime APIs specifically for this. It's feature-rich and supports multi-monitor configurations. There is also an improved dialogs API: Now, you can have modern, native dialogs with rich configuration to cater for all your dialog needs.
|
||||
|
||||
### No requirement to bundle assets
|
||||
|
||||
A huge pain-point of v1 was the need to condense your entire application down to single JS & CSS files. I'm happy to announce that for v2, there is no requirement to bundle assets, in any way, shape or form. Want to load a local image? Use an `<img>` tag with a local src path. Want to use a cool font? Copy it in and add the path to it in your CSS.
|
||||
|
||||
> Wow, that sounds like a webserver...
|
||||
|
||||
Yes, it works just like a webserver, except it isn't.
|
||||
|
||||
> So how do I include my assets?
|
||||
|
||||
You just pass a single `embed.FS` that contains all your assets into your application configuration. They don't even need to be in the top directory - Wails will just work it out for you.
|
||||
|
||||
### New Development Experience
|
||||
|
||||
Now that assets don't need to be bundled, it's enabled a whole new development experience. The new `wails dev` command will build and run your application, but instead of using the assets in the `embed.FS`, it loads them directly from disk.
|
||||
|
||||
It also provides the additional features:
|
||||
|
||||
- Hot reload - Any changes to frontend assets will trigger and auto reload of the application frontend
|
||||
- Auto rebuild - Any changes to your Go code will rebuild and relaunch your application
|
||||
|
||||
In addition to this, a webserver will start on port 34115. This will serve your application to any browser that connects to it. All connected web browsers will respond to system events like hot reload on asset change.
|
||||
|
||||
In Go, we are used to dealing with structs in our applications. It's often useful to send structs to our frontend and use them as state in our application. In v1, this was a very manual process and a bit of a burden on the developer. I'm happy to announce that in v2, any application run in dev mode will automatically generate TypeScript models for all structs that are input or output parameters to bound methods. This enables seamless interchange of data models between the two worlds.
|
||||
|
||||
In addition to this, another JS module is dynamically generated wrapping all your bound methods. This provides JSDoc for your methods, providing code completion and hinting in your IDE. It's really cool when you get data models auto-imported when hitting tab in an auto-generated module wrapping your Go code!
|
||||
|
||||
### Remote Templates
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
<img
|
||||
src={require("@site/static/img/remote-linux.webp").default}
|
||||
width="80%"
|
||||
class="screenshot"
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
```
|
||||
|
||||
Getting an application up and running quickly was always a key goal for the Wails project. When we launched, we tried to cover a lot of the modern frameworks at the time: react, vue and angular. The world of frontend development is very opinionated, fast moving and hard to keep on top of! As a result, we found our base templates getting out of date pretty quickly and this caused a maintenance headache. It also meant that we didn't have cool modern templates for the latest and greatest tech stacks.
|
||||
|
||||
With v2, I wanted to empower the community by giving you the ability to create and host templates yourselves, rather than rely on the Wails project. So now you can create projects using community supported templates! I hope this will inspire developers to create a vibrant ecosystem of project templates. I'm really quite excited about what our developer community can create!
|
||||
|
||||
### Cross Compilation to Windows
|
||||
|
||||
Because Wails v2 for Windows is pure Go, you can target Windows builds without docker.
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
<img
|
||||
src={require("@site/static/img/linux-build-cross-windows.webp").default}
|
||||
width="80%"
|
||||
class="screenshot"
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
```
|
||||
|
||||
### In Conclusion
|
||||
|
||||
As I'd said in the Windows release notes, Wails v2 represents a new foundation for the project. The aim of this release is to get feedback on the new approach, and to iron out any bugs before a full release. Your input would be most welcome! Please direct any feedback to the [v2 Beta](https://github.com/wailsapp/wails/discussions/828) discussion board.
|
||||
|
||||
Linux is **hard** to support. We expect there to be a number of quirks with the beta. Please help us to help you by filing detailed bug reports!
|
||||
|
||||
Finally, I'd like to give a special thank you to all the [project sponsors](/credits#sponsors) whose support drive the project in many ways behind the scenes.
|
||||
|
||||
I look forward to seeing what people build with Wails in this next exciting phase of the project!
|
||||
|
||||
Lea.
|
||||
|
||||
PS: The v2 release isn't far off now!
|
||||
|
||||
PPS: If you or your company find Wails useful, please consider [sponsoring the project](https://github.com/sponsors/leaanthony). Thanks!
|
@ -0,0 +1,98 @@
|
||||
---
|
||||
slug: wails-v2-released
|
||||
title: Wails v2 Released
|
||||
authors:
|
||||
- leaanthony
|
||||
tags:
|
||||
- wails
|
||||
- v2
|
||||
---
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
<img
|
||||
src={require("@site/static/img/blog/montage.png").default}
|
||||
width="75%"
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
```
|
||||
|
||||
# It's here!
|
||||
|
||||
Today marks the release of [Wails](https://wails.io) v2. It's been about 18 months since the first v2 alpha and about a year from the first beta release. I'm truly grateful to everyone involved in the evolution of the project.
|
||||
|
||||
Part of the reason it took that long was due to wanting to get to some definition of completeness before officially calling it v2. The truth is, there's never a perfect time to tag a release - there's always outstanding issues or "just one more" feature to squeeze in. What tagging an imperfect major release does do, however, is to provide a bit of stability for users of the project, as well as a bit of a reset for the developers.
|
||||
|
||||
This release is more than I'd ever expected it to be. I hope it gives you as much pleasure as it has given us to develop it.
|
||||
|
||||
# What _is_ Wails?
|
||||
|
||||
If you are unfamiliar with Wails, it is a project that enables Go programmers to provide rich frontends for their Go programs using familiar web technologies. It's a lightweight, Go alternative to Electron. Much more information can be found on the [official site](https://wails.io/docs/introduction).
|
||||
|
||||
# What's new?
|
||||
|
||||
The v2 release is a huge leap forward for the project, addressing many of the pain points of v1. If you have not read any of the blog posts on the Beta releases for [macOS](/blog/wails-v2-beta-for-mac), [Windows](/blog/wails-v2-beta-for-windows) or [Linux](/blog/wails-v2-beta-for-linux), then I encourage you to do so as it covers all the major changes in more detail. In summary:
|
||||
|
||||
- Webview2 component for Windows that supports modern web standards and debugging capabilities.
|
||||
- [Dark / Light theme](/docs/reference/options#theme) + [custom theming](/docs/reference/options#customtheme) on Windows.
|
||||
- Windows now has no CGO requirements.
|
||||
- Out-of-the-box support for Svelte, Vue, React, Preact, Lit & Vanilla project templates.
|
||||
- [Vite](https://vitejs.dev/) integration providing a hot-reload development environment for your application.
|
||||
- Native application [menus](/docs/guides/application-development#application-menu) and [dialogs](/docs/reference/runtime/dialog).
|
||||
- Native window translucency effects for [Windows](/docs/reference/options#windowistranslucent) and [macOS](/docs/reference/options#windowistranslucent-1). Support for Mica & Acrylic backdrops.
|
||||
- Easily generate an [NSIS installer](/docs/guides/windows-installer) for Windows deployments.
|
||||
- A rich [runtime library](/docs/reference/runtime/intro) providing utility methods for window manipulation, eventing, dialogs, menus and logging.
|
||||
- Support for [obfuscating](/docs/guides/obfuscated) your application using [garble](https://github.com/burrowers/garble).
|
||||
- Support for compressing your application using [UPX](https://upx.github.io/).
|
||||
- Automatic TypeScript generation of Go structs. More info [here](/docs/howdoesitwork#calling-bound-go-methods).
|
||||
- No extra libraries or DLLs are required to be shipped with your application. For any platform.
|
||||
- No requirement to bundle frontend assets. Just develop your application like any other web application.
|
||||
|
||||
# Credit & Thanks
|
||||
|
||||
Getting to v2 has been a huge effort. There have been ~2.2K commits by 89 contributors between the initial alpha and the release today, and many, many more that have provided translations, testing, feedback and help on the discussion forums as well as the issue tracker. I'm so unbelievably grateful to each one of you. I'd also like to give an extra special thank you to all the project sponsors who have provided guidance, advice and feedback. Everything you do is hugely appreciated.
|
||||
|
||||
There are a few people I'd like to give special mention to:
|
||||
|
||||
Firstly, a **huge** thank you to [@stffabi](https://github.com/stffabi) who has provided so many contributions which we all benefit from, as well as providing a lot of support on many issues. He has provided some key features such as the external dev server support which transformed our dev mode offering by allowing us to hook into [Vite](https://vitejs.dev/)'s superpowers. It's fair to say that Wails v2 would be a far less exciting release without his [incredible contributions](https://github.com/wailsapp/wails/commits?author=stffabi&since=2020-01-04). Thank you so much @stffabi!
|
||||
|
||||
I'd also like to give a huge shout-out to [@misitebao](https://github.com/misitebao) who has tirelessly been maintaining the website, as well as providing Chinese translations, managing Crowdin and helping new translators get up to speed. This is a hugely important task, and I'm extremely grateful for all the time and effort put into this! You rock!
|
||||
|
||||
Last, but not least, a huge thank you to Mat Ryer who has provided advice and support during the development of v2. Writing xBar together using an early Alpha of v2 was helpful in shaping the direction of v2, as well as give me an understanding of some design flaws in the early releases. I'm happy to announce that as of today, we will start to port xBar to Wails v2, and it will become the flagship application for the project. Cheers Mat!
|
||||
|
||||
# Lessons Learnt
|
||||
|
||||
There are a number of lessons learnt in getting to v2 that will shape development moving forward.
|
||||
|
||||
## Smaller, Quicker, Focused Releases
|
||||
|
||||
In the course of developing v2, there were many features and bug fixes that were developed on an ad-hoc basis. This led to longer release cycles and were harder to debug. Moving forward, we are going to create releases more often that will include a reduced number of features. A release will involve updates to documentation as well as thorough testing. Hopefully, these smaller, quicker, focussed releases will lead to fewer regressions and better quality documentation.
|
||||
|
||||
## Encourage Engagement
|
||||
|
||||
When starting this project, I wanted to immediately help everyone who had a problem. Issues were "personal" and I wanted them resolved as quickly as possible. This is unsustainable and ultimately works against the longevity of the project. Moving forward, I will be giving more space for people to get involved in answering questions and triaging issues. It would be good to get some tooling to help with this so if you have any suggestions, please join in the discussion [here](https://github.com/wailsapp/wails/discussions/1855).
|
||||
|
||||
## Learning to say No
|
||||
|
||||
The more people that engage with an Open Source project, the more requests there will be for additional features that may or may not be useful to the majority of people. These features will take an initial amount of time to develop and debug, and incur an ongoing maintenance cost from that point on. I myself am the most guilty of this, often wanting to "boil the sea" rather than provide the minimum viable feature. Moving forward, we will need to say "No" a bit more to adding core features and focus our energies on a way to empower developers to provide that functionality themselves. We are looking seriously into plugins for this scenario. This will allow anyone to extend the project as they see fit, as well as providing an easy way to contribute towards the project.
|
||||
|
||||
# Looking to the Future
|
||||
|
||||
There are so many core features we are looking at to add to Wails in the next major development cycle already. The [roadmap](https://github.com/wailsapp/wails/discussions/1484) is full of interesting ideas, and I'm keen to start work on them. One of the big asks has been for multiple window support. It's a tricky one and to do it right, and we may need to look at providing an alternative API, as the current one was not designed with this in mind. Based on some preliminary ideas and feedback, I think you'll like where we're looking to go with it.
|
||||
|
||||
I'm personally very excited at the prospect of getting Wails apps running on mobile. We already have a demo project showing that it is possible to run a Wails app on Android, so I'm really keen to explore where we can go with this!
|
||||
|
||||
A final point I'd like to raise is that of feature parity. It has long been a core principle that we wouldn't add anything to the project without there being full cross-platform support for it. Whilst this has proven to be (mainly) achievable so far, it has really held the project back in releasing new features. Moving forward, we will be adopting a slightly different approach: any new feature that cannot be immediately released for all platforms will be released under an experimental configuration or API. This allows early adopters on certain platforms to try the feature and provide feedback that will feed into the final design of the feature. This, of course, means that there are no guarantees of API stability until it is fully supported by all the platforms it can be supported on, but at least it will unblock development.
|
||||
|
||||
# Final Words
|
||||
|
||||
I'm really proud of what we've been able to achieve with the V2 release. It's amazing to see what people have already been able to build using the beta releases so far. Quality applications like [Varly](https://varly.app/), [Surge](https://getsurge.io/) and [October](https://october.utf9k.net/). I encourage you to check them out.
|
||||
|
||||
This release was achieved through the hard work of many contributors. Whilst it is free to download and use, it has not come about through zero cost. Make no mistakes, this project has come at considerable cost. It has not only been my time and the time of each and every contributor, but also the cost of absence from friends and families of each of those people too. That's why I'm extremely grateful for every second that has been dedicated to making this project happen. The more contributors we have, the more this effort can be spread out and the more we can achieve together. I'd like to encourage you all to pick one thing that you can contribute, whether it is confirming someone's bug, suggesting a fix, making a documentation change or helping out someone who needs it. All of these small things have such a huge impact! It would be so awesome if you too were part of the story in getting to v3.
|
||||
|
||||
Enjoy!
|
||||
|
||||
‐ Lea
|
||||
|
||||
PS: If you or your company find Wails useful, please consider [sponsoring the project](https://github.com/sponsors/leaanthony). Thanks!
|
@ -0,0 +1,184 @@
|
||||
---
|
||||
slug: the-road-to-wails-v3
|
||||
title: The Road to Wails v3
|
||||
authors:
|
||||
- leaanthony
|
||||
tags:
|
||||
- wails
|
||||
- v3
|
||||
---
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
<img
|
||||
src={require("@site/static/img/blog/multiwindow.webp").default}
|
||||
width="90%"
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
```
|
||||
|
||||
# Introduction
|
||||
|
||||
Wails is a project that simplifies the ability to write cross-platform desktop applications using Go. It uses native webview components for the frontend (not embedded browsers), bringing the power of the world's most popular UI system to Go, whilst remaining lightweight.
|
||||
|
||||
Version 2 was released on the 22nd of September 2022 and brought with it a lot of enhancements including:
|
||||
|
||||
- Live development, leveraging the popular Vite project
|
||||
- Rich functionality for managing windows and creating menus
|
||||
- Microsoft's WebView2 component
|
||||
- Generation of Typescript models that mirror your Go structs
|
||||
- Creating of NSIS Installer
|
||||
- Obfuscated builds
|
||||
|
||||
Right now, Wails v2 provides powerful tooling for creating rich, cross-platform desktop applications.
|
||||
|
||||
This blog post aims to look at where the project is at right now and what we can improve on moving forward.
|
||||
|
||||
# Where are we now?
|
||||
|
||||
It's been incredible to see the popularity of Wails rising since the v2 release. I'm constantly amazed by the creativity of the community and the wonderful things that are being built with it. With more popularity, comes more eyes on the project. And with that, more feature requests and bug reports.
|
||||
|
||||
Over time, I've been able to identify some of the most pressing issues facing the project. I've also been able to identify some of the things that are holding the project back.
|
||||
|
||||
## Current issues
|
||||
|
||||
I've identified the following areas that I feel are holding the project back:
|
||||
|
||||
- The API
|
||||
- Bindings generation
|
||||
- The Build System
|
||||
|
||||
### The API
|
||||
|
||||
The API to build a Wails application currently consists of 2 parts:
|
||||
|
||||
- The Application API
|
||||
- The Runtime API
|
||||
|
||||
The Application API famously has only 1 function: `Run()` which takes a heap of options which govern how the application will work. Whilst this is very simple to use, it is also very limiting. It is a "declarative" approach which hides a lot of the underlying complexity. For instance, there is no handle to the main window, so you can't interact with it directly. For that, you need to use the Runtime API. This is a problem when you start to want to do more complex things like create multiple windows.
|
||||
|
||||
The Runtime API provides a lot of utility functions for the developer. This includes:
|
||||
|
||||
- Window management
|
||||
- Dialogs
|
||||
- Menus
|
||||
- Events
|
||||
- Logs
|
||||
|
||||
There are a number of things I am not happy with the Runtime API. The first is that it requires a "context" to be passed around. This is both frustrating and confusing for new developers who pass in a context and then get a runtime error.
|
||||
|
||||
The biggest issue with the Runtime API is that it was designed for applications that only use a single window. Over time, the demand for multiple windows has grown and the API is not well suited to this.
|
||||
|
||||
### Thoughts on the v3 API
|
||||
|
||||
Wouldn't it be great if we could do something like this?
|
||||
|
||||
```go
|
||||
func main() {
|
||||
app := wails.NewApplication(options.App{})
|
||||
myWindow := app.NewWindow(options.Window{})
|
||||
myWindow.SetTitle("My Window")
|
||||
myWindow.On(events.Window.Close, func() {
|
||||
app.Quit()
|
||||
})
|
||||
app.Run()
|
||||
}
|
||||
```
|
||||
|
||||
This programmatic approach is far more intuitive and allows the developer to interact with the application elements directly. All current runtime methods for windows would simply be methods on the window object. For the other runtime methods, we could move them to the application object like so:
|
||||
|
||||
```go
|
||||
app := wails.NewApplication(options.App{})
|
||||
app.NewInfoDialog(options.InfoDialog{})
|
||||
app.Log.Info("Hello World")
|
||||
```
|
||||
|
||||
This is a much more powerful API which will allow for more complex applications to be built. It also allows for the creation of multiple windows, [the most up-voted feature on GitHub](https://github.com/wailsapp/wails/issues/1480):
|
||||
|
||||
```go
|
||||
func main() {
|
||||
app := wails.NewApplication(options.App{})
|
||||
myWindow := app.NewWindow(options.Window{})
|
||||
myWindow.SetTitle("My Window")
|
||||
myWindow.On(events.Window.Close, func() {
|
||||
app.Quit()
|
||||
})
|
||||
myWindow2 := app.NewWindow(options.Window{})
|
||||
myWindow2.SetTitle("My Window 2")
|
||||
myWindow2.On(events.Window.Close, func() {
|
||||
app.Quit()
|
||||
})
|
||||
app.Run()
|
||||
}
|
||||
```
|
||||
|
||||
### Bindings generation
|
||||
|
||||
One of the key features of Wails is generating bindings for your Go methods so they may be called from Javascript. The current method for doing this is a bit of a hack. It involves building the application with a special flag and then running the resultant binary which uses reflection to determine what has been bound. This leads to a bit of a chicken and egg situation: You can't build the application without the bindings and you can't generate the bindings without building the application. There are many ways around this but the best one would be not to use this approach at all.
|
||||
|
||||
There was a number of attempts at writing a static analyser for Wails projects but they didn't get very far. In more recent times, it has become slightly easier to do this with more material available on the subject.
|
||||
|
||||
Compared to reflection, the AST approach is much faster however it is significantly more complicated. To start with, we may need to impose certain constraints on how to specify bindings in the code. The goal is to support the most common use cases and then expand it later on.
|
||||
|
||||
### The Build System
|
||||
|
||||
Like the declarative approach to the API, the build system was created to hide the complexities of building a desktop application. When you run `wails build`, it does a lot of things behind the scenes:
|
||||
- Builds the backend binary for bindings and generates the bindings
|
||||
- Installs the frontend dependencies
|
||||
- Builds the frontend assets
|
||||
- Determines if the application icon is present and if so, embeds it
|
||||
- Builds the final binary
|
||||
- If the build is for `darwin/universal` it builds 2 binaries, one for `darwin/amd64` and one for `darwin/arm64` and then creates a fat binary using `lipo`
|
||||
- If compression is required, it compresses the binary with UPX
|
||||
- Determines if this binary is to be packaged and if so:
|
||||
- Ensures the icon and application manifest are compiled into the binary (Windows)
|
||||
- Builds out the application bundle, generates the icon bundle and copies it, the binary and Info.plist to the application bundle (Mac)
|
||||
- If an NSIS installer is required, it builds it
|
||||
|
||||
This entire process, whilst very powerful, is also very opaque. It is very difficult to customise it and it is very difficult to debug.
|
||||
|
||||
To address this in v3, I would like to move to a build system that exists outside of Wails. After using [Task](https://taskfile.dev/) for a while, I am a big fan of it. It is a great tool for configuring build systems and should be reasonably familiar to anyone who has used Makefiles.
|
||||
|
||||
The build system would be configured using a `Taskfile.yml` file which would be generated by default with any of the supported templates. This would have all of the steps required to do all the current tasks, such as building or packaging the application, allowing for easy customisation.
|
||||
|
||||
There will be no external requirement for this tooling as it would form part of the Wails CLI. This means that you can still use `wails build` and it will do all the things it does today. However, if you want to customise the build process, you can do so by editing the `Taskfile.yml` file. It also means you can easily understand the build steps and use your own build system if you wish.
|
||||
|
||||
The missing piece in the build puzzle is the atomic operations in the build process, such as icon generation, compression and packaging. To require a bunch of external tooling would not be a great experience for the developer. To address this, the Wails CLI will provide all these capabilities as part of the CLI. This means that the builds still work as expected, with no extra external tooling, however you can replace any step of the build with any tool you like.
|
||||
|
||||
This will be a much more transparent build system which will allow for easier customisation and address a lot of the issues that have been raised around it.
|
||||
|
||||
## The Payoff
|
||||
|
||||
These positive changes will be a huge benefit to the project:
|
||||
- The new API will be much more intuitive and will allow for more complex applications to be built.
|
||||
- Using static analysis for bindings generation will be much faster and reduce a lot of the complexity around the current process.
|
||||
- Using an established, external build system will make the build process completely transparent, allowing for powerful customisation.
|
||||
|
||||
Benefits to the project maintainers are:
|
||||
|
||||
- The new API will be much easier to maintain and adapt to new features and platforms.
|
||||
- The new build system will be much easier to maintain and extend. I hope this will lead to a new ecosystem of community driven build pipelines.
|
||||
- Better separation of concerns within the project. This will make it easier to add new features and platforms.
|
||||
|
||||
## The Plan
|
||||
|
||||
A lot of the experimentation for this has already been done and it's looking good. There is no current timeline for this work but I'm hoping by the end of Q1 2023, there will be an alpha release for Mac to allow the community to test, experiment with and provide feedback.
|
||||
|
||||
## Summary
|
||||
|
||||
- The v2 API is declarative, hides a lot from the developer and not suitable for features such as multiple windows. A new API will be created which will be simpler, intuitive and more powerful.
|
||||
- The build system is opaque and difficult to customise so we will move to an external build system which will open it all up.
|
||||
- The bindings generation is slow and complex so we will move to static analysis which will remove a lot of the complexity the current method has.
|
||||
|
||||
There has been a lot of work put into the guts of v2 and it's solid. It's now time to address the layer on top of it and make it a much better experience for the developer.
|
||||
|
||||
I hope you are as excited about this as I am. I'm looking forward to hearing your thoughts and feedback.
|
||||
|
||||
Regards,
|
||||
|
||||
‐ Lea
|
||||
|
||||
PS: If you or your company find Wails useful, please consider [sponsoring the project](https://github.com/sponsors/leaanthony). Thanks!
|
||||
|
||||
PPS: Yes, that's a genuine screenshot of a multi-window application built with Wails. It's not a mockup. It's real. It's awesome. It's coming soon.
|
10
website/i18n/vi/docusaurus-plugin-content-blog/authors.yml
Normal file
10
website/i18n/vi/docusaurus-plugin-content-blog/authors.yml
Normal file
@ -0,0 +1,10 @@
|
||||
leaanthony:
|
||||
name: Lea Anthony
|
||||
title: Maintainer of Wails
|
||||
url: https://github.com/leaanthony
|
||||
image_url: https://github.com/leaanthony.png
|
||||
misitebao:
|
||||
name: Misite Bao
|
||||
title: Architect
|
||||
url: https://github.com/misitebao
|
||||
image_url: https://github.com/misitebao.png
|
14
website/i18n/vi/docusaurus-plugin-content-blog/options.json
Normal file
14
website/i18n/vi/docusaurus-plugin-content-blog/options.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"title": {
|
||||
"message": "Blog",
|
||||
"description": "The title for the blog used in SEO"
|
||||
},
|
||||
"description": {
|
||||
"message": "Blog",
|
||||
"description": "The description for the blog used in SEO"
|
||||
},
|
||||
"sidebar.title": {
|
||||
"message": "Recent posts",
|
||||
"description": "The label for the left sidebar"
|
||||
}
|
||||
}
|
38
website/i18n/vi/docusaurus-plugin-content-docs/current.json
Normal file
38
website/i18n/vi/docusaurus-plugin-content-docs/current.json
Normal file
@ -0,0 +1,38 @@
|
||||
{
|
||||
"version.label": {
|
||||
"message": "Phiên Bản Tiếp Theo 🚧",
|
||||
"description": "The label for version current"
|
||||
},
|
||||
"sidebar.docs.category.Getting Started": {
|
||||
"message": "Hướng Dẫn Nhanh",
|
||||
"description": "The label for category Getting Started in sidebar docs"
|
||||
},
|
||||
"sidebar.docs.category.Reference": {
|
||||
"message": "Tham Khảo",
|
||||
"description": "The label for category Reference in sidebar docs"
|
||||
},
|
||||
"sidebar.docs.category.Runtime": {
|
||||
"message": "Bộ Công Cụ Runtime",
|
||||
"description": "The label for category Runtime in sidebar docs"
|
||||
},
|
||||
"sidebar.docs.category.Community": {
|
||||
"message": "Cộng Đồng",
|
||||
"description": "The label for category Community in sidebar docs"
|
||||
},
|
||||
"sidebar.docs.category.Showcase": {
|
||||
"message": "Trưng Bày",
|
||||
"description": "The label for category Showcase in sidebar docs"
|
||||
},
|
||||
"sidebar.docs.category.Guides": {
|
||||
"message": "Định Hướng",
|
||||
"description": "The label for category Guides in sidebar docs"
|
||||
},
|
||||
"sidebar.docs.category.Tutorials": {
|
||||
"message": "Thực Hành",
|
||||
"description": "The label for category Tutorials in sidebar docs"
|
||||
},
|
||||
"sidebar.docs.link.Contributing": {
|
||||
"message": "Đóng Góp",
|
||||
"description": "The label for link Contributing in sidebar docs, linking to /community-guide#ways-of-contributing"
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
---
|
||||
sidebar_position: 2
|
||||
---
|
||||
|
||||
# Links
|
||||
|
||||
This page serves as a list for community related links. Please submit a PR (click `Edit this page` at the bottom) to submit links.
|
||||
|
||||
## Awesome Wails
|
||||
|
||||
The [definitive list](https://github.com/wailsapp/awesome-wails) of links related to Wails.
|
||||
|
||||
## Support Channels
|
||||
|
||||
- [Wails Discord Server](https://discord.gg/JDdSxwjhGf)
|
||||
- [Github Issues](https://github.com/wailsapp/wails/issues)
|
||||
- [v2 Beta Discussion Board](https://github.com/wailsapp/wails/discussions/828)
|
||||
|
||||
## Social Media
|
||||
|
||||
- [Twitter](https://twitter.com/wailsapp)
|
||||
- [Wails Chinese Community QQ Group](https://qm.qq.com/cgi-bin/qm/qr?k=PmIURne5hFGNd7QWzW5qd6FV-INEjNJv&jump_from=webapi) - Group number: 1067173054
|
||||
|
||||
## Other Tutorials and Articles
|
||||
|
||||
- [Building of Bulletin Board](https://blog.customct.com/building-bulletin-board)
|
@ -0,0 +1,10 @@
|
||||
# BulletinBoard
|
||||
|
||||
```mdx-code-block
|
||||
<p style={{ "text-align": "center" }}>
|
||||
<img src={require("@site/static/img/showcase/bboard.webp").default} />
|
||||
<br />
|
||||
</p>
|
||||
```
|
||||
|
||||
The [BulletinBoard](https://github.com/raguay/BulletinBoard) application is a versital message board for static messages or dialogs to get information from the user for a script. It has a TUI for creating new dialogs that can latter be used to get information from the user. It's design is to stay running on your system and show the information as needed and then hide away. I have a process for watching a file on my system and sending the contents to BulletinBoard when changed. It works great with my workflows. There is also an [Alfred workflow](https://github.com/raguay/MyAlfred/blob/master/Alfred%205/EmailIt.alfredworkflow) for sending information to the program. The workflow is also for working with [EmailIt](https://github.com/raguay/EmailIt).
|
@ -0,0 +1,10 @@
|
||||
# EmailIt
|
||||
|
||||
```mdx-code-block
|
||||
<p style={{ "text-align": "center" }}>
|
||||
<img src={require("@site/static/img/showcase/emailit.webp").default} />
|
||||
<br />
|
||||
</p>
|
||||
```
|
||||
|
||||
[EmailIt](https://github.com/raguay/EmailIt/) is a Wails 2 program that is a markdown based email sender only with nine notepads, scripts to manipulate the text, and templates. It also has a scripts terminal to run scripts in EmailIt on files in your system. The scripts and templates can be used from the commandline itself or with the Alfred, Keyboard Maestro, Dropzone, or PopClip extensions. It also supports scripts and themes downloaded form GitHub. Documentation is not complete, but the programs works. It’s built using Wails2 and Svelte, and the download is a universal macOS application.
|
@ -0,0 +1,12 @@
|
||||
# EncryptEasy
|
||||
|
||||
```mdx-code-block
|
||||
<p style={{ "text-align": "center" }}>
|
||||
<img src={require("@site/static/img/showcase/encrypteasy.webp").default} />
|
||||
<br />
|
||||
</p>
|
||||
```
|
||||
|
||||
**[EncryptEasy](https://www.encrypteasy.app) is a simple and easy to use PGP encryption tool, managing all your and your contacts keys. Encryption should be simple. Developed with Wails.**
|
||||
|
||||
Encrypting messages using PGP is the industry standard. Everyone has a private and a public key. Your private key, well, needs to be kept private so only you can read messages. Your public key is distributed to anyone who wants to send you secret, encrypted messages. Managing keys, encrypting messages and decrypting messages should be a smooth experience. EncryptEasy is all about making it easy.
|
@ -0,0 +1,16 @@
|
||||
# FileHound Export Utility
|
||||
|
||||
```mdx-code-block
|
||||
<p style={{ "text-align": "center" }}>
|
||||
<img src={require("@site/static/img/showcase/filehound.webp").default} />
|
||||
<br />
|
||||
</p>
|
||||
```
|
||||
|
||||
[FileHound Export Utility](https://www.filehound.co.uk/) FileHound is a cloud document management platform made for secure file retention, business process automation and SmartCapture capabilities.
|
||||
|
||||
The FileHound Export Utility allows FileHound Administrators the ability to run a secure document and data extraction tasks for alternative back-up and recovery purposes. This application will download all documents and/or meta data saved in FileHound based on the filters you choose. The metadata will be exported in both JSON and XML formats.
|
||||
|
||||
Backend built with: Go 1.15 Wails 1.11.0 go-sqlite3 1.14.6 go-linq 3.2
|
||||
|
||||
Frontend with: Vue 2.6.11 Vuex 3.4.0 TypeScript Tailwind 1.9.6
|
@ -0,0 +1,10 @@
|
||||
# hiposter
|
||||
|
||||
```mdx-code-block
|
||||
<p style={{ "text-align": "center" }}>
|
||||
<img src={require("@site/static/img/showcase/hiposter.webp").default} />
|
||||
<br />
|
||||
</p>
|
||||
```
|
||||
|
||||
[hiposter](https://github.com/obity/hiposter) is a simple and efficient http API testing client tool. Based on Wails, Go and sveltejs.
|
@ -0,0 +1,14 @@
|
||||
# Minecraft Updater
|
||||
|
||||
```mdx-code-block
|
||||
<p style={{ "text-align": "center" }}>
|
||||
<img
|
||||
src={
|
||||
require("@site/static/img/showcase/minecraft-mod-updater.webp").default
|
||||
}
|
||||
/>
|
||||
<br />
|
||||
</p>
|
||||
```
|
||||
|
||||
[Minecraft Updater](https://github.com/Gurkengewuerz/MinecraftModUpdater) is a utility tool to update and synchronize Minecraft mods for your userbase. It’s built using Wails2 and React with [antd](https://ant.design/) as frontend framework.
|
@ -0,0 +1,14 @@
|
||||
# Modal File Manager
|
||||
|
||||
```mdx-code-block
|
||||
<p style={{ "text-align": "center" }}>
|
||||
<img
|
||||
src={require("@site/static/img/showcase/modalfilemanager.webp").default}
|
||||
/>
|
||||
<br />
|
||||
</p>
|
||||
```
|
||||
|
||||
[Modal File Manager](https://github.com/raguay/ModalFileManager) is a dual pane file manager using web technologies. My original design was based on NW.js and can be found [here](https://github.com/raguay/ModalFileManager-NWjs). This version uses the same Svelte based frontend code (but it has be greatly modified since the departure from NW.js), but the backend is a [Wails 2](https://wails.io/) implementation. By using this implementation, I no longer use command line `rm`, `cp`, etc. commands, but a git install has to be on the system to download themes and extensions. It is fully coded using Go and runs much faster than the previous versions.
|
||||
|
||||
This file manager is designed around the same principle as Vim: a state controlled keyboard actions. The number of states isn't fixed, but very programmable. Therefore, an infinite number of keyboard configurations can be created and used. This is the main difference from other file managers. There are themes and extensions available to download from GitHub.
|
@ -0,0 +1,10 @@
|
||||
# Molley Wallet
|
||||
|
||||
```mdx-code-block
|
||||
<p style={{ "text-align": "center" }}>
|
||||
<img src={require("@site/static/img/showcase/mollywallet.webp").default} />
|
||||
<br />
|
||||
</p>
|
||||
```
|
||||
|
||||
[Molly Wallet](https://github.com/grvlle/constellation_wallet/) the official $DAG wallet of the Constellation Network. It'll let users interact with the Hypergraph Network in various ways, not limited to producing $DAG transactions.
|
@ -0,0 +1,14 @@
|
||||
# October
|
||||
|
||||
```mdx-code-block
|
||||
<p style={{ "text-align": "center" }}>
|
||||
<img src={require("@site/static/img/showcase/october.webp").default} />
|
||||
<br />
|
||||
</p>
|
||||
```
|
||||
|
||||
[October](https://october.utf9k.net) is a small Wails application that makes it really easy to extract highlights from [Kobo eReaders](https://en.wikipedia.org/wiki/Kobo_eReader) and then forward them to [Readwise](https://readwise.io).
|
||||
|
||||
It has a relatively small scope with all platform versions weighing in under 10MB, and that's without enabling [UPX compression](https://upx.github.io/)!
|
||||
|
||||
In contrast, the author's previous attempts with Electron quickly bloated to several hundred megabytes.
|
@ -0,0 +1,10 @@
|
||||
# Optimus
|
||||
|
||||
```mdx-code-block
|
||||
<p style={{ "text-align": "center" }}>
|
||||
<img src={require("@site/static/img/showcase/optimus.webp").default} />
|
||||
<br />
|
||||
</p>
|
||||
```
|
||||
|
||||
[Optimus](https://github.com/splode/optimus) is a desktop image optimization application. It supports conversion and compression between WebP, JPEG, and PNG image formats.
|
@ -0,0 +1,10 @@
|
||||
# Portfall
|
||||
|
||||
```mdx-code-block
|
||||
<p style={{ "text-align": "center" }}>
|
||||
<img src={require("@site/static/img/showcase/portfall.webp").default} />
|
||||
<br />
|
||||
</p>
|
||||
```
|
||||
|
||||
[Portfall](https://github.com/rekon-oss/portfall) - A desktop k8s port-forwarding portal for easy access to all your cluster UIs
|
@ -0,0 +1,12 @@
|
||||
# Restic Browser
|
||||
|
||||
```mdx-code-block
|
||||
<p style={{ "text-align": "center" }}>
|
||||
<img
|
||||
src={require("@site/static/img/showcase/restic-browser-2.png").default}
|
||||
/>
|
||||
<br />
|
||||
</p>
|
||||
```
|
||||
|
||||
[Restic-Browser](https://github.com/emuell/restic-browser) - A simple, cross-platform [restic](https://github.com/restic/restic) backup GUI for browsing and restoring restic repositories.
|
@ -0,0 +1,21 @@
|
||||
# RiftShare
|
||||
|
||||
```mdx-code-block
|
||||
<p style={{ "text-align": "center" }}>
|
||||
<img src={require("@site/static/img/showcase/riftshare-main.webp").default} />
|
||||
<br />
|
||||
</p>
|
||||
```
|
||||
|
||||
Easy, Secure, and Free file sharing for everyone. Learn more at [Riftshare.app](https://riftshare.app)
|
||||
|
||||
## Features
|
||||
|
||||
- Easy secure file sharing between computers both in the local network and through the internet
|
||||
- Supports sending files or directories securely through the [magic wormhole protocol](https://magic-wormhole.readthedocs.io/en/latest/)
|
||||
- Compatible with all other apps using magic wormhole (magic-wormhole or wormhole-william CLI, wormhole-gui, etc.)
|
||||
- Automatic zipping of multiple selected files to send at once
|
||||
- Full animations, progress bar, and cancellation support for sending and receiving
|
||||
- Native OS File Selection
|
||||
- Open files in one click once received
|
||||
- Auto Update - don't worry about having the latest release!
|
@ -0,0 +1,10 @@
|
||||
# ScriptBar
|
||||
|
||||
```mdx-code-block
|
||||
<p style={{ "text-align": "center" }}>
|
||||
<img src={require("@site/static/img/showcase/scriptbar.webp").default} />
|
||||
<br />
|
||||
</p>
|
||||
```
|
||||
|
||||
[ScriptBar](https://GitHub.com/raguay/ScriptBarApp) is a program to show the output of scripts or [Node-Red](https://nodered.org) server. It runs scripts defined in EmailIt program and shows the output. Scripts from xBar or TextBar can be used, but currently on the TextBar scripts work well. It also displays the output of scripts on your system. ScriptBar doesn't put them in the menubar, but has them all in a convient window for easy viewing. You can have multiple tabs to have many different things show. You can also keep the links to your most visited web sites.
|
@ -0,0 +1,10 @@
|
||||
# Surge
|
||||
|
||||
```mdx-code-block
|
||||
<p style={{ "text-align": "center" }}>
|
||||
<img src={require("@site/static/img/showcase/surge.png").default} />
|
||||
<br />
|
||||
</p>
|
||||
```
|
||||
|
||||
[Surge](https://getsurge.io/) is a p2p filesharing app designed to utilize blockchain technologies to enable 100% anonymous file transfers. Surge is end-to-end encrypted, decentralized and open source.
|
@ -0,0 +1,10 @@
|
||||
# Wally
|
||||
|
||||
```mdx-code-block
|
||||
<p style={{ "text-align": "center" }}>
|
||||
<img src={require("@site/static/img/showcase/wally.webp").default} />
|
||||
<br />
|
||||
</p>
|
||||
```
|
||||
|
||||
[Wally](https://ergodox-ez.com/pages/wally) is the official firmware flasher for [Ergodox](https://ergodox-ez.com/) keyboards. It looks great and is a fantastic example of what you can achieve with Wails: the ability to combine the power of Go and the rich graphical tools of the web development world.
|
@ -0,0 +1,19 @@
|
||||
# Minecraft launcher for WarMine
|
||||
|
||||
```mdx-code-block
|
||||
<p style={{ "text-align": "center" }}>
|
||||
<img
|
||||
src={require("@site/static/img/showcase/warmine1.png").default}
|
||||
/>
|
||||
<img
|
||||
src={require("@site/static/img/showcase/warmine2.png").default}
|
||||
/>
|
||||
<br />
|
||||
</p>
|
||||
```
|
||||
|
||||
[Minecraft launcher for WarMine](https://warmine.ru/) is a Wails application, that allows you to easily join modded game servers and manage your game accounts.
|
||||
|
||||
The Launcher downloads the game files, checks their integrity and launches the game with a wide range of customization options for the launch arguments from the backend.
|
||||
|
||||
Frontend is written in Svelte, whole launcher fits in 9MB and supports Windows 7-11.
|
@ -0,0 +1,10 @@
|
||||
# Wombat
|
||||
|
||||
```mdx-code-block
|
||||
<p style={{ "text-align": "center" }}>
|
||||
<img src={require("@site/static/img/showcase/wombat.webp").default} />
|
||||
<br />
|
||||
</p>
|
||||
```
|
||||
|
||||
[Wombat](https://github.com/rogchap/wombat) is a cross platform gRPC client.
|
@ -0,0 +1,10 @@
|
||||
# Ytd
|
||||
|
||||
```mdx-code-block
|
||||
<p style={{ "text-align": "center" }}>
|
||||
<img src={require("@site/static/img/showcase/ytd.webp").default} />
|
||||
<br />
|
||||
</p>
|
||||
```
|
||||
|
||||
[Ytd](https://github.com/marcio199226/ytd/tree/v2-wails) is an app for downloading tracks from youtube, creating offline playlists and share them with your friends, your friends will be able to playback your playlists or download them for offline listening, has an built-in player.
|
@ -0,0 +1,69 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
# Templates
|
||||
|
||||
This page serves as a list for community supported templates. Please submit a PR (click `Edit this page` at the bottom) to include your templates. To build your own template, please see the [Templates](../guides/templates.mdx) guide.
|
||||
|
||||
To use these templates, run `wails init -n "Your Project Name" -t [the link below[@version]]`
|
||||
|
||||
If there is no version suffix, the main branch code template is used by default. If there is a version suffix, the code template corresponding to the tag of this version is used.
|
||||
|
||||
Example: `wails init -n "Your Project Name" -t https://github.com/misitebao/wails-template-vue`
|
||||
|
||||
:::warning Attention
|
||||
|
||||
**The Wails project does not maintain, is not responsible nor liable for 3rd party templates!**
|
||||
|
||||
If you are unsure about a template, inspect `package.json` and `wails.json` for what scripts are run and what packages are installed.
|
||||
|
||||
:::
|
||||
|
||||
## Vue
|
||||
|
||||
- [wails-template-vue](https://github.com/misitebao/wails-template-vue) - Wails template based on Vue ecology (Integrated TypeScript, Dark theme, Internationalization, Single page routing, TailwindCSS)
|
||||
- [wails-vite-vue-ts](https://github.com/codydbentley/wails-vite-vue-ts) - Vue 3 TypeScript with Vite (and instructions to add features)
|
||||
- [wails-vite-vue-the-works](https://github.com/codydbentley/wails-vite-vue-the-works) - Vue 3 TypeScript with Vite, Vuex, Vue Router, Sass, and ESLint + Prettier
|
||||
- [wails-template-quasar-js](https://github.com/sgosiaco/wails-template-quasar-js) - A template using JavaScript + Quasar V2 (Vue 3, Vite, Sass, Pinia, ESLint, Prettier)
|
||||
- [wails-template-quasar-ts](https://github.com/sgosiaco/wails-template-quasar-ts) - A template using TypeScript + Quasar V2 (Vue 3, Vite, Sass, Pinia, ESLint, Prettier, Composition API with <script setup>)
|
||||
- [wails-template-naive](https://github.com/tk103331/wails-template-naive) - Wails template based on Naive UI (A Vue 3 Component Library)
|
||||
|
||||
## Angular
|
||||
|
||||
- [wails-template-angular](https://github.com/mateothegreat/wails-template-angular) - Angular 15+ action packed & ready to roll to production.
|
||||
- [wails-angular-template](https://github.com/TAINCER/wails-angular-template) - Angular with TypeScript, Sass, Hot-Reload, Code-Splitting and i18n
|
||||
|
||||
## React
|
||||
|
||||
- [wails-react-template](https://github.com/AlienRecall/wails-react-template) - A template using reactjs
|
||||
- [wails-react-template](https://github.com/flin7/wails-react-template) - A minimal template for React that supports live development
|
||||
- [wails-template-nextjs](https://github.com/LGiki/wails-template-nextjs) - A template using Next.js and TypeScript
|
||||
- [wails-vite-react-ts-tailwind-template](https://github.com/hotafrika/wails-vite-react-ts-tailwind-template) - A template for React + TypeScript + Vite + TailwindCSS
|
||||
- [wails-vite-react-ts-tailwind-shadcnui-template](https://github.com/Mahcks/wails-vite-react-tailwind-shadcnui-ts) - A template with Vite, React, TypeScript, TailwindCSS, and shadcn/ui
|
||||
|
||||
## Svelte
|
||||
|
||||
- [wails-svelte-template](https://github.com/raitonoberu/wails-svelte-template) - A template using Svelte
|
||||
- [wails-vite-svelte-template](https://github.com/BillBuilt/wails-vite-svelte-template) - A template using Svelte and Vite
|
||||
- [wails-vite-svelte-tailwind-template](https://github.com/BillBuilt/wails-vite-svelte-tailwind-template) - A template using Svelte and Vite with TailwindCSS v3
|
||||
- [wails-svelte-tailwind-vite-template](https://github.com/PylotLight/wails-vite-svelte-tailwind-template/tree/master) - An updated template using Svelte v4.2.0 and Vite with TailwindCSS v3.3.3
|
||||
- [wails-sveltekit-template](https://github.com/h8gi/wails-sveltekit-template) - A template using SvelteKit
|
||||
|
||||
## Solid
|
||||
|
||||
- [wails-template-vite-solid-ts](https://github.com/xijaja/wails-template-solid-ts) - A template using Solid + Ts + Vite
|
||||
- [wails-template-vite-solid-js](https://github.com/xijaja/wails-template-solid-js) - A template using Solid + Js + Vite
|
||||
|
||||
## Elm
|
||||
|
||||
- [wails-elm-template](https://github.com/benjamin-thomas/wails-elm-template) - Develop your GUI app with functional programming and a **snappy** hot-reload setup :tada: :rocket:
|
||||
- [wails-template-elm-tailwind](https://github.com/rnice01/wails-template-elm-tailwind) - Combine the powers :muscle: of Elm + Tailwind CSS + Wails! Hot reloading supported.
|
||||
|
||||
## HTMX
|
||||
|
||||
- [wails-htmx-templ-chi-tailwind](https://github.com/PylotLight/wails-hmtx-templ-template) - Use a unique combination of pure htmx for interactivity plus templ for creating components and forms
|
||||
|
||||
## Pure JavaScript (Vanilla)
|
||||
|
||||
- [wails-pure-js-template](https://github.com/KiddoV/wails-pure-js-template) - A template with nothing but just basic JavaScript, HTML, and CSS
|
@ -0,0 +1,22 @@
|
||||
---
|
||||
sidebar_position: 6
|
||||
---
|
||||
|
||||
# Compiling your Project
|
||||
|
||||
From the project directory, run `wails build`. This will compile your project and save the production-ready binary in the `build/bin` directory.
|
||||
|
||||
If you run the binary, you should see the default application:
|
||||
|
||||
```mdx-code-block
|
||||
<div class="text--center">
|
||||
<img
|
||||
src={require("@site/static/img/defaultproject.webp").default}
|
||||
width="50%"
|
||||
class="screenshot"
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
```
|
||||
|
||||
For more details on compilation options, please refer to the [CLI Reference](../reference/cli.mdx#build).
|
@ -0,0 +1,16 @@
|
||||
---
|
||||
sidebar_position: 5
|
||||
---
|
||||
|
||||
# Developing your Application
|
||||
|
||||
You can run your application in development mode by running `wails dev` from your project directory. This will do the following things:
|
||||
|
||||
- Build your application and run it
|
||||
- Bind your Go code to the frontend so it can be called from JavaScript
|
||||
- Using the power of [Vite](https://vitejs.dev/), will watch for modifications in your Go files and rebuild/re-run on change
|
||||
- Sets up a [webserver](http://localhost:34115) that will serve your application over a browser. This allows you to use your favourite browser extensions. You can even call your Go code from the console
|
||||
|
||||
To get started, run `wails dev` in the project directory. More information on this can be found [here](../reference/cli.mdx#dev).
|
||||
|
||||
Coming soon: Tutorial
|
@ -0,0 +1,130 @@
|
||||
---
|
||||
sidebar_position: 2
|
||||
---
|
||||
|
||||
# Creating a Project
|
||||
|
||||
## Project Generation
|
||||
|
||||
Now that the CLI is installed, you can generate a new project by using the `wails init` command.
|
||||
|
||||
Pick your favourite framework:
|
||||
|
||||
```mdx-code-block
|
||||
import Tabs from "@theme/Tabs";
|
||||
import TabItem from "@theme/TabItem";
|
||||
|
||||
<Tabs
|
||||
defaultValue="Svelte"
|
||||
values={[
|
||||
{label: "Svelte", value: "Svelte"},
|
||||
{label: "React", value: "React"},
|
||||
{label: "Vue", value: "Vue"},
|
||||
{label: "Preact", value: "Preact"},
|
||||
{label: "Lit", value: "Lit"},
|
||||
{label: "Vanilla", value: "Vanilla"},
|
||||
]}
|
||||
>
|
||||
<TabItem value="Svelte">
|
||||
Generate a <a href={"https://svelte.dev/"}>Svelte</a> project using JavaScript with:<br/><br/>
|
||||
|
||||
wails init -n myproject -t svelte
|
||||
|
||||
If you would rather use TypeScript:<br/>
|
||||
|
||||
wails init -n myproject -t svelte-ts
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="React">
|
||||
Generate a <a href={"https://reactjs.org/"}>React</a> project using JavaScript with:<br/><br/>
|
||||
|
||||
wails init -n myproject -t react
|
||||
|
||||
If you would rather use TypeScript:<br/>
|
||||
|
||||
wails init -n myproject -t react-ts
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="Vue">
|
||||
Generate a <a href={"https://vuejs.org/"}>Vue</a> project using JavaScript with:<br/><br/>
|
||||
|
||||
wails init -n myproject -t vue
|
||||
|
||||
If you would rather use TypeScript:<br/>
|
||||
|
||||
wails init -n myproject -t vue-ts
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="Preact">
|
||||
Generate a <a href={"https://preactjs.com/"}>Preact</a> project using JavaScript with:<br/><br/>
|
||||
|
||||
wails init -n myproject -t preact
|
||||
|
||||
If you would rather use TypeScript:<br/>
|
||||
|
||||
wails init -n myproject -t preact-ts
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="Lit">
|
||||
Generate a <a href={"https://lit.dev/"}>Lit</a> project using JavaScript with:<br/><br/>
|
||||
|
||||
wails init -n myproject -t lit
|
||||
|
||||
If you would rather use TypeScript:<br/>
|
||||
|
||||
wails init -n myproject -t lit-ts
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="Vanilla">
|
||||
Generate a Vanilla project using JavaScript with:<br/><br/>
|
||||
|
||||
wails init -n myproject -t vanilla
|
||||
|
||||
If you would rather use TypeScript:<br/>
|
||||
|
||||
wails init -n myproject -t vanilla-ts
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
```
|
||||
|
||||
<hr />
|
||||
|
||||
There are also [community templates](../community/templates.mdx) available that offer different capabilities and frameworks.
|
||||
|
||||
To see the other options available, you can run `wails init -help`. More details can be found in the [CLI Reference](../reference/cli.mdx#init).
|
||||
|
||||
## Project Layout
|
||||
|
||||
Wails projects have the following layout:
|
||||
|
||||
```
|
||||
.
|
||||
├── build/
|
||||
│ ├── appicon.png
|
||||
│ ├── darwin/
|
||||
│ └── windows/
|
||||
├── frontend/
|
||||
├── go.mod
|
||||
├── go.sum
|
||||
├── main.go
|
||||
└── wails.json
|
||||
```
|
||||
|
||||
### Project structure rundown
|
||||
|
||||
- `/main.go` - The main application
|
||||
- `/frontend/` - Frontend project files
|
||||
- `/build/` - Project build directory
|
||||
- `/build/appicon.png` - The application icon
|
||||
- `/build/darwin/` - Mac specific project files
|
||||
- `/build/windows/` - Windows specific project files
|
||||
- `/wails.json` - The project configuration
|
||||
- `/go.mod` - Go module file
|
||||
- `/go.sum` - Go module checksum file
|
||||
|
||||
The `frontend` directory has nothing specific to Wails and can be any frontend project of your choosing.
|
||||
|
||||
The `build` directory is used during the build process. These files may be updated to customise your builds. If files are removed from the build directory, default versions will be regenerated.
|
||||
|
||||
The default module name in `go.mod` is "changeme". You should change this to something more appropriate.
|
@ -0,0 +1,90 @@
|
||||
---
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
# Installation
|
||||
|
||||
## Supported Platforms
|
||||
|
||||
- Windows 10/11 AMD64/ARM64
|
||||
- MacOS 10.13+ AMD64
|
||||
- MacOS 11.0+ ARM64
|
||||
- Linux AMD64/ARM64
|
||||
|
||||
## Dependencies
|
||||
|
||||
Wails has a number of common dependencies that are required before installation:
|
||||
|
||||
- Go 1.18+
|
||||
- NPM (Node 15+)
|
||||
|
||||
### Go
|
||||
|
||||
Download Go from the [Go Downloads Page](https://go.dev/dl/).
|
||||
|
||||
Ensure that you follow the official [Go installation instructions](https://go.dev/doc/install). You will also need to ensure that your `PATH` environment variable also includes the path to your `~/go/bin` directory. Restart your terminal and do the following checks:
|
||||
|
||||
- Check Go is installed correctly: `go version`
|
||||
- Check "~/go/bin" is in your PATH variable: `echo $PATH | grep go/bin`
|
||||
|
||||
### NPM
|
||||
|
||||
Download NPM from the [Node Downloads Page](https://nodejs.org/en/download/). It is best to use the latest release as that is what we generally test against.
|
||||
|
||||
Run `npm --version` to verify.
|
||||
|
||||
## Platform Specific Dependencies
|
||||
|
||||
You will also need to install platform specific dependencies:
|
||||
|
||||
```mdx-code-block
|
||||
import Tabs from "@theme/Tabs";
|
||||
import TabItem from "@theme/TabItem";
|
||||
|
||||
<Tabs
|
||||
defaultValue="Windows"
|
||||
values={[
|
||||
{ label: "Windows", value: "Windows" },
|
||||
{ label: "MacOS", value: "MacOS" },
|
||||
{ label: "Linux", value: "Linux" },
|
||||
]}
|
||||
>
|
||||
<TabItem value="MacOS">
|
||||
Wails requires that the xcode command line tools are installed. This can be
|
||||
done by running <code>xcode-select --install</code>.
|
||||
</TabItem>
|
||||
<TabItem value="Windows">
|
||||
Wails requires that the <a href="https://developer.microsoft.com/en-us/microsoft-edge/webview2/">WebView2</a> runtime is installed. Some Windows installations will already have this installed. You can check using the <code>wails doctor</code> command.
|
||||
</TabItem>
|
||||
<TabItem value={"Linux"}>
|
||||
Linux requires the standard <code>gcc</code> build tools plus <code>libgtk3</code> and <code>libwebkit</code>. Rather than list a ton of commands for different distros, Wails can try to determine what the installation commands are for your specific distribution. Run <code>wails doctor</code> after installation to be shown how to install the dependencies. If your distro/package manager is not supported, please consult the <a href={"/docs/guides/linux-distro-support"}>Add Linux Distro</a> guide.
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
```
|
||||
|
||||
## Optional Dependencies
|
||||
|
||||
- [UPX](https://upx.github.io/) for compressing your applications.
|
||||
- [NSIS](https://wails.io/docs/guides/windows-installer/) for generating Windows installers.
|
||||
|
||||
## Installing Wails
|
||||
|
||||
Run `go install github.com/wailsapp/wails/v2/cmd/wails@latest` to install the Wails CLI.
|
||||
|
||||
Note: If you get an error similar to this:
|
||||
|
||||
```shell
|
||||
....\Go\pkg\mod\github.com\wailsapp\wails\v2@v2.1.0\pkg\templates\templates.go:28:12: pattern all:ides/*: no matching files found
|
||||
```
|
||||
please check you have Go 1.18+ installed:
|
||||
```shell
|
||||
go version
|
||||
```
|
||||
|
||||
## System Check
|
||||
|
||||
Running `wails doctor` will check if you have the correct dependencies installed. If not, it will advise on what is missing and help on how to rectify any problems.
|
||||
|
||||
## The `wails` command appears to be missing?
|
||||
|
||||
If your system is reporting that the `wails` command is missing, make sure you have followed the Go installation guide correctly. Normally, it means that the `go/bin` directory in your User's home directory is not in the `PATH` environment variable. You will also normally need to close and reopen any open command prompts so that changes to the environment made by the installer are reflected at the command prompt.
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user