Changed Default GUI Mode to Electron

This commit is contained in:
2026-05-04 00:54:39 +02:00
parent cd3d9043fe
commit a593cf6ad0
5 changed files with 104 additions and 19 deletions

View File

@@ -17,6 +17,7 @@ import (
"lazy-update-manager/internal/notify"
"lazy-update-manager/internal/state"
"lazy-update-manager/internal/updater"
"lazy-update-manager/internal/version"
)
func main() {
@@ -39,6 +40,9 @@ func run(args []string) int {
return runGUI(args[1:])
case "update":
return update()
case "version":
fmt.Println(version.String())
return 0
case "help", "-h", "--help":
usage()
return 0
@@ -174,6 +178,14 @@ func runGUI(args []string) int {
fs := flag.NewFlagSet("gui", flag.ContinueOnError)
fs.SetOutput(os.Stderr)
noOpen := fs.Bool("no-open", false, "start the GUI server without opening a browser")
// Support positional "web" argument: `lazy-update-manager gui web`
forceWeb := false
if len(args) > 0 && args[0] == "web" {
forceWeb = true
args = args[1:]
}
if err := fs.Parse(args); err != nil {
return 2
}
@@ -184,8 +196,19 @@ func runGUI(args []string) int {
return 1
}
// Check if Electron is preferred and available
if cfg.PreferElectron && runtime.GOOS == "linux" {
// If the user explicitly requested the web interface, skip Electron
if forceWeb {
if err := gui.Run(defaultConfigPath(), defaultStatePath(), !*noOpen); err != nil {
fmt.Fprintln(os.Stderr, err)
return 1
}
return 0
}
// Only try launching the Electron desktop when the caller did not request
// "-no-open" (used by the Electron wrapper to start the backend).
// This avoids the Electron<->backend launch loop.
if !*noOpen && cfg.PreferElectron && runtime.GOOS == "linux" {
if err := tryElectronApp(); err == nil {
return 0
}
@@ -289,14 +312,16 @@ Usage:
lazy-update-manager status
lazy-update-manager check [-quiet]
lazy-update-manager notify [-force]
lazy-update-manager gui [-no-open]
lazy-update-manager gui [web] [-no-open]
lazy-update-manager update
lazy-update-manager version
Commands:
status Show available pacman and AUR updates
check Check updates, useful for scripts and status bars
notify Send a weekly desktop notification when updates exist
gui Start the graphical web interface
gui Start the graphical web interface (use 'web' to force opening in the browser)
update Run paru/yay -Syu when available, otherwise sudo pacman -Syu
version Print the installed version and build time
`))
}