mirror of
https://github.com/taigrr/wails.git
synced 2026-04-14 02:48:21 -07:00
Compare commits
21 Commits
v2-mac-doc
...
930_-_defa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c678ab7d01 | ||
|
|
56ef4ddd47 | ||
|
|
bad9ad3dd7 | ||
|
|
36570645ff | ||
|
|
3711bdc41e | ||
|
|
cbdcd9f63e | ||
|
|
a9268bc56e | ||
|
|
f489347fca | ||
|
|
663925f9e8 | ||
|
|
cc2651c377 | ||
|
|
e651b9c7ff | ||
|
|
bcad236fb6 | ||
|
|
0af8d506c1 | ||
|
|
0b65a0f508 | ||
|
|
b03a758747 | ||
|
|
44597f2fbc | ||
|
|
0844113f3a | ||
|
|
79e99b68d6 | ||
|
|
c64b7bb79c | ||
|
|
e72b438ad2 | ||
|
|
3e4a112a3d |
@@ -97,6 +97,9 @@ This project is supported by these kind people / companies:
|
|||||||
<a href="https://github.com/codydbentley" style="width:100px">
|
<a href="https://github.com/codydbentley" style="width:100px">
|
||||||
<img src="https://github.com/codydbentley.png?size=100" width="100"/>
|
<img src="https://github.com/codydbentley.png?size=100" width="100"/>
|
||||||
</a>
|
</a>
|
||||||
|
<a href="https://github.com/CrackDavid" style="width:100px">
|
||||||
|
<img src="https://github.com/CrackDavid.png?size=100" width="100"/>
|
||||||
|
</a>
|
||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
<a href="https://github.com/matryer" style="width:100px">
|
<a href="https://github.com/matryer" style="width:100px">
|
||||||
|
|||||||
@@ -100,6 +100,9 @@
|
|||||||
<a href="https://github.com/codydbentley" style="width:100px">
|
<a href="https://github.com/codydbentley" style="width:100px">
|
||||||
<img src="https://github.com/codydbentley.png?size=100" width="100"/>
|
<img src="https://github.com/codydbentley.png?size=100" width="100"/>
|
||||||
</a>
|
</a>
|
||||||
|
<a href="https://github.com/CrackDavid" style="width:100px">
|
||||||
|
<img src="https://github.com/CrackDavid.png?size=100" width="100"/>
|
||||||
|
</a>
|
||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
<a href="https://github.com/matryer" style="width:100px">
|
<a href="https://github.com/matryer" style="width:100px">
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
html {
|
html {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: white;
|
color: white;
|
||||||
background-color: rgba(0, 0, 0, 0);
|
background-color: rgba(33, 37, 43, 0.2);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ func main() {
|
|||||||
Frameless: false,
|
Frameless: false,
|
||||||
StartHidden: false,
|
StartHidden: false,
|
||||||
HideWindowOnClose: false,
|
HideWindowOnClose: false,
|
||||||
RGBA: &options.RGBA{R: 0, G: 0, B: 0, A: 0},
|
RGBA: &options.RGBA{R: 33, G: 37, B: 43, A: 255},
|
||||||
Assets: assets,
|
Assets: assets,
|
||||||
LogLevel: logger.DEBUG,
|
LogLevel: logger.DEBUG,
|
||||||
OnStartup: app.startup,
|
OnStartup: app.startup,
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
"assetdir": "frontend/dist",
|
"assetdir": "frontend/dist",
|
||||||
"frontend:install": "npm install",
|
"frontend:install": "npm install",
|
||||||
"frontend:build": "npm run build",
|
"frontend:build": "npm run build",
|
||||||
|
"wailsjsdir": "./frontend",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "{{.AuthorName}}",
|
"name": "{{.AuthorName}}",
|
||||||
"email": "{{.AuthorEmail}}"
|
"email": "{{.AuthorEmail}}"
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
html {
|
html {
|
||||||
background-color: rgba(33, 37, 43, 0);
|
background-color: rgba(33, 37, 43, 0.2);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
color: white;
|
|
||||||
font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
|
font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
|
||||||
"Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
|
"Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
|
||||||
sans-serif;
|
sans-serif;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ func main() {
|
|||||||
Frameless: false,
|
Frameless: false,
|
||||||
StartHidden: false,
|
StartHidden: false,
|
||||||
HideWindowOnClose: false,
|
HideWindowOnClose: false,
|
||||||
RGBA: &options.RGBA{R: 0, G: 0, B: 0, A: 0},
|
RGBA: &options.RGBA{R: 33, G: 37, B: 43, A: 255},
|
||||||
Assets: assets,
|
Assets: assets,
|
||||||
LogLevel: logger.DEBUG,
|
LogLevel: logger.DEBUG,
|
||||||
OnStartup: app.startup,
|
OnStartup: app.startup,
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
"name": "{{.ProjectName}}",
|
"name": "{{.ProjectName}}",
|
||||||
"outputfilename": "{{.BinaryName}}",
|
"outputfilename": "{{.BinaryName}}",
|
||||||
"assetdir": "frontend/src",
|
"assetdir": "frontend/src",
|
||||||
|
"wailsjsdir": "./frontend",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "{{.AuthorName}}",
|
"name": "{{.AuthorName}}",
|
||||||
"email": "{{.AuthorEmail}}"
|
"email": "{{.AuthorEmail}}"
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
package internal
|
package internal
|
||||||
|
|
||||||
var Version = "v2.0.0-beta.15"
|
var Version = "v2.0.0-beta.20"
|
||||||
|
|||||||
@@ -61,6 +61,9 @@ func generateBindings(bindings *binding.Bindings) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if projectConfig.WailsJSDir == "" {
|
||||||
|
projectConfig.WailsJSDir = filepath.Join(cwd, "frontend")
|
||||||
|
}
|
||||||
wrapperDir := filepath.Join(projectConfig.WailsJSDir, "wailsjs", "runtime")
|
wrapperDir := filepath.Join(projectConfig.WailsJSDir, "wailsjs", "runtime")
|
||||||
_ = os.RemoveAll(wrapperDir)
|
_ = os.RemoveAll(wrapperDir)
|
||||||
extractor := gosod.New(wrapper.RuntimeWrapper)
|
extractor := gosod.New(wrapper.RuntimeWrapper)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ package appng
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"flag"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
@@ -58,10 +59,37 @@ func CreateApp(appoptions *options.App) (*App, error) {
|
|||||||
myLogger.SetLogLevel(appoptions.LogLevel)
|
myLogger.SetLogLevel(appoptions.LogLevel)
|
||||||
|
|
||||||
// Check for CLI Flags
|
// Check for CLI Flags
|
||||||
|
var assetdirFlag *string
|
||||||
|
var devServerURLFlag *string
|
||||||
|
var loglevelFlag *string
|
||||||
|
|
||||||
assetdir := os.Getenv("assetdir")
|
assetdir := os.Getenv("assetdir")
|
||||||
|
if assetdir == "" {
|
||||||
|
assetdirFlag = flag.String("assetdir", "", "Directory to serve assets")
|
||||||
|
}
|
||||||
devServerURL := os.Getenv("devserverurl")
|
devServerURL := os.Getenv("devserverurl")
|
||||||
|
if devServerURL == "" {
|
||||||
|
devServerURLFlag = flag.String("devserverurl", "", "URL of development server")
|
||||||
|
}
|
||||||
|
|
||||||
loglevel := os.Getenv("loglevel")
|
loglevel := os.Getenv("loglevel")
|
||||||
|
if loglevel == "" {
|
||||||
|
loglevelFlag = flag.String("loglevel", "debug", "Loglevel to use - Trace, Debug, Info, Warning, Error")
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we weren't given the assetdir in the environment variables
|
||||||
|
if assetdir == "" {
|
||||||
|
flag.Parse()
|
||||||
|
if assetdirFlag != nil {
|
||||||
|
assetdir = *assetdirFlag
|
||||||
|
}
|
||||||
|
if devServerURLFlag != nil {
|
||||||
|
devServerURL = *devServerURLFlag
|
||||||
|
}
|
||||||
|
if loglevelFlag != nil {
|
||||||
|
loglevel = *loglevelFlag
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if devServerURL != "" {
|
if devServerURL != "" {
|
||||||
ctx = context.WithValue(ctx, "devserverurl", devServerURL)
|
ctx = context.WithValue(ctx, "devserverurl", devServerURL)
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
@interface AppDelegate : NSResponder <NSTouchBarProvider>
|
@interface AppDelegate : NSResponder <NSTouchBarProvider>
|
||||||
|
|
||||||
@property bool alwaysOnTop;
|
@property bool alwaysOnTop;
|
||||||
|
@property bool startHidden;
|
||||||
@property (retain) WailsWindow* mainWindow;
|
@property (retain) WailsWindow* mainWindow;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -16,16 +16,22 @@
|
|||||||
}
|
}
|
||||||
- (void)applicationWillFinishLaunching:(NSNotification *)aNotification {
|
- (void)applicationWillFinishLaunching:(NSNotification *)aNotification {
|
||||||
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
||||||
[self.mainWindow makeKeyAndOrderFront:self];
|
|
||||||
if (self.alwaysOnTop) {
|
if (self.alwaysOnTop) {
|
||||||
[self.mainWindow setLevel:NSStatusWindowLevel];
|
[self.mainWindow setLevel:NSStatusWindowLevel];
|
||||||
}
|
}
|
||||||
|
if ( !self.startHidden ) {
|
||||||
|
[self.mainWindow makeKeyAndOrderFront:self];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
|
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
|
||||||
[NSApp activateIgnoringOtherApps:YES];
|
[NSApp activateIgnoringOtherApps:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)dealloc {
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
@synthesize touchBar;
|
@synthesize touchBar;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -12,7 +12,12 @@
|
|||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#import "WailsContext.h"
|
#import "WailsContext.h"
|
||||||
|
|
||||||
WailsContext* Create(const char* title, int width, int height, int frameless, int resizable, int fullscreen, int fullSizeContent, int hideTitleBar, int titlebarAppearsTransparent, int hideTitle, int useToolbar, int hideToolbarSeparator, int webviewIsTransparent, int alwaysOnTop, int hideWindowOnClose, const char *appearance, int windowIsTranslucent, int debug);
|
#define WindowStartsNormal 0
|
||||||
|
#define WindowStartsMaximised 1
|
||||||
|
#define WindowStartsMinimised 2
|
||||||
|
#define WindowStartsFullscreen 3
|
||||||
|
|
||||||
|
WailsContext* Create(const char* title, int width, int height, int frameless, int resizable, int fullscreen, int fullSizeContent, int hideTitleBar, int titlebarAppearsTransparent, int hideTitle, int useToolbar, int hideToolbarSeparator, int webviewIsTransparent, int alwaysOnTop, int hideWindowOnClose, const char *appearance, int windowIsTranslucent, int debug, int windowStartState, int startsHidden);
|
||||||
void Run(void*);
|
void Run(void*);
|
||||||
|
|
||||||
void SetTitle(void* ctx, const char *title);
|
void SetTitle(void* ctx, const char *title);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#import "WailsMenu.h"
|
#import "WailsMenu.h"
|
||||||
#import "WailsMenuItem.h"
|
#import "WailsMenuItem.h"
|
||||||
|
|
||||||
WailsContext* Create(const char* title, int width, int height, int frameless, int resizable, int fullscreen, int fullSizeContent, int hideTitleBar, int titlebarAppearsTransparent, int hideTitle, int useToolbar, int hideToolbarSeparator, int webviewIsTransparent, int alwaysOnTop, int hideWindowOnClose, const char *appearance, int windowIsTranslucent, int debug) {
|
WailsContext* Create(const char* title, int width, int height, int frameless, int resizable, int fullscreen, int fullSizeContent, int hideTitleBar, int titlebarAppearsTransparent, int hideTitle, int useToolbar, int hideToolbarSeparator, int webviewIsTransparent, int alwaysOnTop, int hideWindowOnClose, const char *appearance, int windowIsTranslucent, int debug, int windowStartState, int startsHidden) {
|
||||||
|
|
||||||
[NSApplication sharedApplication];
|
[NSApplication sharedApplication];
|
||||||
|
|
||||||
@@ -20,10 +20,27 @@ WailsContext* Create(const char* title, int width, int height, int frameless, in
|
|||||||
|
|
||||||
result.debug = debug;
|
result.debug = debug;
|
||||||
|
|
||||||
|
if ( windowStartState == WindowStartsFullscreen ) {
|
||||||
|
fullscreen = 1;
|
||||||
|
}
|
||||||
|
|
||||||
[result CreateWindow:width :height :frameless :resizable :fullscreen :fullSizeContent :hideTitleBar :titlebarAppearsTransparent :hideTitle :useToolbar :hideToolbarSeparator :webviewIsTransparent :hideWindowOnClose :safeInit(appearance) :windowIsTranslucent];
|
[result CreateWindow:width :height :frameless :resizable :fullscreen :fullSizeContent :hideTitleBar :titlebarAppearsTransparent :hideTitle :useToolbar :hideToolbarSeparator :webviewIsTransparent :hideWindowOnClose :safeInit(appearance) :windowIsTranslucent];
|
||||||
[result SetTitle:safeInit(title)];
|
[result SetTitle:safeInit(title)];
|
||||||
[result Center];
|
[result Center];
|
||||||
|
|
||||||
|
switch( windowStartState ) {
|
||||||
|
case WindowStartsMaximised:
|
||||||
|
[result.mainWindow zoom:nil];
|
||||||
|
break;
|
||||||
|
case WindowStartsMinimised:
|
||||||
|
//TODO: Can you start a mac app minimised?
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( startsHidden == 1 ) {
|
||||||
|
result.startHidden = true;
|
||||||
|
}
|
||||||
|
|
||||||
result.alwaysOnTop = alwaysOnTop;
|
result.alwaysOnTop = alwaysOnTop;
|
||||||
result.hideOnClose = hideWindowOnClose;
|
result.hideOnClose = hideWindowOnClose;
|
||||||
|
|
||||||
@@ -306,6 +323,7 @@ void Run(void *inctx) {
|
|||||||
ctx.appdelegate = delegate;
|
ctx.appdelegate = delegate;
|
||||||
delegate.mainWindow = ctx.mainWindow;
|
delegate.mainWindow = ctx.mainWindow;
|
||||||
delegate.alwaysOnTop = ctx.alwaysOnTop;
|
delegate.alwaysOnTop = ctx.alwaysOnTop;
|
||||||
|
delegate.startHidden = ctx.startHidden;
|
||||||
|
|
||||||
[ctx loadRequest:@"wails://wails/"];
|
[ctx loadRequest:@"wails://wails/"];
|
||||||
[app setMainMenu:ctx.applicationMenu];
|
[app setMainMenu:ctx.applicationMenu];
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
@property bool hideOnClose;
|
@property bool hideOnClose;
|
||||||
@property bool shuttingDown;
|
@property bool shuttingDown;
|
||||||
|
@property bool startHidden;
|
||||||
|
|
||||||
@property NSSize maxSize;
|
@property NSSize maxSize;
|
||||||
@property NSSize minSize;
|
@property NSSize minSize;
|
||||||
|
|||||||
@@ -533,10 +533,10 @@
|
|||||||
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:arr options:0 error:nil];
|
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:arr options:0 error:nil];
|
||||||
NSString *nsjson = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
|
NSString *nsjson = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
|
||||||
processOpenFileDialogResponse([nsjson UTF8String]);
|
processOpenFileDialogResponse([nsjson UTF8String]);
|
||||||
|
[nsjson release];
|
||||||
|
[arr release];
|
||||||
}];
|
}];
|
||||||
|
|
||||||
ON_MAIN_THREAD([dialog runModal];)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -579,11 +579,13 @@
|
|||||||
// Setup callback handler
|
// Setup callback handler
|
||||||
[dialog beginSheetModalForWindow:self.mainWindow completionHandler:^(NSModalResponse returnCode) {
|
[dialog beginSheetModalForWindow:self.mainWindow completionHandler:^(NSModalResponse returnCode) {
|
||||||
NSURL *url = [dialog URL];
|
NSURL *url = [dialog URL];
|
||||||
processSaveFileDialogResponse([url.path UTF8String]);
|
if ( url != nil ) {
|
||||||
|
processSaveFileDialogResponse([url.path UTF8String]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
processSaveFileDialogResponse("");
|
||||||
}];
|
}];
|
||||||
|
|
||||||
ON_MAIN_THREAD([dialog runModal];)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) SetAbout :(NSString*)title :(NSString*)description :(void*)imagedata :(int)datalen {
|
- (void) SetAbout :(NSString*)title :(NSString*)description :(void*)imagedata :(int)datalen {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (NSMenuItem*) newMenuItemWithContext :(WailsContext*)ctx :(NSString*)title :(SEL)selector :(NSString*)key :(NSEventModifierFlags)flags {
|
- (NSMenuItem*) newMenuItemWithContext :(WailsContext*)ctx :(NSString*)title :(SEL)selector :(NSString*)key :(NSEventModifierFlags)flags {
|
||||||
NSMenuItem *result = [[NSMenuItem new] autorelease];
|
NSMenuItem *result = [NSMenuItem new];
|
||||||
if ( title != nil ) {
|
if ( title != nil ) {
|
||||||
[result setTitle:title];
|
[result setTitle:title];
|
||||||
}
|
}
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
[super initWithTitle:title];
|
[super initWithTitle:title];
|
||||||
}
|
}
|
||||||
[self setAutoenablesItems:NO];
|
[self setAutoenablesItems:NO];
|
||||||
return self;
|
return [self init];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) appendSubmenu :(WailsMenu*)child {
|
- (void) appendSubmenu :(WailsMenu*)child {
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ func NewWindow(frontendOptions *options.App, debugMode bool) *Window {
|
|||||||
fullscreen := bool2Cint(frontendOptions.Fullscreen)
|
fullscreen := bool2Cint(frontendOptions.Fullscreen)
|
||||||
alwaysOnTop := bool2Cint(frontendOptions.AlwaysOnTop)
|
alwaysOnTop := bool2Cint(frontendOptions.AlwaysOnTop)
|
||||||
hideWindowOnClose := bool2Cint(frontendOptions.HideWindowOnClose)
|
hideWindowOnClose := bool2Cint(frontendOptions.HideWindowOnClose)
|
||||||
|
startsHidden := bool2Cint(frontendOptions.StartHidden)
|
||||||
debug := bool2Cint(debugMode)
|
debug := bool2Cint(debugMode)
|
||||||
|
|
||||||
var fullSizeContent, hideTitleBar, hideTitle, useToolbar, webviewIsTransparent C.int
|
var fullSizeContent, hideTitleBar, hideTitle, useToolbar, webviewIsTransparent C.int
|
||||||
@@ -55,6 +56,7 @@ func NewWindow(frontendOptions *options.App, debugMode bool) *Window {
|
|||||||
|
|
||||||
width := C.int(frontendOptions.Width)
|
width := C.int(frontendOptions.Width)
|
||||||
height := C.int(frontendOptions.Height)
|
height := C.int(frontendOptions.Height)
|
||||||
|
windowStartState := C.int(int(frontendOptions.WindowStartState))
|
||||||
|
|
||||||
title = c.String(frontendOptions.Title)
|
title = c.String(frontendOptions.Title)
|
||||||
|
|
||||||
@@ -75,7 +77,7 @@ func NewWindow(frontendOptions *options.App, debugMode bool) *Window {
|
|||||||
}
|
}
|
||||||
var context *C.WailsContext = C.Create(title, width, height, frameless, resizable, fullscreen, fullSizeContent,
|
var context *C.WailsContext = C.Create(title, width, height, frameless, resizable, fullscreen, fullSizeContent,
|
||||||
hideTitleBar, titlebarAppearsTransparent, hideTitle, useToolbar, hideToolbarSeparator, webviewIsTransparent,
|
hideTitleBar, titlebarAppearsTransparent, hideTitle, useToolbar, hideToolbarSeparator, webviewIsTransparent,
|
||||||
alwaysOnTop, hideWindowOnClose, appearance, windowIsTranslucent, debug)
|
alwaysOnTop, hideWindowOnClose, appearance, windowIsTranslucent, debug, windowStartState, startsHidden)
|
||||||
|
|
||||||
// Create menu
|
// Create menu
|
||||||
result := &Window{
|
result := &Window{
|
||||||
|
|||||||
@@ -130,10 +130,6 @@ func (f *Frontend) Run(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
if f.frontendOptions.Fullscreen {
|
|
||||||
mainWindow.Fullscreen()
|
|
||||||
}
|
|
||||||
|
|
||||||
mainWindow.Run()
|
mainWindow.Run()
|
||||||
mainWindow.Close()
|
mainWindow.Close()
|
||||||
return nil
|
return nil
|
||||||
@@ -412,11 +408,6 @@ func (f *Frontend) navigationCompleted(sender *edge.ICoreWebView2, args *edge.IC
|
|||||||
go f.frontendOptions.OnDomReady(f.ctx)
|
go f.frontendOptions.OnDomReady(f.ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// If you want to start hidden, return
|
|
||||||
if f.frontendOptions.StartHidden {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hack to make it visible: https://github.com/MicrosoftEdge/WebView2Feedback/issues/1077#issuecomment-825375026
|
// Hack to make it visible: https://github.com/MicrosoftEdge/WebView2Feedback/issues/1077#issuecomment-825375026
|
||||||
err := f.chromium.Hide()
|
err := f.chromium.Hide()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -426,6 +417,24 @@ func (f *Frontend) navigationCompleted(sender *edge.ICoreWebView2, args *edge.IC
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
f.mainWindow.Show()
|
|
||||||
|
if f.frontendOptions.StartHidden {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
switch f.frontendOptions.WindowStartState {
|
||||||
|
case options.Maximised:
|
||||||
|
f.mainWindow.Maximise()
|
||||||
|
case options.Minimised:
|
||||||
|
f.mainWindow.Minimise()
|
||||||
|
case options.Fullscreen:
|
||||||
|
f.mainWindow.Fullscreen()
|
||||||
|
f.mainWindow.Show()
|
||||||
|
default:
|
||||||
|
if f.frontendOptions.Fullscreen {
|
||||||
|
f.mainWindow.Fullscreen()
|
||||||
|
}
|
||||||
|
f.mainWindow.Show()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,24 +18,24 @@ type Window struct {
|
|||||||
dispatchq []func()
|
dispatchq []func()
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewWindow(parent winc.Controller, options *options.App) *Window {
|
func NewWindow(parent winc.Controller, appoptions *options.App) *Window {
|
||||||
result := new(Window)
|
result := new(Window)
|
||||||
result.frontendOptions = options
|
result.frontendOptions = appoptions
|
||||||
result.SetIsForm(true)
|
result.SetIsForm(true)
|
||||||
|
|
||||||
var exStyle int
|
var exStyle int
|
||||||
if options.Windows != nil {
|
if appoptions.Windows != nil {
|
||||||
exStyle = w32.WS_EX_CONTROLPARENT | w32.WS_EX_APPWINDOW
|
exStyle = w32.WS_EX_CONTROLPARENT | w32.WS_EX_APPWINDOW
|
||||||
if options.Windows.WindowIsTranslucent {
|
if appoptions.Windows.WindowIsTranslucent {
|
||||||
exStyle |= w32.WS_EX_NOREDIRECTIONBITMAP
|
exStyle |= w32.WS_EX_NOREDIRECTIONBITMAP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if options.AlwaysOnTop {
|
if appoptions.AlwaysOnTop {
|
||||||
exStyle |= w32.WS_EX_TOPMOST
|
exStyle |= w32.WS_EX_TOPMOST
|
||||||
}
|
}
|
||||||
|
|
||||||
var dwStyle = w32.WS_OVERLAPPEDWINDOW
|
var dwStyle = w32.WS_OVERLAPPEDWINDOW
|
||||||
if options.Frameless {
|
if appoptions.Frameless {
|
||||||
dwStyle = w32.WS_POPUP
|
dwStyle = w32.WS_POPUP
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ func NewWindow(parent winc.Controller, options *options.App) *Window {
|
|||||||
result.SetParent(parent)
|
result.SetParent(parent)
|
||||||
|
|
||||||
loadIcon := true
|
loadIcon := true
|
||||||
if options.Windows != nil && options.Windows.DisableWindowIcon == true {
|
if appoptions.Windows != nil && appoptions.Windows.DisableWindowIcon == true {
|
||||||
loadIcon = false
|
loadIcon = false
|
||||||
}
|
}
|
||||||
if loadIcon {
|
if loadIcon {
|
||||||
@@ -53,21 +53,21 @@ func NewWindow(parent winc.Controller, options *options.App) *Window {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result.SetSize(options.Width, options.Height)
|
result.SetSize(appoptions.Width, appoptions.Height)
|
||||||
result.SetText(options.Title)
|
result.SetText(appoptions.Title)
|
||||||
if options.Frameless == false && !options.Fullscreen {
|
if appoptions.Frameless == false && !appoptions.Fullscreen {
|
||||||
result.EnableMaxButton(!options.DisableResize)
|
result.EnableMaxButton(!appoptions.DisableResize)
|
||||||
result.EnableSizable(!options.DisableResize)
|
result.EnableSizable(!appoptions.DisableResize)
|
||||||
result.SetMinSize(options.MinWidth, options.MinHeight)
|
result.SetMinSize(appoptions.MinWidth, appoptions.MinHeight)
|
||||||
result.SetMaxSize(options.MaxWidth, options.MaxHeight)
|
result.SetMaxSize(appoptions.MaxWidth, appoptions.MaxHeight)
|
||||||
}
|
}
|
||||||
|
|
||||||
if options.Windows != nil {
|
if appoptions.Windows != nil {
|
||||||
if options.Windows.WindowIsTranslucent {
|
if appoptions.Windows.WindowIsTranslucent {
|
||||||
result.SetTranslucentBackground()
|
result.SetTranslucentBackground()
|
||||||
}
|
}
|
||||||
|
|
||||||
if options.Windows.DisableWindowIcon {
|
if appoptions.Windows.DisableWindowIcon {
|
||||||
result.DisableIcon()
|
result.DisableIcon()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -78,8 +78,8 @@ func NewWindow(parent winc.Controller, options *options.App) *Window {
|
|||||||
|
|
||||||
result.SetFont(winc.DefaultFont)
|
result.SetFont(winc.DefaultFont)
|
||||||
|
|
||||||
if options.Menu != nil {
|
if appoptions.Menu != nil {
|
||||||
result.SetApplicationMenu(options.Menu)
|
result.SetApplicationMenu(appoptions.Menu)
|
||||||
}
|
}
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
package gomod
|
package gomod
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Masterminds/semver"
|
|
||||||
"github.com/matryer/is"
|
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/Masterminds/semver"
|
||||||
|
"github.com/matryer/is"
|
||||||
)
|
)
|
||||||
|
|
||||||
const basic string = `module changeme
|
const basic string = `module changeme
|
||||||
@@ -75,7 +76,7 @@ const basicUpdated string = `module changeme
|
|||||||
|
|
||||||
go 1.17
|
go 1.17
|
||||||
|
|
||||||
require github.com/wailsapp/wails/v2 v2.0.0-beta.15
|
require github.com/wailsapp/wails/v2 v2.0.0-beta.20
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/andybalholm/brotli v1.0.2 // indirect
|
github.com/andybalholm/brotli v1.0.2 // indirect
|
||||||
@@ -330,7 +331,7 @@ const multilineRequireUpdated = `module changeme
|
|||||||
go 1.17
|
go 1.17
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/wailsapp/wails/v2 v2.0.0-beta.15
|
github.com/wailsapp/wails/v2 v2.0.0-beta.20
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
@@ -381,12 +382,12 @@ func TestUpdateGoModVersion(t *testing.T) {
|
|||||||
want []byte
|
want []byte
|
||||||
wantErr bool
|
wantErr bool
|
||||||
}{
|
}{
|
||||||
{"basic", args{[]byte(basic), "v2.0.0-beta.15"}, []byte(basicUpdated), false},
|
{"basic", args{[]byte(basic), "v2.0.0-beta.20"}, []byte(basicUpdated), false},
|
||||||
{"basicmultiline", args{[]byte(multilineRequire), "v2.0.0-beta.15"}, []byte(multilineRequireUpdated), false},
|
{"basicmultiline", args{[]byte(multilineRequire), "v2.0.0-beta.20"}, []byte(multilineRequireUpdated), false},
|
||||||
{"basicmultilinereplace", args{[]byte(multilineReplace), "v2.0.0-beta.15"}, []byte(multilineReplaceUpdated), false},
|
{"basicmultilinereplace", args{[]byte(multilineReplace), "v2.0.0-beta.20"}, []byte(multilineReplaceUpdated), false},
|
||||||
{"basicmultilinereplaceblock", args{[]byte(multilineReplaceBlock), "v2.0.0-beta.15"}, []byte(multilineReplaceBlockUpdated), false},
|
{"basicmultilinereplaceblock", args{[]byte(multilineReplaceBlock), "v2.0.0-beta.20"}, []byte(multilineReplaceBlockUpdated), false},
|
||||||
{"basicmultilinereplacenoversion", args{[]byte(multilineReplaceNoVersion), "v2.0.0-beta.15"}, []byte(multilineReplaceNoVersionUpdated), false},
|
{"basicmultilinereplacenoversion", args{[]byte(multilineReplaceNoVersion), "v2.0.0-beta.20"}, []byte(multilineReplaceNoVersionUpdated), false},
|
||||||
{"basicmultilinereplacenoversionblock", args{[]byte(multilineReplaceNoVersionBlock), "v2.0.0-beta.15"}, []byte(multilineReplaceNoVersionBlockUpdated), false},
|
{"basicmultilinereplacenoversionblock", args{[]byte(multilineReplaceNoVersionBlock), "v2.0.0-beta.20"}, []byte(multilineReplaceNoVersionBlockUpdated), false},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
@@ -413,8 +414,8 @@ func TestGoModOutOfSync(t *testing.T) {
|
|||||||
want bool
|
want bool
|
||||||
wantErr bool
|
wantErr bool
|
||||||
}{
|
}{
|
||||||
{"basic", args{[]byte(basic), "v2.0.0-beta.15"}, true, false},
|
{"basic", args{[]byte(basic), "v2.0.0-beta.20"}, true, false},
|
||||||
{"basicmultiline", args{[]byte(multilineRequire), "v2.0.0-beta.15"}, true, false},
|
{"basicmultiline", args{[]byte(multilineRequire), "v2.0.0-beta.20"}, true, false},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
@@ -433,7 +434,7 @@ const multilineReplaceUpdated = `module changeme
|
|||||||
go 1.17
|
go 1.17
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/wailsapp/wails/v2 v2.0.0-beta.15
|
github.com/wailsapp/wails/v2 v2.0.0-beta.20
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
@@ -468,14 +469,14 @@ require (
|
|||||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 // indirect
|
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
replace github.com/wailsapp/wails/v2 v2.0.0-beta.15 => C:\Users\leaan\Documents\wails-v2-beta\wails\v2
|
replace github.com/wailsapp/wails/v2 v2.0.0-beta.20 => C:\Users\leaan\Documents\wails-v2-beta\wails\v2
|
||||||
`
|
`
|
||||||
const multilineReplaceNoVersionUpdated = `module changeme
|
const multilineReplaceNoVersionUpdated = `module changeme
|
||||||
|
|
||||||
go 1.17
|
go 1.17
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/wailsapp/wails/v2 v2.0.0-beta.15
|
github.com/wailsapp/wails/v2 v2.0.0-beta.20
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
@@ -517,7 +518,7 @@ const multilineReplaceNoVersionBlockUpdated = `module changeme
|
|||||||
go 1.17
|
go 1.17
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/wailsapp/wails/v2 v2.0.0-beta.15
|
github.com/wailsapp/wails/v2 v2.0.0-beta.20
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
@@ -562,7 +563,7 @@ const multilineReplaceBlockUpdated = `module changeme
|
|||||||
go 1.17
|
go 1.17
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/wailsapp/wails/v2 v2.0.0-beta.15
|
github.com/wailsapp/wails/v2 v2.0.0-beta.20
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
@@ -598,6 +599,6 @@ require (
|
|||||||
)
|
)
|
||||||
|
|
||||||
replace (
|
replace (
|
||||||
github.com/wailsapp/wails/v2 v2.0.0-beta.15 => C:\Users\leaan\Documents\wails-v2-beta\wails\v2
|
github.com/wailsapp/wails/v2 v2.0.0-beta.20 => C:\Users\leaan\Documents\wails-v2-beta\wails\v2
|
||||||
)
|
)
|
||||||
`
|
`
|
||||||
|
|||||||
@@ -532,6 +532,9 @@ func (b *BaseBuilder) BuildFrontend(outputLogger *clilogger.CLILogger) error {
|
|||||||
switch b.projectData.OutputType {
|
switch b.projectData.OutputType {
|
||||||
case "dev":
|
case "dev":
|
||||||
buildCommand = b.projectData.DevCommand
|
buildCommand = b.projectData.DevCommand
|
||||||
|
if buildCommand == "" {
|
||||||
|
buildCommand = b.projectData.BuildCommand
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
buildCommand = b.projectData.BuildCommand
|
buildCommand = b.projectData.BuildCommand
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,15 @@ import (
|
|||||||
"github.com/wailsapp/wails/v2/pkg/logger"
|
"github.com/wailsapp/wails/v2/pkg/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type WindowStartState int
|
||||||
|
|
||||||
|
const (
|
||||||
|
Normal WindowStartState = 0
|
||||||
|
Maximised WindowStartState = 1
|
||||||
|
Minimised WindowStartState = 2
|
||||||
|
Fullscreen WindowStartState = 3
|
||||||
|
)
|
||||||
|
|
||||||
// App contains options for creating the App
|
// App contains options for creating the App
|
||||||
type App struct {
|
type App struct {
|
||||||
Title string
|
Title string
|
||||||
@@ -39,6 +48,7 @@ type App struct {
|
|||||||
OnDomReady func(ctx context.Context) `json:"-"`
|
OnDomReady func(ctx context.Context) `json:"-"`
|
||||||
OnShutdown func(ctx context.Context) `json:"-"`
|
OnShutdown func(ctx context.Context) `json:"-"`
|
||||||
Bind []interface{}
|
Bind []interface{}
|
||||||
|
WindowStartState WindowStartState
|
||||||
|
|
||||||
//ContextMenus []*menu.ContextMenu
|
//ContextMenus []*menu.ContextMenu
|
||||||
//TrayMenus []*menu.TrayMenu
|
//TrayMenus []*menu.TrayMenu
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ You mean this isn't ready for production? For your use case, it may well be read
|
|||||||
known issues so keep your eye on [this project board](https://github.com/wailsapp/wails/projects/7) and if you would
|
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!
|
like to contribute, you'd be very welcome!
|
||||||
|
|
||||||
So what's new for Wails v2 for Mac vs v1? Hint: They're pretty similar to the Windows Beta :wink:
|
So what's new for Wails v2 for Mac vs v1? Hint: It's pretty similar to the Windows Beta :wink:
|
||||||
|
|
||||||
### New Features
|
### New Features
|
||||||
|
|
||||||
@@ -23,6 +23,9 @@ sidebar_position: 99
|
|||||||
<a href="https://github.com/codydbentley" style="width:100px">
|
<a href="https://github.com/codydbentley" style="width:100px">
|
||||||
<img src="https://github.com/codydbentley.png?size=100" width="100"/>
|
<img src="https://github.com/codydbentley.png?size=100" width="100"/>
|
||||||
</a>
|
</a>
|
||||||
|
<a href="https://github.com/CrackDavid" style="width:100px">
|
||||||
|
<img src="https://github.com/CrackDavid.png?size=100" width="100"/>
|
||||||
|
</a>
|
||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
<a href="https://github.com/matryer" style="width:100px">
|
<a href="https://github.com/matryer" style="width:100px">
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ import TabItem from "@theme/TabItem";
|
|||||||
|
|
||||||
## Installing Wails
|
## Installing Wails
|
||||||
|
|
||||||
Run `go install github.com/wailsapp/wails/v2/cmd/wails@v2.0.0-beta.15` to install the Wails CLI.
|
Run `go install github.com/wailsapp/wails/v2/cmd/wails@v2.0.0-beta.20` to install the Wails CLI.
|
||||||
|
|
||||||
## System Check
|
## System Check
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ import TabItem from "@theme/TabItem";
|
|||||||
|
|
||||||
## 安装 Wails
|
## 安装 Wails
|
||||||
|
|
||||||
运行 `go install github.com/wailsapp/wails/v2/cmd/wails@v2.0.0-beta.15` 安装 Wails CLI。
|
运行 `go install github.com/wailsapp/wails/v2/cmd/wails@v2.0.0-beta.20` 安装 Wails CLI。
|
||||||
|
|
||||||
## 系统检查
|
## 系统检查
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user