T1.6: Create src/platform/autostart; move autostart logic
Move autostart_*.go and tests from src/core to src/platform/autostart. Update src/gui/app.go to call autostart.SetAutostart / autostart.AutostartStatus. Add quoteDesktopExec to desktop_linux.go (was co-located in autostart_linux.go). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -249,7 +249,7 @@ Track progress here. Mark tasks complete as they land and pass review.
|
||||
- [x] T1.3 — Create `src/runner`; move runner logic
|
||||
- [x] T1.4 — Create `src/scheduler`; move scheduler
|
||||
- [x] T1.5 — Create `src/storage`; move store/paths
|
||||
- [ ] T1.6 — Create `src/platform/autostart`; move autostart logic
|
||||
- [x] T1.6 — Create `src/platform/autostart`; move autostart logic
|
||||
- [ ] T1.7 — Create `src/platform/desktop`; move desktop integration
|
||||
- [ ] T1.8 — Delete empty `src/core`; build + test both platforms
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func InstallDesktopIntegration(appID string, executablePath string, icon []byte) (string, error) {
|
||||
@@ -40,6 +41,10 @@ StartupWMClass=%s
|
||||
return iconPath, nil
|
||||
}
|
||||
|
||||
func quoteDesktopExec(path string) string {
|
||||
return strconv.Quote(path)
|
||||
}
|
||||
|
||||
func xdgDataHome() (string, error) {
|
||||
dataHome := os.Getenv("XDG_DATA_HOME")
|
||||
if dataHome == "" {
|
||||
|
||||
+3
-2
@@ -15,6 +15,7 @@ import (
|
||||
"gitea.mixdep.ru/mix/gosentry/assets"
|
||||
"gitea.mixdep.ru/mix/gosentry/src/core"
|
||||
"gitea.mixdep.ru/mix/gosentry/src/domain"
|
||||
"gitea.mixdep.ru/mix/gosentry/src/platform/autostart"
|
||||
"gitea.mixdep.ru/mix/gosentry/src/runner"
|
||||
"gitea.mixdep.ru/mix/gosentry/src/scheduler"
|
||||
"gitea.mixdep.ru/mix/gosentry/src/storage"
|
||||
@@ -910,7 +911,7 @@ func settingsView(w fyne.Window, store *storage.Store, jobs *[]job) fyne.CanvasO
|
||||
startOnLogin.SetChecked(store.Config.StartOnLogin)
|
||||
autostartStatus := widget.NewLabel("")
|
||||
refreshAutostartStatus := func() {
|
||||
ok, message := core.AutostartStatus(store.Config.StartOnLogin, store.Paths.ExecutablePath)
|
||||
ok, message := autostart.AutostartStatus(store.Config.StartOnLogin, store.Paths.ExecutablePath)
|
||||
if ok {
|
||||
autostartStatus.SetText("OK: " + message)
|
||||
return
|
||||
@@ -975,7 +976,7 @@ func settingsView(w fyne.Window, store *storage.Store, jobs *[]job) fyne.CanvasO
|
||||
settingsStatus.SetText("Save failed: " + err.Error())
|
||||
return
|
||||
}
|
||||
if err := core.SetAutostart(store.Config.StartOnLogin, store.Paths.ExecutablePath, store.Paths.DesktopIcon); err != nil {
|
||||
if err := autostart.SetAutostart(store.Config.StartOnLogin, store.Paths.ExecutablePath, store.Paths.DesktopIcon); err != nil {
|
||||
refreshAutostartStatus()
|
||||
settingsStatus.SetText("Saved, autostart failed: " + err.Error())
|
||||
return
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//go:build linux
|
||||
|
||||
package core
|
||||
package autostart
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@@ -1,6 +1,6 @@
|
||||
//go:build linux
|
||||
|
||||
package core
|
||||
package autostart
|
||||
|
||||
import (
|
||||
"os"
|
||||
@@ -1,6 +1,6 @@
|
||||
//go:build !windows && !linux
|
||||
|
||||
package core
|
||||
package autostart
|
||||
|
||||
import "fmt"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package core
|
||||
package autostart
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
//go:build windows
|
||||
|
||||
package core
|
||||
package autostart
|
||||
|
||||
import (
|
||||
"os"
|
||||
Reference in New Issue
Block a user