5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 20:03:01 +08:00

v2.0.0-beta.43

This commit is contained in:
Lea Anthony 2022-08-08 20:08:32 +10:00
parent d86daaa211
commit 1955570264
No known key found for this signature in database
GPG Key ID: 33DAF7BB90A58405
69 changed files with 184 additions and 110 deletions

View File

@ -1 +1 @@
v2.0.0-beta.42
v2.0.0-beta.43

View File

@ -7,6 +7,40 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [v2.0.0-beta.42] - 2022-08-08
## Added
* Add support for retrieving the release notes from Github by @leaanthony in https://github.com/wailsapp/wails/pull/1679
* Add `frontend:dev:install` configuration by @LGiki in https://github.com/wailsapp/wails/pull/1666
## Fixed
* Fix formatting of some error messages by @stffabi in https://github.com/wailsapp/wails/pull/1665
* Windows dialogs now work when window is not visible yet by @leaanthony in https://github.com/wailsapp/wails/pull/1662
* Multiple fixes for MacOS asset requests by @stffabi in https://github.com/wailsapp/wails/pull/1668
and https://github.com/wailsapp/wails/pull/1681
* Fix for Go 1.19 by @stffabi in https://github.com/wailsapp/wails/pull/1689
* Removed Linux warnings by @leaanthony in https://github.com/wailsapp/wails/pull/1656
* Better support for doubleclick events in drag regions by @leaanthony in https://github.com/wailsapp/wails/pull/1704
* Allow MacOS frameless window to be miniturisable by @leaanthony in https://github.com/wailsapp/wails/pull/1705
## What's Changed
* add wails-sveltekit-template by @h8gi in https://github.com/wailsapp/wails/pull/1671
* wails doctor now reports correct MacOS os id by @stffabi in https://github.com/wailsapp/wails/pull/1673
* Update application-development.mdx by @SamHennessy in https://github.com/wailsapp/wails/pull/1682
* Move SetMin/Max calls to main thread by @leaanthony in https://github.com/wailsapp/wails/pull/1684
* Change `frontend:dev` to `frontend:dev:build` by @LGiki in https://github.com/wailsapp/wails/pull/1691
* Build frontend only before starting the dev watcher command by @stffabi in https://github.com/wailsapp/wails/pull/1694
* Improve error message for auto dev server discovery without a dev watcher by @stffabi
in https://github.com/wailsapp/wails/pull/1711
## New Contributors
* @h8gi made their first contribution in https://github.com/wailsapp/wails/pull/1671
* @SamHennessy made their first contribution in https://github.com/wailsapp/wails/pull/1682
## [v2.0.0-beta.42] - 2022-07-25
## Added

View File

@ -1,7 +1,8 @@
# EncryptEasy
<p style={{"text-align": "center"}}>
<img src="/img/showcase/encrypteasy.jpg"></img><br/>
<img src="/img/showcase/encrypteasy.jpg"></img><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.**

View File

@ -1,7 +1,8 @@
# FileHound Export Utility
<p style={{"text-align": "center"}}>
<img src="/img/showcase/filehound.jpg"></img><br/>
<img src="/img/showcase/filehound.jpg"></img><br/>
</p>

View File

@ -1,7 +1,8 @@
# Molley Wallet
<p style={{"text-align": "center"}}>
<img src="/img/showcase/mollywallet.png"></img><br/>
<img src="/img/showcase/mollywallet.png"></img><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.

View File

@ -1,7 +1,7 @@
# October
<p style={{"text-align": "center"}}>
<img src="/img/showcase/october.png"></img><br/>
<img src="/img/showcase/october.png"></img><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).

View File

@ -1,7 +1,8 @@
# Optimus
<p style={{"text-align": "center"}}>
<img src="/img/showcase/optimus.png"></img><br/>
<img src="/img/showcase/optimus.png"></img><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.

View File

@ -1,7 +1,8 @@
# Portfall
<p style={{"text-align": "center"}}>
<img src="/img/showcase/portfall.gif"></img><br/>
<img src="/img/showcase/portfall.gif"></img><br/>
</p>
[Portfall](https://github.com/rekon-oss/portfall) - A desktop k8s port-forwarding portal for easy access to all your cluster UIs

View File

@ -1,7 +1,8 @@
# Restic Browser
<p style={{"text-align": "center"}}>
<img src="/img/showcase/restic-browser-2.png"></img><br/>
<img src="/img/showcase/restic-browser-2.png"></img><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.

View File

@ -1,7 +1,8 @@
# RiftShare
<p style={{"text-align": "center"}}>
<img src="/img/showcase/riftshare-main.webp"></img><br/>
<img src="/img/showcase/riftshare-main.webp"></img><br/>
</p>
Easy, Secure, and Free file sharing for everyone. Learn more at [Riftshare.app](https://riftshare.app)

View File

@ -1,7 +1,8 @@
# Surge
<p style={{"text-align": "center"}}>
<img src="/img/showcase/surge.png"></img><br/>
<img src="/img/showcase/surge.png"></img><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.

View File

@ -1,7 +1,8 @@
# Wally
<p style={{"text-align": "center"}}>
<img src="/img/showcase/wally.png"></img><br/>
<img src="/img/showcase/wally.png"></img><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.

View File

@ -1,7 +1,8 @@
# Wombat
<p style={{"text-align": "center"}}>
<img src="/img/showcase/wombat.png"></img><br/>
<img src="/img/showcase/wombat.png"></img><br/>
</p>

View File

@ -1,7 +1,8 @@
# Ytd
<p>
<img src="/img/showcase/ytd.png"></img><br/>
<img src="/img/showcase/ytd.png"></img><br/>
</p>

View File

@ -42,6 +42,7 @@ If you are unsure about a template, inspect `package.json` and `wails.json` for
- [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-sveltekit-template](https://github.com/h8gi/wails-sveltekit-template) - A template using SvelteKit
## Elm

View File

@ -10,8 +10,7 @@ This will compile your project and save the production-ready binary in the `buil
If you run the binary, you should see the default application:
<div class="text--center">
<img src="/img/defaultproject.png" width="50%"
style={{"box-shadow": "rgb(255 255 255 / 20%) 0px 4px 8px 0px, rgb(104 104 104) 0px 6px 20px 0px"}}/>
<img src="/img/defaultproject.png" width="50%" style={{"box-shadow": "rgb(255 255 255 / 20%) 0px 4px 8px 0px, rgb(104 104 104) 0px 6px 20px 0px"}}/>
</div>
<br/>

View File

@ -10,7 +10,7 @@ Now that the CLI is installed, you can generate a new project by using the `wail
Pick your favourite framework:
import TabsFrameworks from "../../../src/components/frameworktabs";
import TabsFrameworks from "../../src/components/frameworktabs";
<TabsFrameworks/>
<hr/>

View File

@ -37,10 +37,9 @@ Run `npm --version` to verify.
You will also need to install platform specific dependencies:
import TabsInstaller from "../../../src/components/tabinstall";
import TabsInstaller from "../../src/components/tabinstall";
<TabsInstaller />
## Optional Dependencies
- [UPX](https://upx.github.io/) for compressing your applications.

View File

@ -1,3 +1,4 @@
# Application Development
There are no hard and fast rules for developing applications with Wails, but there are some basic guidelines.
@ -27,13 +28,13 @@ func (a *App) shutdown(ctx context.Context) {
```
- The startup method is called as soon as Wails allocates the resources it needs and is a good place for creating resources,
setting up event listeners and anything else the application needs at startup.
It is given a `context.Context` which is usually saved in a struct field. This context is needed for calling the
[runtime](../reference/runtime/intro.mdx). If this method returns an error, the application will terminate.
In dev mode, the error will be output to the console.
setting up event listeners and anything else the application needs at startup.
It is given a `context.Context` which is usually saved in a struct field. This context is needed for calling the
[runtime](../reference/runtime/intro.mdx). If this method returns an error, the application will terminate.
In dev mode, the error will be output to the console.
- The shutdown method will be called by Wails right at the end of the shutdown process. This is a good place to deallocate
memory and perform any shutdown tasks.
memory and perform any shutdown tasks.
The `main.go` file generally consists of a single call to `wails.Run()`, which accepts the application configuration.
The pattern used by the templates is that before the call to `wails.Run()`, an instance of the struct we defined in
@ -82,7 +83,7 @@ func (a *App) shutdown(ctx context.Context) {
}
func (a *App) Greet(name string) string {
return fmt.Printf("Hello %s!", name)
return fmt.Sprintf("Hello %s!", name)
}
```

View File

@ -1,3 +1,4 @@
# Frameless Applications
Wails supports applications with no frame. This can be achieved by using the [frameless](../reference/options.mdx#frameless)
@ -30,5 +31,5 @@ The `<div id="input" data-wails-no-drag>` is tagged as being not draggable.
```
:::info Fullscreen
If you allow your application to go fullscreen, this drag functionality will be disabled.
If you allow your application to go fullscreen, this drag functionality will be disabled.
:::

View File

@ -1,3 +1,4 @@
# IDEs
Wails aims to provide a great development experience. To that aim, we now support generating IDE specific configuration

View File

@ -1,3 +1,4 @@
# Manual Builds
The Wails CLI does a lot of heavy lifting for the project, but sometimes it's desirable to manually build your project.
@ -23,10 +24,10 @@ When either `wails build` or `wails dev` are used, the Wails CLI performs a comm
- If there is, it checks if `package.json` exists in the frontend directory. If it doesn't exist, it skips this step
- An MD5 sum is generated from the `package.json` file contents
- It checks for the existence of `package.json.md5` and if it exists, will compare the contents of it (an MD5 sum)
with the one generated to see if the contents have changed. If they are the same, this step is skipped
with the one generated to see if the contents have changed. If they are the same, this step is skipped
- If `package.json.md5` does not exist, it creates it using the generated MD5 sum
- If a build is now required, or `node_modules` does not exist, or the `-f` flag is given, the install command is
executed in the frontend directory
executed in the frontend directory
#### Manual Steps
@ -74,7 +75,7 @@ This step could be done from the command line or a script with `npm run build` o
- If the `-clean` flag is provided, the `build` directory is deleted and recreated
- For `wails dev`, the following default Go flags are used: `-tags dev -gcflags "all=-N -l"`
- For `wails build`, the following default Go flags are used: `-tags desktop,production -ldflags "-w -s"`
- On Windows, `-ldflags "-w -h -H windowsgui"`
- On Windows, `-ldflags "-w -h -H windowsgui"`
- Additional tags passed to the CLI using `-tags` are added to the defaults
- Additional ldflags passed to the CLI using `-ldflags` are added to the defaults
- The `-o` flag is passed through

View File

@ -1,3 +1,4 @@
# Migrating from v1
## Overview
@ -183,25 +184,23 @@ The format of the file is slightly different. Here is a comparison:
<p align="center">
| v1 | v2 | Notes |
| ------------------ | ---------------- | --------------------------------------------------- |
| name | name | |
| description | | Removed |
| author / name | author / name | |
| author / email | author / email | |
| version | version | |
| binaryname | outputfilename | Changed |
| frontend / dir | | Removed |
| frontend / install | frontend:install | Changed |
| frontend / build | frontend:build | Changed |
| frontend / bridge | | Removed |
| 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. |
| v1 | v2 | Notes |
| ------------------ | ---------------- | --------------------------------------------------- |
| name | name | |
| description | | Removed |
| author / name | author / name | |
| author / email | author / email | |
| version | version | |
| binaryname | outputfilename | Changed |
| frontend / dir | | Removed |
| frontend / install | frontend:install | Changed |
| frontend / build | frontend:build | Changed |
| frontend / bridge | | Removed |
| 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. |
</p>

View File

@ -1,7 +1,7 @@
# Mouse Buttons
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.
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:
```javascript

View File

@ -1,3 +1,4 @@
# Overscroll
[Overscroll](https://developer.mozilla.org/en-US/docs/Web/CSS/overscroll-behavior) is the "bounce effect" you sometimes

View File

@ -1,3 +1,4 @@
# Routing
Routing is a popular way to switch views in an application. This page offers some guidance around how to do that.

View File

@ -10,11 +10,11 @@ Please note that an EV certificate is not required unless you need to write kern
software such as device drivers. For signing your Wails app, a standard code signing
certificate will do just fine.
It may be a good idea to check with your certificate provider
how to sign your binaries on your local machine before targeting automated build systems, just so you know if there
are any special requirements. For instance, [here](https://www.ssl.com/how-to/using-your-code-signing-certificate/) is SSL.com's code signing guide for Windows.
It may be a good idea to check with your certificate provider
how to sign your binaries on your local machine before targeting automated build systems, just so you know if there
are any special requirements. For instance, [here](https://www.ssl.com/how-to/using-your-code-signing-certificate/) is SSL.com's code signing guide for Windows.
If you know how to sign locally, it will be easier to
troubleshoot any potential issues in a CI environment.
troubleshoot any potential issues in a CI environment.
For instance, SSL.com code signing certificates require the `/tr` flag for [SignTool.exe](https://docs.microsoft.com/en-us/windows/win32/seccrypto/signtool)
while other providers may only need the `/t` flag for providing the timestamping server. Popular GitHub Actions for signing
Windows binaries like [this one](https://github.com/Dana-Prajea/code-sign-action) does not support the `/tr` flag on SignTool.exe.
@ -66,13 +66,13 @@ jobs:
```
Next we need to give the GitHub workflow access to our signing certificate. This is done by encoding your .pfx or .p12 certificate
into a base64 string. To do this in PowerShell, you can use the following command assuming your certificate is called 'my-cert.p12':
into a base64 string. To do this in PowerShell, you can use the following command assuming your certificate is called 'my-cert.p12':
```PowerShell
certutil -encode .\my-cert.p12 my-cert-base64.txt
```
You should now have your .txt file with the base64 encoded certificate. It should start with *-----BEGIN CERTIFICATE-----* and
end with *-----END CERTIFICATE-----*. Now you need to make two action secrets on GitHub. Navigate to *Settings -> Secrets -> Actions* and create the
end with *-----END CERTIFICATE-----*. Now you need to make two action secrets on GitHub. Navigate to *Settings -> Secrets -> Actions* and create the
two following secrets:
* **WIN_SIGNING_CERT** with the contents of your base64 encoded certificate text.
* **WIN_SIGNING_CERT_PASSWORD** with the contents of your certificate password.
@ -220,8 +220,8 @@ jobs:
path: build/bin/*
```
For code signing on macOS, [gon](https://github.com/mitchellh/gon) is a very handy tool for code signing and communicating with Apple servers, also written in Go, and
will be used in this guide.
For code signing on macOS, [gon](https://github.com/mitchellh/gon) is a very handy tool for code signing and communicating with Apple servers, also written in Go, and
will be used in this guide.
After the `Build Wails app` step, add the following to the workflow:
```yaml
@ -247,8 +247,8 @@ Now we need to configure some gon config files in our `build/darwin` directory:
}
}
```
Where `source` is your Wails binary, `bundle_id` is your bundle ID, `apple_id` contains your Apple ID username and App-Specific password
which you created earlier, and `sign.application_identity` is your identity which you can find by running the following command:
Where `source` is your Wails binary, `bundle_id` is your bundle ID, `apple_id` contains your Apple ID username and App-Specific password
which you created earlier, and `sign.application_identity` is your identity which you can find by running the following command:
```bash
security find-identity -v -p codesigning
```
@ -271,9 +271,9 @@ which you created earlier, and `sign.application_identity` is your identity whic
</dict>
</plist>
```
In this file you configure the entitlements you need for you app, e.g. camera permissions if your app uses the camera. Read more about entitlements [here](https://developer.apple.com/documentation/bundleresources/entitlements).
In this file you configure the entitlements you need for you app, e.g. camera permissions if your app uses the camera. Read more about entitlements [here](https://developer.apple.com/documentation/bundleresources/entitlements).
Make sure you have updated your `Info.plist` file with the same bundle ID as you entered in `gon-sign.json`.
Make sure you have updated your `Info.plist` file with the same bundle ID as you entered in `gon-sign.json`.
Here's an example `Info.plist` file:
```plist
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

View File

@ -1,3 +1,4 @@
# Templates
Wails generates projects from pre-created templates. In v1, this was a difficult to maintain set of projects that were
@ -60,7 +61,7 @@ the template. We will now walk through how to create a Vue 3 template:
- 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)`
- Select `Default (Vue 3) ([Vue 3] babel, eslint)`
- After the project has been generated, run:
```shell
@ -80,7 +81,7 @@ Renaming package-lock.json -> package-lock.tmpl.json...
- You should have a fully functioning Vue3 application:
<div className="text--center">
<img src="/img/vue3-template.png" width="50%"/>
<img src="/img/vue3-template.png" width="50%" />
</div>
## Publishing Templates

View File

@ -1,7 +1,7 @@
# NSIS installer
<p style={{"text-align": "center"}}>
<img src="/img/nsis.png" style={{"max-width": "50%"}}></img><br/>
<img src="/img/nsis.png" style={{"max-width":"50%"}}></img><br/>
</p>
Wails supports generating Windows installers using the [NSIS installer](https://nsis.sourceforge.io/).

View File

@ -1,3 +1,4 @@
# Windows
This page has miscellaneous guides related to developing Wails applications for Windows.

View File

@ -11,7 +11,7 @@ version of the runtime library. Finally, it is possible to bind Go methods to th
Javascript methods that can be called, just as if they were local Javascript methods.
<div className="text--center">
<img src="/img/architecture.svg" width="75%"/>
<img src="/img/architecture.svg" width="75%" />
</div>
## The Main Application
@ -130,7 +130,7 @@ by the frontend code.
:::info Note
Wails requires that you pass in an *instance* of the struct for it to bind it correctly
Wails requires that you pass in an *instance* of the struct for it to bind it correctly
:::
@ -207,7 +207,7 @@ This makes it incredibly simple to call Go code from the frontend, using the sam
### Overview
The frontend is a collection of files rendered by webkit. It''s like a browser and webserver in one.
The frontend is a collection of files rendered by webkit. It's like a browser and webserver in one.
There is virtually[^1] no limit to which frameworks or libraries you can use. The main points of interaction between
the frontend and your Go code are:
@ -215,8 +215,8 @@ the frontend and your Go code are:
- Calling runtime methods
[^1]:
There is a very small subset of libraries that use features unsupported in WebViews. There are often alternatives and
workarounds for such cases.
There is a very small subset of libraries that use features unsupported in WebViews. There are often alternatives and
workarounds for such cases.
### Calling bound Go methods
@ -253,7 +253,7 @@ export function Greet(arg1:string):Promise<string>;
```
The generated methods return a Promise. A successful call will result in the first return value from the Go call to be passed
to the `resolve` handler. An unsuccessful call is when a Go method that has an error type as it''s second return value,
to the `resolve` handler. An unsuccessful call is when a Go method that has an error type as it's second return value,
passes an error instance back to the caller. This is passed back via the `reject` handler.
In the example above, `Greet` only returns a `string` so the Javascript call will never reject - unless invalid data
is passed to it.
@ -268,12 +268,12 @@ Anonymous nested structs are not supported at this time.
It is possible to send structs back to Go. Any Javascript map/class passed as an argument that
is expecting a struct, will be converted to that struct type. To make this process a lot easier, in `dev` mode,
a TypeScript module is generated, defining all the struct types used in bound methods. Using this module, it''s possible
a TypeScript module is generated, defining all the struct types used in bound methods. Using this module, it's possible
to construct and send native Javascript objects to the Go code.
There is also support for Go methods that use structs in their signature. All Go structs
specified by a bound method (either as parameters or return types) will have Typescript versions auto
generated as part of the Go code wrapper module. Using these, it''s possible to share the same data
generated as part of the Go code wrapper module. Using these, it's possible to share the same data
model between Go and Javascript.
Example: We update our `Greet` method to accept a `Person` instead of a string:

View File

@ -24,7 +24,7 @@ The Wails CLI has a number of commands that are used for managing your projects.
| -f | Force build application | false |
Example:
`wails init -n test -d mytestproject -g -ide vscode -q`
`wails init -n test -d mytestproject -g -ide vscode -q`
This will generate a a project called "test" in the "mytestproject" directory, initialise git,
generate vscode project files and do so silently.
@ -36,15 +36,15 @@ More information on using IDEs with Wails can be found [here](../guides/ides.mdx
Remote templates (hosted on GitHub) are supported and can be installed by using the template's project URL.
Example:
`wails init -n test -t https://github.com/leaanthony/testtemplate[@v1.0.0]`
`wails init -n test -t https://github.com/leaanthony/testtemplate[@v1.0.0]`
A list of community maintained templates can be found [here](../community/templates.mdx)
:::warning Attention
**The Wails project does not maintain, is not responsible nor liable for 3rd party templates!**
**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.
If you are unsure about a template, inspect `package.json` and `wails.json` for what scripts are run and what packages are installed.
:::
@ -54,13 +54,13 @@ If you are unsure about a template, inspect `package.json` and `wails.json` for
| Flag | Description | Default |
| :------------------- | :-------------------------------------- | :------------------------- |
| -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. | runtime.GOOS/runtime.GOARCH |
| -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`. |
| -clean | Cleans the `build/bin` directory | |
| -compiler "compiler"| Use a different go compiler to build, eg go1.15beta1 | go |
| -ldflags "flags" | Additional ldflags to pass to the compiler | |
| -nopackage | Do not package application | |
| -o filename | Output filename | |
| -s | Skip building the frontend | |
| -s | Skip building the frontend | false |
| -f | Force build application | false |
| -tags "extra tags" | Build tags to pass to compiler (quoted and space separated) | |
| -upx | Compress final binary using "upx" | |
@ -84,13 +84,13 @@ Example:
:::info UPX on Apple Silicon
There are [issues](https://github.com/upx/upx/issues/446) with using UPX with Apple Silicon.
There are [issues](https://github.com/upx/upx/issues/446) with using UPX with Apple Silicon.
:::
:::info UPX on Windows
Some Antivirus vendors false positively mark `upx` compressed binaries as virus, see [issue](https://github.com/upx/upx/issues/437).
Some Antivirus vendors false positively mark `upx` compressed binaries as virus, see [issue](https://github.com/upx/upx/issues/437).
:::
@ -155,8 +155,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
| Flag | Description | Default |
@ -177,9 +177,9 @@ Your system is ready for Wails development!
| -devserver "host:port" | The address to bind the wails dev server to | "localhost:34115" |
| -frontenddevserverurl "url" | Use 3rd party dev server url to serve assets, EG Vite | "" |
| -appargs "args" | Arguments passed to the application in shell style | |
| -platform "platform" | Platform/Arch to target | `runtime.GOOS` |
| -save | Saves the given `assetdir`, `reloaddirs`, `wailsjsdir`, `debounce`, `devserver` and `frontenddevserverurl` flags in `wails.json` to become the defaults for subsequent invocations. | |
| -race | Build with Go's race detector | false |
| -s | Skip building the frontend | false |
Example:
@ -208,6 +208,10 @@ it may be used for generating projects.
For more details on creating templates, consult the [Templates guide](../guides/templates.mdx).
### module
The `wails generate module` command allows you to manually generate the `wailsjs` directory for your application.
## update
`wails update` will update the version of the Wails CLI.

View File

@ -12,16 +12,16 @@ An example of how to create a menu:
```go
AppMenu := menu.NewMenu()
if runtime.GOOS == "darwin" {
AppMenu.Append(menu.AppMenu()) // On MacOS platform, the first menu will always be fixed
AppMenu.Append(menu.EditMenu()) // on macos platform, we should append EditMenu to enable Cmd+C,Cmd+V,Cmd+Z... shortcut
}
FileMenu := AppMenu.AddSubmenu("File")
FileMenu.AddText("&Open", keys.CmdOrCtrl("o"), openFile)
FileMenu.AddSeparator()
FileMenu.AddText("Quit", keys.CmdOrCtrl("q"), func(_ *menu.CallbackData) {
a.Quit() // Must define a Quit function in app.go with context
runtime.Quit()
})
if runtime.GOOS == "darwin" {
AppMenu.Append(menu.EditMenu()) // on macos platform, we should append EditMenu to enable Cmd+C,Cmd+V,Cmd+Z... shortcut
}
err := wails.Run(&options.App{
Title: "Menus Demo",
@ -258,7 +258,7 @@ using radio groups that may share a callback.
:::info Roles
Roles are currently supported on Mac only.
Roles are currently supported on Mac only.
:::

View File

@ -19,7 +19,7 @@ func main() {
Width: 800,
Height: 600,
DisableResize: false,
//Fullscreen: false, // This option is deprecated. Use WindowStartState instead
Fullscreen: false,
Frameless: true,
MinWidth: 400,
MinHeight: 400,
@ -135,8 +135,6 @@ Type: bool
Setting this to `true` will make the window fullscreen at startup.
Note: Fullscreen is deprecated. Use WindowStartState: options.Fullscreen instead
### Frameless
Name: Frameless
@ -704,16 +702,14 @@ func main() {
The "About" menu item will appear in the app menu:
<div class="text--center">
<img src="/img/reference/about-menu.png"
style={{"box-shadow": "rgb(255 255 255 / 20%) 0px 4px 8px 0px, rgb(104 104 104) 0px 6px 20px 0px"}}/>
<img src="/img/reference/about-menu.png" style={{"box-shadow": "rgb(255 255 255 / 20%) 0px 4px 8px 0px, rgb(104 104 104) 0px 6px 20px 0px"}}/>
</div>
<br/>
When clicked, that will open an about message box:
<div class="text--center">
<img src="/img/reference/about-dialog.png" width="40%"
style={{"box-shadow": "rgb(255 255 255 / 20%) 0px 4px 8px 0px, rgb(104 104 104) 0px 6px 20px 0px"}}/>
<img src="/img/reference/about-dialog.png" width="40%" style={{"box-shadow": "rgb(255 255 255 / 20%) 0px 4px 8px 0px, rgb(104 104 104) 0px 6px 20px 0px"}}/>
</div>
<br/>

View File

@ -13,7 +13,9 @@ The project config resides in the `wails.json` file in the project directory. Th
"reloaddirs": "[Additional directories to trigger reloads (comma separated), this is only used for some advanced asset configurations]",
"frontend:install": "[The command to install node dependencies, run in the frontend directory - often `npm install`]",
"frontend:build": "[The command to build the assets, run in the frontend directory - often `npm run build`]",
"frontend:dev": "[This command is the dev equivalent of frontend:build. If not specified falls back to frontend:build]",
"frontend:dev": "[This command has been replaced by frontend:dev:build. If frontend:dev:build is not specified will falls back to this command. If this command is also not specified will falls back to frontend:build]",
"frontend:dev:build": "[This command is the dev equivalent of frontend:build. If not specified falls back to frontend:dev]",
"frontend:dev:install": "[This command is the dev equivalent of frontend:install. If not specified falls back to frontend:install]",
"frontend:dev:watcher": "[This command is run in a separate process on `wails dev`. Useful for 3rd party watchers or starting 3d party dev servers]",
"frontend:dev:serverUrl": "[URL to a 3rd party dev server to be used to serve assets, EG Vite. If this is set to 'auto' then the devServerUrl will be inferred from the Vite output]",
"wailsjsdir": "[Relative path to the directory that the auto-generated JS modules will be created]",

View File

@ -9,7 +9,7 @@ sidebar_position: 5
This part of the runtime provides access to native dialogs, such as File Selectors and Message boxes.
:::info Javascript
Dialog is currently unsupported in the JS runtime.
Dialog is currently unsupported in the JS runtime.
:::
### OpenDirectoryDialog
@ -157,8 +157,7 @@ selection, err := runtime.MessageDialog(b.ctx, runtime.MessageDialogOptions{
```
the first button is shown as default:
<div class="text--center">
<img src="/img/runtime/dialog_no_defaults.png" width="30%"
style={{"box-shadow": "rgb(255 255 255 / 20%) 0px 4px 8px 0px, rgb(104 104 104) 0px 6px 20px 0px"}}/>
<img src="/img/runtime/dialog_no_defaults.png" width="30%" style={{"box-shadow": "rgb(255 255 255 / 20%) 0px 4px 8px 0px, rgb(104 104 104) 0px 6px 20px 0px"}}/>
</div>
<br/>
@ -173,8 +172,7 @@ selection, err := runtime.MessageDialog(b.ctx, runtime.MessageDialogOptions{
```
the second button is shown as default. When `return` is pressed, the value "two" is returned.
<div class="text--center">
<img src="/img/runtime/dialog_default_button.png" width="30%"
style={{"box-shadow": "rgb(255 255 255 / 20%) 0px 4px 8px 0px, rgb(104 104 104) 0px 6px 20px 0px"}}/>
<img src="/img/runtime/dialog_default_button.png" width="30%" style={{"box-shadow": "rgb(255 255 255 / 20%) 0px 4px 8px 0px, rgb(104 104 104) 0px 6px 20px 0px"}}/>
</div>
<br/>
@ -190,8 +188,7 @@ selection, err := runtime.MessageDialog(b.ctx, runtime.MessageDialogOptions{
```
the button with "three" is shown at the bottom of the dialog. When `escape` is pressed, the value "three" is returned:
<div class="text--center">
<img src="/img/runtime/dialog_default_cancel.png" width="30%"
style={{"box-shadow": "rgb(255 255 255 / 20%) 0px 4px 8px 0px, rgb(104 104 104) 0px 6px 20px 0px"}}/>
<img src="/img/runtime/dialog_default_cancel.png" width="30%" style={{"box-shadow": "rgb(255 255 255 / 20%) 0px 4px 8px 0px, rgb(104 104 104) 0px 6px 20px 0px"}}/>
</div>
<br/>
<br/>
@ -224,8 +221,7 @@ Windows allows you to use multiple file filters in dialog boxes. Each FileFilter
dialog:
<div class="text--center">
<img src="/img/runtime/dialog_win_filters.png" width="50%"
style={{"box-shadow": "rgb(255 255 255 / 20%) 0px 4px 8px 0px, rgb(104 104 104) 0px 6px 20px 0px"}}/>
<img src="/img/runtime/dialog_win_filters.png" width="50%" style={{"box-shadow": "rgb(255 255 255 / 20%) 0px 4px 8px 0px, rgb(104 104 104) 0px 6px 20px 0px"}}/>
</div>
<br/>
<br/>
@ -237,8 +233,7 @@ Linux allows you to use multiple file filters in dialog boxes. Each FileFilter w
dialog:
<div class="text--center">
<img src="/img/runtime/dialog_lin_filters.png" width="50%"
style={{"box-shadow": "rgb(255 255 255 / 20%) 0px 4px 8px 0px, rgb(104 104 104) 0px 6px 20px 0px"}}/>
<img src="/img/runtime/dialog_lin_filters.png" width="50%" style={{"box-shadow": "rgb(255 255 255 / 20%) 0px 4px 8px 0px, rgb(104 104 104) 0px 6px 20px 0px"}}/>
</div>
<br/>
<br/>

View File

@ -24,6 +24,29 @@ The Javascript library is available to the frontend via the `window.runtime` map
mode that provides Typescript declarations for the runtime. This should be located in the `wailsjs` directory in your
frontend directory.
### Hide
Go Signature: `Hide(ctx context.Context)`
Hides the application.
:::info Note
On Mac, this will hide the application in the same way as the `Hide` menu item in standard Mac applications.
This is different to hiding the window, but the application still being in the foreground.
For Windows and Linux, this is currently the same as `WindowHide`.
:::
### Show
Go Signature: `Show(ctx context.Context)`
Shows the application.
:::info Note
On Mac, this will bring the application back into the foreground.
For Windows and Linux, this is currently the same as `WindowShow`.
:::
### Quit
Go Signature: `Quit(ctx context.Context)`

View File

@ -9,7 +9,7 @@ sidebar_position: 6
These methods are related to the application menu.
:::info Javascript
Menu is currently unsupported in the JS runtime.
Menu is currently unsupported in the JS runtime.
:::
### MenuSetApplicationMenu

View File

@ -1,4 +1,4 @@
[
"v2.0.0-beta.40",
"v2.0.0-beta.39"
"v2.0.0-beta.43",
"v2.0.0-beta.40"
]