diff --git a/src/restore.c b/src/restore.c index a4c82c5..70b67d7 100644 --- a/src/restore.c +++ b/src/restore.c @@ -114,6 +114,7 @@ bool restore_tree(const char *file_path) jsmntok_t *t = tokens + 1; uint32_t focused_monitor_id = 0, primary_monitor_id = 0; + jsmntok_t *focus_history_token = NULL, *stacking_list_token = NULL; for (int i = 0; i < num; i++) { if (keyeq("focusedMonitorId", t, json)) { @@ -139,10 +140,16 @@ bool restore_tree(const char *file_path) continue; } else if (keyeq("focusHistory", t, json)) { t++; + if (mon == NULL) { + focus_history_token = t; + } restore_history(&t, json); continue; } else if (keyeq("stackingList", t, json)) { t++; + if (mon == NULL) { + stacking_list_token = t; + } restore_stack(&t, json); continue; } @@ -163,6 +170,14 @@ bool restore_tree(const char *file_path) } } + if (focus_history_token != NULL) { + restore_history(&focus_history_token, json); + } + + if (stacking_list_token != NULL) { + restore_stack(&stacking_list_token, json); + } + for (monitor_t *m = mon_head; m != NULL; m = m->next) { for (desktop_t *d = m->desk_head; d != NULL; d = d->next) { refresh_presel_feedbacks(m, d, d->root);