Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
leaanthony authored Dec 15, 2023
2 parents 9d3e3fb + 8efaaff commit 35b7638
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 3 deletions.
47 changes: 44 additions & 3 deletions v2/cmd/wails/doctor.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"github.com/wailsapp/wails/v2/internal/shell"
"runtime"
"runtime/debug"
"strconv"
Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand Down
4 changes: 4 additions & 0 deletions v2/internal/frontend/desktop/windows/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions v2/pkg/options/windows/windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions website/docs/reference/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func main() {
WebviewIsTransparent: false,
WindowIsTranslucent: false,
BackdropType: windows.Mica,
DisablePinchZoom: false,
DisableWindowIcon: false,
DisableFramelessWindowDecorations: false,
WebviewUserDataPath: "",
Expand Down Expand Up @@ -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<br/>
Type: `bool`

#### DisableWindowIcon

Setting this to `true` will remove the icon in the top left corner of the title bar.
Expand Down
6 changes: 6 additions & 0 deletions website/src/pages/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### 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
Expand Down

0 comments on commit 35b7638

Please sign in to comment.