Skip to content

Commit

Permalink
Add "machine" to the IPC and layout saving/restoring
Browse files Browse the repository at this point in the history
  • Loading branch information
xzfc committed Apr 10, 2020
1 parent 356ccf1 commit 563b8b4
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
3 changes: 2 additions & 1 deletion docs/ipc
Expand Up @@ -349,7 +349,8 @@ window (integer)::
X11-related tools display (usually in hex).
window_properties (map)::
This optional field contains all available X11 window properties from the
following list: *title*, *instance*, *class*, *window_role* and *transient_for*.
following list: *title*, *instance*, *class*, *window_role*, *machine*
and *transient_for*.
window_type (string)::
The window type (_NET_WM_WINDOW_TYPE). Possible values are undefined, normal,
dialog, utility, toolbar, splash, menu, dropdown_menu, popup_menu, tooltip and
Expand Down
6 changes: 3 additions & 3 deletions docs/layout-saving
Expand Up @@ -185,9 +185,9 @@ Therefore, if you just start Emacs via dmenu, it will not get swallowed by that
container. Only if you start Emacs with the proper instance name (+emacs24
--name notmuch+), it will get swallowed.

You can match on "class", "instance", "window_role" and "title". All values are
case-sensitive regular expressions (PCRE). Use +xprop(1)+ and click into a
window to see its properties:
You can match on "class", "instance", "window_role", "title" and "machine". All
values are case-sensitive regular expressions (PCRE). Use +xprop(1)+ and click
into a window to see its properties:

--------------------------------------------------------------------------------
$ xprop
Expand Down
2 changes: 2 additions & 0 deletions src/ipc.c
Expand Up @@ -572,6 +572,7 @@ void dump_node(yajl_gen gen, struct Con *con, bool inplace_restart) {
DUMP_PROPERTY("class", class_class);
DUMP_PROPERTY("instance", class_instance);
DUMP_PROPERTY("window_role", role);
DUMP_PROPERTY("machine", machine);

if (con->window->name != NULL) {
ystr("title");
Expand Down Expand Up @@ -661,6 +662,7 @@ void dump_node(yajl_gen gen, struct Con *con, bool inplace_restart) {
DUMP_REGEX(instance);
DUMP_REGEX(window_role);
DUMP_REGEX(title);
DUMP_REGEX(machine);

#undef DUMP_REGEX
y(map_close);
Expand Down
3 changes: 3 additions & 0 deletions src/load_layout.c
Expand Up @@ -275,6 +275,9 @@ static int json_string(void *ctx, const unsigned char *val, size_t len) {
} else if (strcasecmp(last_key, "title") == 0) {
current_swallow->title = regex_new(sval);
swallow_is_empty = false;
} else if (strcasecmp(last_key, "machine") == 0) {
current_swallow->machine = regex_new(sval);
swallow_is_empty = false;
} else {
ELOG("swallow key %s unknown\n", last_key);
}
Expand Down
1 change: 1 addition & 0 deletions src/restore_layout.c
Expand Up @@ -154,6 +154,7 @@ static void update_placeholder_contents(placeholder_state *state) {
APPEND_REGEX(instance);
APPEND_REGEX(window_role);
APPEND_REGEX(title);
APPEND_REGEX(machine);

if (serialized == NULL) {
DLOG("This swallows specification is not serializable?!\n");
Expand Down

0 comments on commit 563b8b4

Please sign in to comment.