Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
ximper-system-updater
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
ximper-system-updater
Commits
89e3bbef
Commit
89e3bbef
authored
Apr 13, 2026
by
Roman Alifanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skip primary-only setup when running as secondary instance
parent
f52ae970
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
21 deletions
+40
-21
main.go
main.go
+40
-21
No files found.
main.go
View file @
89e3bbef
package
main
import
(
"context"
"log"
"os"
"SystemUpdater/backend/eepm"
_
"SystemUpdater/lib/gtks/logging"
"SystemUpdater/lib/i18n"
...
...
@@ -8,8 +12,6 @@ import (
"SystemUpdater/service"
"SystemUpdater/store"
"SystemUpdater/ui"
"log"
"os"
"github.com/diamondburned/gotk4-adwaita/pkg/adw"
"github.com/diamondburned/gotk4/pkg/gio/v2"
...
...
@@ -19,6 +21,42 @@ import (
func
main
()
{
i18n
.
Init
()
app
:=
adw
.
NewApplication
(
"ru.ximperlinux.SystemUpdater"
,
gio
.
ApplicationHandlesCommandLine
)
// The command-line handler runs in the primary instance. The local
// (secondary) instance only forwards the command line via D-Bus and
// waits for the primary to mark it Done().
app
.
ConnectCommandLine
(
func
(
cmdLine
*
gio
.
ApplicationCommandLine
)
int
{
args
:=
cmdLine
.
Arguments
()
background
:=
false
for
_
,
arg
:=
range
args
{
if
arg
==
"--background"
{
background
=
true
}
}
if
!
background
{
app
.
Activate
()
}
cmdLine
.
Done
()
return
0
})
if
err
:=
app
.
Register
(
context
.
Background
());
err
!=
nil
{
log
.
Fatalf
(
"Failed to register application: %v"
,
err
)
}
if
app
.
IsRemote
()
{
// Secondary instance: nothing to do locally — app.Run() will
// forward the command line to the primary and exit as soon as
// the primary calls cmdLine.Done().
os
.
Exit
(
app
.
Run
(
os
.
Args
))
}
// ---- primary-only setup below ----
st
:=
store
.
NewStore
()
defer
st
.
Close
()
...
...
@@ -45,8 +83,6 @@ func main() {
}
defer
eepmClient
.
Close
()
app
:=
adw
.
NewApplication
(
"ru.ximperlinux.SystemUpdater"
,
gio
.
ApplicationHandlesCommandLine
)
notificationSvc
:=
service
.
NewNotificationService
(
&
app
.
Application
.
Application
)
historySvc
:=
service
.
NewHistoryService
(
st
,
historyFile
)
updateSvc
:=
service
.
NewUpdateService
(
st
,
eepmClient
,
historySvc
)
...
...
@@ -71,23 +107,6 @@ func main() {
window
.
Window
.
Present
()
})
app
.
ConnectCommandLine
(
func
(
cmdLine
*
gio
.
ApplicationCommandLine
)
int
{
args
:=
cmdLine
.
Arguments
()
background
:=
false
for
_
,
arg
:=
range
args
{
if
arg
==
"--background"
{
background
=
true
}
}
if
!
background
{
app
.
Activate
()
}
return
0
})
defer
func
()
{
schedulerSvc
.
Stop
()
log
.
Println
(
"Application shutdown complete"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment