Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions docs/docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ You can download pre-compiled binaries from the [Releases page](https://github.c

## 🪟 Windows

### Winget is the recommended way to install Matcha on Windows.

```powershell
winget install --id=floatpane.matcha
```

### Manual Binary Download

You can download pre-compiled binaries from the [Releases page](https://github.com/floatpane/matcha/releases).
Expand All @@ -117,8 +123,6 @@ You can download pre-compiled binaries from the [Releases page](https://github.c
Type or paste the full path to the folder where your executable is located (e.g., C:\CLI Tools\MyTool\).
Click "OK" on all open windows to save the changes.

> Matcha will be added to WinGet as soons as possible!

### WSL

You can run Matcha on Windows using [WSL (Windows Subsystem for Linux)](https://learn.microsoft.com/en-us/windows/wsl/install).
Expand Down
36 changes: 36 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1743,6 +1743,25 @@ func detectInstalledVersion() string {
}
}

// Try WinGet (Windows)
if runtime.GOOS == "windows" {
if _, err := exec.LookPath("winget"); err == nil {
if out, err := exec.Command("winget", "list", "--id", "floatpane.matcha", "--disable-interactivity").Output(); err == nil {
lines := strings.Split(strings.TrimSpace(string(out)), "\n")
for _, line := range lines {
if strings.Contains(strings.ToLower(line), "floatpane.matcha") {
fields := strings.Fields(line)
for _, f := range fields {
if len(f) > 0 && f[0] >= '0' && f[0] <= '9' && strings.Contains(f, ".") {
return f
}
}
}
}
}
}
}

// Try snap (Linux)
if runtime.GOOS == "linux" {
if _, err := exec.LookPath("snap"); err == nil {
Expand Down Expand Up @@ -1897,6 +1916,23 @@ func runUpdateCLI() error {
}
}

// Detect WinGet
if _, err := exec.LookPath("winget"); err == nil {
cmdCheck := exec.Command("winget", "list", "--id", "floatpane.matcha", "--disable-interactivity")
if err := cmdCheck.Run(); err == nil {
fmt.Println("Detected WinGet package — attempting to upgrade.")
cmd := exec.Command("winget", "upgrade", "--id", "floatpane.matcha", "--disable-interactivity")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err == nil {
fmt.Println("Successfully upgraded via WinGet.")
return nil
}
fmt.Printf("WinGet upgrade failed: %v\n", err)
// fallthrough
}
}

// Otherwise attempt to download the proper release asset and replace the binary.
osName := runtime.GOOS
arch := runtime.GOARCH
Expand Down
Loading