diff --git a/v2/cmd/wails/internal/commands/build/build.go b/v2/cmd/wails/internal/commands/build/build.go index 344167f9..2a698812 100644 --- a/v2/cmd/wails/internal/commands/build/build.go +++ b/v2/cmd/wails/internal/commands/build/build.go @@ -117,20 +117,12 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) { } // Tags - experimental := false userTags := []string{} for _, tag := range strings.Split(tags, " ") { thisTag := strings.TrimSpace(tag) if thisTag != "" { userTags = append(userTags, thisTag) } - if thisTag == "exp" { - experimental = true - } - } - - if runtime.GOOS == "linux" && !experimental { - return fmt.Errorf("Linux version coming soon!") } // Webview2 installer strategy (download by default) diff --git a/v2/cmd/wails/internal/commands/dev/dev.go b/v2/cmd/wails/internal/commands/dev/dev.go index a8b548ba..90417791 100644 --- a/v2/cmd/wails/internal/commands/dev/dev.go +++ b/v2/cmd/wails/internal/commands/dev/dev.go @@ -103,20 +103,12 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error { logger := clilogger.New(w) app.PrintBanner() - experimental := false userTags := []string{} for _, tag := range strings.Split(flags.tags, " ") { thisTag := strings.TrimSpace(tag) if thisTag != "" { userTags = append(userTags, thisTag) } - if thisTag == "exp" { - experimental = true - } - } - - if runtime.GOOS == "linux" && !experimental { - return fmt.Errorf("Linux version coming soon!") } cwd, err := os.Getwd() diff --git a/v2/internal/frontend/desktop/linux/window.go b/v2/internal/frontend/desktop/linux/window.go index efa3ec8f..58fa1dde 100644 --- a/v2/internal/frontend/desktop/linux/window.go +++ b/v2/internal/frontend/desktop/linux/window.go @@ -698,7 +698,9 @@ func (w *Window) SetRGBA(r uint8, g uint8, b uint8, a uint8) { } func (w *Window) Run() { - C.gtk_box_pack_start(C.GTKBOX(unsafe.Pointer(w.vbox)), w.menubar, 0, 0, 0) + if w.menubar != nil { + C.gtk_box_pack_start(C.GTKBOX(unsafe.Pointer(w.vbox)), w.menubar, 0, 0, 0) + } C.gtk_box_pack_start(C.GTKBOX(unsafe.Pointer(w.vbox)), C.GTKWIDGET(w.webview), 1, 1, 0) C.loadIndex(w.webview) C.gtk_widget_show_all(w.asGTKWidget()) diff --git a/website/blog/2022-02-22-v2-beta3-release-notes.mdx b/website/blog/2022-02-22-v2-beta3-release-notes.mdx new file mode 100644 index 00000000..16d25814 --- /dev/null +++ b/website/blog/2022-02-22-v2-beta3-release-notes.mdx @@ -0,0 +1,120 @@ +--- +slug: wails-v2-beta-for-linux +title: Wails v2 Beta for Linux +authors: [leaanthony] +tags: [wails, v2] +--- + + +
+ +
+
+ +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 + +
+ +
+
+ +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 +`` 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 + +
+ +
+
+ +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. + +
+ +
+
+ + +### 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](/docs/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! diff --git a/website/docs/gettingstarted/installation.mdx b/website/docs/gettingstarted/installation.mdx index 054f7963..6dec4102 100644 --- a/website/docs/gettingstarted/installation.mdx +++ b/website/docs/gettingstarted/installation.mdx @@ -58,7 +58,11 @@ import TabItem from "@theme/TabItem"; runtime is installed. Some Windows installations will already have this installed. You can check using the{" "} wails doctor command (see below). - Coming Soon... + Linux required the standard gcc build tools plus libgtk3 and libwebkit. + 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 wails doctor after installation + to be shown how to install the dependencies. If your distro/package manager is not supported, please consult the + Add Linux Distro guide. ## Optional Dependencies diff --git a/website/docs/guides/linux-distro-support.mdx b/website/docs/guides/linux-distro-support.mdx new file mode 100644 index 00000000..36649fc1 --- /dev/null +++ b/website/docs/guides/linux-distro-support.mdx @@ -0,0 +1,107 @@ + +# Linux Distro Support + +## Overview + +Wails offers Linux support but providing installation instructions for all available distributions is an impossible task. +Instead, Wails tries to determine if the packages you need to develop applications are available via your system's package +manager. Currently, we support the following package managers: + +- apt +- dnf +- emerge +- eopkg +- pacman +- zypper + +## Adding package names + +There may be circumstances where your distro uses one of the supported package managers but the package name +is different. For example, you may use an Ubuntu derivative, but the package name for gtk may be different. Wails +attempts to find the correct package by iterating through a list of package names. +The list of packages are stored in the packagemanager specific file in the `v2/internal/system/packagemanager` +directory. In our example, this would be `v2/internal/system/packagemanager/apt.go`. + +In this file, the list of packages are defined by the `Packages()` method: + +```go +func (a *Apt) Packages() packagemap { + return packagemap{ + "libgtk-3": []*Package{ + {Name: "libgtk-3-dev", SystemPackage: true, Library: true}, + }, + "libwebkit": []*Package{ + {Name: "libwebkit2gtk-4.0-dev", SystemPackage: true, Library: true}, + }, + "gcc": []*Package{ + {Name: "build-essential", SystemPackage: true}, + }, + "pkg-config": []*Package{ + {Name: "pkg-config", SystemPackage: true}, + }, + "npm": []*Package{ + {Name: "npm", SystemPackage: true}, + }, + "docker": []*Package{ + {Name: "docker.io", SystemPackage: true, Optional: true}, + }, + } +} +``` + +Let's assume that in our linux distro, `libgtk-3` is packaged under the name `lib-gtk3-dev`. +We could add support for this by adding the following line: + +```go {5} +func (a *Apt) Packages() packagemap { + return packagemap{ + "libgtk-3": []*Package{ + {Name: "libgtk-3-dev", SystemPackage: true, Library: true}, + {Name: "lib-gtk3-dev", SystemPackage: true, Library: true}, + }, + "libwebkit": []*Package{ + {Name: "libwebkit2gtk-4.0-dev", SystemPackage: true, Library: true}, + }, + "gcc": []*Package{ + {Name: "build-essential", SystemPackage: true}, + }, + "pkg-config": []*Package{ + {Name: "pkg-config", SystemPackage: true}, + }, + "npm": []*Package{ + {Name: "npm", SystemPackage: true}, + }, + "docker": []*Package{ + {Name: "docker.io", SystemPackage: true, Optional: true}, + }, + } +} +``` + +## Adding new package managers + +To add a new package manager, perform the following steps: + +- Create a new file in `v2/internal/system/packagemanager` called `.go`, where `` is the name of the package manager. +- Define a struct that conforms to the package manager interface defined in `pm.go`: + +```go +type PackageManager interface { + Name() string + Packages() packagemap + PackageInstalled(*Package) (bool, error) + PackageAvailable(*Package) (bool, error) + InstallCommand(*Package) string +} +``` +- `Name()` should return the name of the package manager +- `Packages()` should return a `packagemap`, that provides candidate filenames for dependencies +- `PackageInstalled()` should return `true` if the given package is installed +- `PackageAvailable()` should return `true` if the given package is not installed but available for installation +- `InstallCommand()` should return the exact command to install the given package name + +Take a look at the other package managers code to get an idea how this works. + +:::info Remember +If you add support for a new package manager, don't forget to also update this page! +::: \ No newline at end of file diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index fb98c762..5ba946f3 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -63,7 +63,7 @@ const darkCodeTheme = require('prism-react-renderer/themes/palenight'); ({ announcementBar: { id: 'beta-message', - content: 'Wails v2 is currently Beta for Windows & Mac. Linux in progress.', + content: 'Wails v2 is currently in Beta', backgroundColor: '#b00', textColor: '#FFF', isCloseable: false, diff --git a/website/static/img/linux-build-cross-windows.png b/website/static/img/linux-build-cross-windows.png new file mode 100644 index 00000000..0d7864eb Binary files /dev/null and b/website/static/img/linux-build-cross-windows.png differ diff --git a/website/static/img/remote-linux.png b/website/static/img/remote-linux.png new file mode 100644 index 00000000..b1f9fbe9 Binary files /dev/null and b/website/static/img/remote-linux.png differ diff --git a/website/static/img/wails-linux.png b/website/static/img/wails-linux.png new file mode 100644 index 00000000..38e2b28e Binary files /dev/null and b/website/static/img/wails-linux.png differ diff --git a/website/static/img/wails-menus-linux.png b/website/static/img/wails-menus-linux.png new file mode 100644 index 00000000..c5fb7ba5 Binary files /dev/null and b/website/static/img/wails-menus-linux.png differ