forked from external/yambar
module/i3: workaround 'workspace init' event being sent twice
Sway 1.4 sends two identical 'workspace init' events when a display is plugged in.
This commit is contained in:
parent
3fae6c2734
commit
c3b3d6a637
1 changed files with 12 additions and 6 deletions
18
modules/i3.c
18
modules/i3.c
|
@ -247,13 +247,19 @@ handle_workspace_event(int type, const struct json_object *json, void *_mod)
|
||||||
mtx_lock(&mod->lock);
|
mtx_lock(&mod->lock);
|
||||||
|
|
||||||
if (is_init) {
|
if (is_init) {
|
||||||
assert(workspace_lookup(m, current_name) == NULL);
|
struct workspace *already_exists = workspace_lookup(m, current_name);
|
||||||
|
if (already_exists != NULL) {
|
||||||
|
LOG_WARN("workspace 'init' event for already existing workspace: %s", current_name);
|
||||||
|
workspace_free(*already_exists);
|
||||||
|
if (!workspace_from_json(current, already_exists))
|
||||||
|
goto err;
|
||||||
|
} else {
|
||||||
|
struct workspace ws;
|
||||||
|
if (!workspace_from_json(current, &ws))
|
||||||
|
goto err;
|
||||||
|
|
||||||
struct workspace ws;
|
workspace_add(m, ws);
|
||||||
if (!workspace_from_json(current, &ws))
|
}
|
||||||
goto err;
|
|
||||||
|
|
||||||
workspace_add(m, ws);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (is_empty) {
|
else if (is_empty) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue