Skip to content
Merged
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
32 changes: 32 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1562,6 +1562,21 @@ func detectInstalledVersion() string {
}
}
}

if _, err := exec.LookPath("flatpak"); err == nil {
if out, err := exec.Command("flatpak", "info", "com.floatpane.matcha").Output(); err == nil {
lines := strings.Split(strings.TrimSpace(string(out)), "\n")
for _, line := range lines {
line = strings.TrimSpace(line)
if strings.HasPrefix(line, "Version:") {
fields := strings.Fields(line)
if len(fields) >= 2 {
return fields[1]
}
}
}
}
}
}

return v
Expand Down Expand Up @@ -1670,6 +1685,23 @@ func runUpdateCLI() error {
// fallthrough
}
}
// Detect flatpak
if _, err := exec.LookPath("flatpak"); err == nil {
// Check if matcha is installed as a flatpak
cmdCheck := exec.Command("flatpak", "info", "com.floatpane.matcha")
if err := cmdCheck.Run(); err == nil {
fmt.Println("Detected Flatpak package — attempting to update.")
cmd := exec.Command("flatpak", "update", "-y", "com.floatpane.matcha")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err == nil {
fmt.Println("Successfully updated flatpak.")
return nil
}
fmt.Printf("Flatpak update failed: %v\n", err)
// fallthrough
}
}

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