From 5f457dba8e18be67f9139a038164b97144e5f09b Mon Sep 17 00:00:00 2001 From: ALMAS <9382335+almas1992@users.noreply.github.com> Date: Fri, 15 Dec 2023 17:14:15 +0800 Subject: [PATCH 1/2] [v2/Mac] Add `Apple Silicon` hardware detection to `wails doctor` (#3129) * [v2/Mac] Add Apple Silicon hardware detection to `wails doctor` * add change log --- v2/cmd/wails/doctor.go | 47 ++++++++++++++++++++++++++++++--- website/src/pages/changelog.mdx | 4 +++ 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/v2/cmd/wails/doctor.go b/v2/cmd/wails/doctor.go index 35e3a13ffc4..5306cab1742 100644 --- a/v2/cmd/wails/doctor.go +++ b/v2/cmd/wails/doctor.go @@ -2,6 +2,7 @@ package main import ( "fmt" + "github.com/wailsapp/wails/v2/internal/shell" "runtime" "runtime/debug" "strconv" @@ -93,7 +94,14 @@ func diagnoseEnvironment(f *flags.Doctor) error { systemTabledata = append(systemTabledata, []string{prefix, cpu.Model}) } } else { - systemTabledata = append(systemTabledata, []string{"CPU", "Unknown"}) + cpuInfo := "Unknown" + if runtime.GOOS == "darwin" { + // Try to get CPU info from sysctl + if stdout, _, err := shell.RunCommand("", "sysctl", "-n", "machdep.cpu.brand_string"); err == nil { + cpuInfo = strings.TrimSpace(stdout) + } + } + systemTabledata = append(systemTabledata, []string{"CPU", cpuInfo}) } // Probe GPU @@ -112,14 +120,47 @@ func diagnoseEnvironment(f *flags.Doctor) error { systemTabledata = append(systemTabledata, []string{prefix, details}) } } else { - systemTabledata = append(systemTabledata, []string{"GPU", "Unknown"}) + gpuInfo := "Unknown" + if runtime.GOOS == "darwin" { + // Try to get GPU info from system_profiler + if stdout, _, err := shell.RunCommand("", "system_profiler", "SPDisplaysDataType"); err == nil { + var ( + startCapturing bool + gpuInfoDetails []string + ) + for _, line := range strings.Split(stdout, "\n") { + if strings.Contains(line, "Chipset Model") { + startCapturing = true + } + if startCapturing { + gpuInfoDetails = append(gpuInfoDetails, strings.TrimSpace(line)) + } + if strings.Contains(line, "Metal Support") { + break + } + } + if len(gpuInfoDetails) > 0 { + gpuInfo = strings.Join(gpuInfoDetails, " ") + } + } + } + systemTabledata = append(systemTabledata, []string{"GPU", gpuInfo}) } memory, _ := ghw.Memory() if memory != nil { systemTabledata = append(systemTabledata, []string{"Memory", strconv.Itoa(int(memory.TotalPhysicalBytes/1024/1024/1024)) + "GB"}) } else { - systemTabledata = append(systemTabledata, []string{"Memory", "Unknown"}) + memInfo := "Unknown" + if runtime.GOOS == "darwin" { + // Try to get Memory info from sysctl + if stdout, _, err := shell.RunCommand("", "sysctl", "-n", "hw.memsize"); err == nil { + if memSize, err := strconv.Atoi(strings.TrimSpace(stdout)); err == nil { + memInfo = strconv.Itoa(memSize/1024/1024/1024) + "GB" + } + } + } + systemTabledata = append(systemTabledata, []string{"Memory", memInfo}) } err = pterm.DefaultTable.WithBoxed().WithData(systemTabledata).Render() diff --git a/website/src/pages/changelog.mdx b/website/src/pages/changelog.mdx index 25fd96c9661..452b8c65ed8 100644 --- a/website/src/pages/changelog.mdx +++ b/website/src/pages/changelog.mdx @@ -14,6 +14,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- Add Apple Silicon hardware detection to `wails doctor`. Changed by @almas1992 in [PR](https://github.com/wailsapp/wails/pull/3129) + ## v2.7.1 - 2023-12-10 ### Fixed From 8efaaffadb58d8e5cc7f405bcc42e165b615209f Mon Sep 17 00:00:00 2001 From: Yong Hui Date: Fri, 15 Dec 2023 17:21:50 +0800 Subject: [PATCH 2/2] feat: add windows options supports `DisablePinchZoom` configuration(#2021) (#3115) * feat: add windows options supports `IsPinchZoomEnabled` configuration(#2021) * refactor: modify `IsPinchZoomEnabled` to `DisablePinchZoom` ensure default behavior is consistent * docs: add `DisablePinchZoom` to changelog * docs: update the description of `DisablePinchZoom` attributes in the document --------- Co-authored-by: Lea Anthony --- v2/internal/frontend/desktop/windows/frontend.go | 4 ++++ v2/pkg/options/windows/windows.go | 2 ++ website/docs/reference/options.mdx | 8 ++++++++ website/src/pages/changelog.mdx | 4 +++- 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/v2/internal/frontend/desktop/windows/frontend.go b/v2/internal/frontend/desktop/windows/frontend.go index 7671ad7420b..97eef741feb 100644 --- a/v2/internal/frontend/desktop/windows/frontend.go +++ b/v2/internal/frontend/desktop/windows/frontend.go @@ -543,6 +543,10 @@ func (f *Frontend) setupChromium() { if err != nil { log.Fatal(err) } + err = settings.PutIsPinchZoomEnabled(!opts.DisablePinchZoom) + if err != nil { + log.Fatal(err) + } } err = settings.PutIsStatusBarEnabled(false) diff --git a/v2/pkg/options/windows/windows.go b/v2/pkg/options/windows/windows.go index 073450c9f68..39b91ee8def 100644 --- a/v2/pkg/options/windows/windows.go +++ b/v2/pkg/options/windows/windows.go @@ -68,6 +68,8 @@ type Options struct { IsZoomControlEnabled bool ZoomFactor float64 + DisablePinchZoom bool + // Disable all window decorations in Frameless mode, which means no "Aero Shadow" and no "Rounded Corner" will be shown. // "Rounded Corners" are only available on Windows 11. DisableFramelessWindowDecorations bool diff --git a/website/docs/reference/options.mdx b/website/docs/reference/options.mdx index caa2d0f806c..d9a1ca4fc4a 100644 --- a/website/docs/reference/options.mdx +++ b/website/docs/reference/options.mdx @@ -70,6 +70,7 @@ func main() { WebviewIsTransparent: false, WindowIsTranslucent: false, BackdropType: windows.Mica, + DisablePinchZoom: false, DisableWindowIcon: false, DisableFramelessWindowDecorations: false, WebviewUserDataPath: "", @@ -577,6 +578,13 @@ The value can be one of the following: | Mica | Use [Mica](https://learn.microsoft.com/en-us/windows/apps/design/style/mica) effect | | Tabbed | Use Tabbed. This is a backdrop that is similar to Mica. | +#### DisablePinchZoom + +Setting this to `true` will disable pinch zoom gestures. + +Name: DisablePinchZoom
+Type: `bool` + #### DisableWindowIcon Setting this to `true` will remove the icon in the top left corner of the title bar. diff --git a/website/src/pages/changelog.mdx b/website/src/pages/changelog.mdx index 452b8c65ed8..44255428a55 100644 --- a/website/src/pages/changelog.mdx +++ b/website/src/pages/changelog.mdx @@ -14,10 +14,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -### Changed +### Added +- Added windows options supports `DisablePinchZoom` configuration. Added by @tuuzed in [PR](https://github.com/wailsapp/wails/pull/3115) - Add Apple Silicon hardware detection to `wails doctor`. Changed by @almas1992 in [PR](https://github.com/wailsapp/wails/pull/3129) + ## v2.7.1 - 2023-12-10 ### Fixed