i3
include
load_layout.h
Go to the documentation of this file.
1
/*
2
* vim:ts=4:sw=4:expandtab
3
*
4
* i3 - an improved dynamic tiling window manager
5
* © 2009 Michael Stapelberg and contributors (see also: LICENSE)
6
*
7
* load_layout.c: Restore (parts of) the layout, for example after an inplace
8
* restart.
9
*
10
*/
11
#pragma once
12
13
#include <config.h>
14
15
typedef
enum
{
16
// We could not determine the content of the JSON file. This typically
17
// means it’s unreadable or contains garbage.
18
JSON_CONTENT_UNKNOWN
= 0,
19
20
// The JSON file contains a “normal” container, i.e. a container to be
21
// appended to an existing workspace (or split container!).
22
JSON_CONTENT_CON
= 1,
23
24
// The JSON file contains a workspace container, which needs to be appended
25
// to the output (next to the other workspaces) with special care to avoid
26
// naming conflicts and ensuring that the workspace _has_ a name.
27
JSON_CONTENT_WORKSPACE
= 2,
28
}
json_content_t
;
29
30
/* Parses the given JSON file until it encounters the first “type” property to
31
* determine whether the file contains workspaces or regular containers, which
32
* is important to know when deciding where (and how) to append the contents.
33
* */
34
json_content_t
json_determine_content
(
const
char
*buf,
const
size_t
len);
35
40
bool
json_validate
(
const
char
*buf,
const
size_t
len);
41
42
void
tree_append_json
(
Con
*con,
const
char
*buf,
const
size_t
len,
char
**errormsg);
JSON_CONTENT_CON
@ JSON_CONTENT_CON
Definition:
load_layout.h:22
json_content_t
json_content_t
Definition:
load_layout.h:15
JSON_CONTENT_UNKNOWN
@ JSON_CONTENT_UNKNOWN
Definition:
load_layout.h:18
json_determine_content
json_content_t json_determine_content(const char *buf, const size_t len)
Definition:
load_layout.c:587
json_validate
bool json_validate(const char *buf, const size_t len)
Returns true if the provided JSON could be parsed by yajl.
Definition:
load_layout.c:560
tree_append_json
void tree_append_json(Con *con, const char *buf, const size_t len, char **errormsg)
Definition:
load_layout.c:620
JSON_CONTENT_WORKSPACE
@ JSON_CONTENT_WORKSPACE
Definition:
load_layout.h:27
Con
A 'Con' represents everything from the X11 root window down to a single X11 window.
Definition:
data.h:604
Generated by
1.8.20