X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=include%2Fload_layout.h;h=f8b7da20a6f7ac58144f8cc53e0a891351a015bc;hb=96e1b80371b985d4f67b36e6cb48e61b5fb83995;hp=282512b2454e1be458e40d41538a2473817dd6d4;hpb=cd2a1267c8de435219d3808a71b7a09288ad3585;p=i3%2Fi3 diff --git a/include/load_layout.h b/include/load_layout.h index 282512b2..f8b7da20 100644 --- a/include/load_layout.h +++ b/include/load_layout.h @@ -2,15 +2,33 @@ * vim:ts=4:sw=4:expandtab * * i3 - an improved dynamic tiling window manager - * © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) + * © 2009 Michael Stapelberg and contributors (see also: LICENSE) * * load_layout.c: Restore (parts of) the layout, for example after an inplace * restart. * */ -#ifndef I3_LOAD_LAYOUT_H -#define I3_LOAD_LAYOUT_H +#pragma once -void tree_append_json(const char *filename); +typedef enum { + // We could not determine the content of the JSON file. This typically + // means it’s unreadable or contains garbage. + JSON_CONTENT_UNKNOWN = 0, -#endif + // The JSON file contains a “normal” container, i.e. a container to be + // appended to an existing workspace (or split container!). + JSON_CONTENT_CON = 1, + + // The JSON file contains a workspace container, which needs to be appended + // to the output (next to the other workspaces) with special care to avoid + // naming conflicts and ensuring that the workspace _has_ a name. + JSON_CONTENT_WORKSPACE = 2, +} json_content_t; + +/* Parses the given JSON file until it encounters the first “type” property to + * determine whether the file contains workspaces or regular containers, which + * is important to know when deciding where (and how) to append the contents. + * */ +json_content_t json_determine_content(const char *filename); + +void tree_append_json(Con *con, const char *filename, char **errormsg);