aboutsummaryrefslogtreecommitdiffhomepage
path: root/main.go
diff options
context:
space:
mode:
authorOphestra Umiker <cat@ophivana.moe>2024-09-09 21:19:12 +0900
committerOphestra Umiker <cat@ophivana.moe>2024-09-09 21:19:12 +0900
commit44301cd979ea7b2a03e1dc535fb98cdb2e356580 (patch)
tree5d7f7cb8b837be4cb464e5d244b7fbec97355c9c /main.go
parent20c0e66d8fa68dc113019da819f2c441d778dc60 (diff)
app/dbus: accept system bus config
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
Diffstat (limited to 'main.go')
-rw-r--r--main.go25
1 files changed, 19 insertions, 6 deletions
diff --git a/main.go b/main.go
index 4aca72f3..a15dc065 100644
--- a/main.go
+++ b/main.go
@@ -21,7 +21,9 @@ var (
Version = "impure"
a *app.App
- c *dbus.Config
+
+ dbusSession *dbus.Config
+ dbusSystem *dbus.Config
)
func tryVersion() {
@@ -47,13 +49,24 @@ func main() {
// parse D-Bus config file if applicable
if mustDBus {
- if dbusConfig == "builtin" {
- c = dbus.NewConfig(dbusID, true, mpris)
+ if dbusConfigSession == "builtin" {
+ dbusSession = dbus.NewConfig(dbusID, true, mpris)
} else {
- if f, err := os.Open(dbusConfig); err != nil {
+ if f, err := os.Open(dbusConfigSession); err != nil {
+ state.Fatal("Error opening D-Bus proxy config file:", err)
+ } else {
+ if err = json.NewDecoder(f).Decode(&dbusSession); err != nil {
+ state.Fatal("Error parsing D-Bus proxy config file:", err)
+ }
+ }
+ }
+
+ // system bus proxy is optional
+ if dbusConfigSystem != "nil" {
+ if f, err := os.Open(dbusConfigSystem); err != nil {
state.Fatal("Error opening D-Bus proxy config file:", err)
} else {
- if err = json.NewDecoder(f).Decode(&c); err != nil {
+ if err = json.NewDecoder(f).Decode(&dbusSystem); err != nil {
state.Fatal("Error parsing D-Bus proxy config file:", err)
}
}
@@ -122,7 +135,7 @@ func main() {
}
if mustDBus {
- a.ShareDBus(c)
+ a.ShareDBus(dbusSession, dbusSystem, dbusVerbose)
}
if mustPulse {