summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/app.cpp33
-rw-r--r--src/app.hpp3
2 files changed, 23 insertions, 13 deletions
diff --git a/src/app.cpp b/src/app.cpp
index 93877ba..aa3f644 100644
--- a/src/app.cpp
+++ b/src/app.cpp
@@ -114,27 +114,34 @@ App::App(wl::display *d)
display{d},
controller{},
outputs(),
+ config(),
layouts(),
layers() {
assert(g_app == nullptr);
g_app = this;
- {
- auto l = load_layer_map("../ids.json");
- if (l.is_ok()) {
- this->layers = l.unwrap();
- } else {
- logerror("%s", l.err().value());
+ try {
+ {
+ auto l = load_layer_map(
+ this->config.get_string("layers.json").value().c_str());
+ if (l.is_ok()) {
+ this->layers = l.unwrap();
+ } else {
+ logerror("%s", l.err().value());
+ }
}
- }
- {
- auto l = load_layout("../layout.json");
- if (l.is_ok()) {
- this->layouts = l.unwrap();
- } else {
- logerror("%s", l.err().value());
+ {
+ auto l = load_layout(
+ this->config.get_string("layout.json").value().c_str());
+ if (l.is_ok()) {
+ this->layouts = l.unwrap();
+ } else {
+ logerror("%s", l.err().value());
+ }
}
+ } catch (std::exception &e) {
+ logerror("Loading of configuration failed: %s", e.what());
}
}
diff --git a/src/app.hpp b/src/app.hpp
index 7b9164f..5bbd2db 100644
--- a/src/app.hpp
+++ b/src/app.hpp
@@ -14,6 +14,7 @@
#include "layout.hpp"
#include "result.hpp"
#include "wayland.hpp"
+#include "config.hpp"
namespace wl {
struct display;
@@ -35,6 +36,8 @@ struct App {
std::unique_ptr<struct genivi::controller> controller;
std::vector<std::unique_ptr<struct wl::output>> outputs;
+ struct config config;
+
layouts_type layouts;
layer_map layers;