Compare commits

..

5 Commits

Author SHA1 Message Date
Lea Anthony cce627e7bd [v3] Update deps 2023-04-06 21:59:39 +10:00
Lea Anthony 5f7b74e05b [v3] Update runtime + messageProcessor to use window names
[v3] Implement `Application.GetWindowByName` in JS
2023-04-06 21:58:16 +10:00
Lea Anthony a998465034 [v3] Update start_at_login plugin to allow better compilation on Linux 2023-04-06 08:29:20 +10:00
Lea Anthony 755e869fe7 [v3] Add start_at_login plugin
[v3] Fix plugin startup/shutdown order
2023-04-05 21:22:02 +10:00
Lea Anthony 7ecbc846b4 [v3] Improved plugin shutdown 2023-04-04 18:01:49 +10:00
38 changed files with 415 additions and 641 deletions
+2 -3
View File
@@ -5,7 +5,7 @@ on:
- cron: '0 1 * * 0' # At 01:00 on Sunday.
push:
branches:
- 'v2/update-contrib-svg'
- master
jobs:
contributors:
@@ -13,11 +13,10 @@ jobs:
if: github.repository == 'wailsapp/wails'
steps:
- uses: actions/checkout@v3
- uses: wow-actions/contributors-list@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
svgPath: ./website/static/img/contributors.svg
svgPath: website/static/img/contributors.svg
noCommit: true
- name: Create Pull Request
+1
View File
@@ -35,3 +35,4 @@ v2/cmd/wails/internal/commands/initialise/templates/testtemplates/
/v3/.task
/v3/examples/build/bin/testapp
/websitev3/site/
/v3/examples/plugins/bin/testapp
Binary file not shown.

Before

Width:  |  Height:  |  Size: 0 B

After

Width:  |  Height:  |  Size: 130 KiB

+1
View File
@@ -14,6 +14,7 @@ require (
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pkg/browser v0.0.0-20210706143420-7d21f8c997e2 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/samber/lo v1.37.0 // indirect
github.com/wailsapp/mimetype v1.4.1 // indirect
+2
View File
@@ -24,6 +24,8 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/pkg/browser v0.0.0-20210706143420-7d21f8c997e2 h1:acNfDZXmm28D2Yg/c3ALnZStzNaZMSagpbr96vY6Zjc=
github.com/pkg/browser v0.0.0-20210706143420-7d21f8c997e2/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.
+5 -1
View File
@@ -8,6 +8,7 @@ import (
"github.com/wailsapp/wails/v3/plugins/log"
"github.com/wailsapp/wails/v3/plugins/single_instance"
"github.com/wailsapp/wails/v3/plugins/sqlite"
"github.com/wailsapp/wails/v3/plugins/start_at_login"
"os"
"plugin_demo/plugins/hashes"
)
@@ -27,7 +28,9 @@ func main() {
"hashes": hashes.NewPlugin(),
"browser": browser.NewPlugin(),
"log": log.NewPlugin(),
"sqlite": sqlite.NewPlugin(&sqlite.Config{}),
"sqlite": sqlite.NewPlugin(&sqlite.Config{
DBFile: "test.db",
}),
"kvstore": kvstore.NewPlugin(&kvstore.Config{
Filename: "store.json",
AutoSave: true,
@@ -36,6 +39,7 @@ func main() {
// When true, the original app will be activated when a second instance is launched
ActivateAppOnSubsequentLaunch: true,
}),
"start_at_login": start_at_login.NewPlugin(),
},
Assets: application.AssetOptions{
FS: assets,
+6 -2
View File
@@ -33,8 +33,11 @@ func main() {
windowCounter := 1
newWindow := func() {
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{}).
SetTitle("WebviewWindow "+strconv.Itoa(windowCounter)).
windowName := "WebviewWindow " + strconv.Itoa(windowCounter)
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{
Name: windowName,
}).
SetTitle(windowName).
SetPosition(rand.Intn(1000), rand.Intn(800)).
Show()
windowCounter++
@@ -50,6 +53,7 @@ func main() {
})
newWindow()
newWindow()
app.SetMenu(menu)
err := app.Run()
+1
View File
@@ -12,6 +12,7 @@ require (
github.com/leaanthony/winicon v1.0.0
github.com/matryer/is v1.4.0
github.com/pkg/browser v0.0.0-20210706143420-7d21f8c997e2
github.com/pkg/errors v0.9.1
github.com/pterm/pterm v0.12.51
github.com/samber/lo v1.37.0
github.com/tc-hib/winres v0.1.6
+2
View File
@@ -96,6 +96,8 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLA
github.com/pkg/browser v0.0.0-20210706143420-7d21f8c997e2 h1:acNfDZXmm28D2Yg/c3ALnZStzNaZMSagpbr96vY6Zjc=
github.com/pkg/browser v0.0.0-20210706143420-7d21f8c997e2/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+7 -4
View File
@@ -22,7 +22,7 @@ import {enableContextMenus} from "./contextmenu";
import {reloadWML} from "./wml";
window.wails = {
...newRuntime(-1),
...newRuntime(null),
};
// Internal wails endpoints
@@ -34,13 +34,16 @@ window._wails = {
callErrorCallback,
};
export function newRuntime(id) {
export function newRuntime(windowName) {
return {
Clipboard: {
...Clipboard
},
Application: {
...Application
...Application,
GetWindowByName(windowName) {
return newRuntime(windowName);
}
},
Log,
Screens,
@@ -65,7 +68,7 @@ export function newRuntime(id) {
Off,
OffAll,
},
Window: newWindow(id),
Window: newWindow(windowName),
};
}
+12 -13
View File
@@ -12,14 +12,20 @@ The electron alternative for Go
const runtimeURL = window.location.origin + "/wails/runtime";
function runtimeCall(method, args) {
function runtimeCall(method, windowName, args) {
let url = new URL(runtimeURL);
url.searchParams.append("method", method);
if(args) {
if (args) {
url.searchParams.append("args", JSON.stringify(args));
}
let fetchOptions = {
headers: {},
};
if (windowName) {
fetchOptions.headers["x-wails-window-name"] = windowName;
}
return new Promise((resolve, reject) => {
fetch(url)
fetch(url, fetchOptions)
.then(response => {
if (response.ok) {
// check content type
@@ -36,15 +42,8 @@ function runtimeCall(method, args) {
});
}
export function newRuntimeCaller(object, id) {
if (!id || id === -1) {
return function (method, args) {
return runtimeCall(object + "." + method, args);
};
}
return function (method, args) {
args = args || {};
args.windowID = id;
return runtimeCall(object + "." + method, args);
export function newRuntimeCaller(object, windowName) {
return function (method, args=null) {
return runtimeCall(object + "." + method, windowName, args);
};
}
+2 -2
View File
@@ -18,8 +18,8 @@ The electron alternative for Go
import {newRuntimeCaller} from "./runtime";
export function newWindow(id) {
let call = newRuntimeCaller("window", id);
export function newWindow(windowName) {
let call = newRuntimeCaller("window", windowName);
return {
// Reload: () => call('WR'),
// ReloadApp: () => call('WR'),
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More