mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-20 03:35:41 +02:00
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
10
modules/i3.c
10
modules/i3.c
|
@ -247,14 +247,20 @@ 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;
|
struct workspace ws;
|
||||||
if (!workspace_from_json(current, &ws))
|
if (!workspace_from_json(current, &ws))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
workspace_add(m, ws);
|
workspace_add(m, ws);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
else if (is_empty) {
|
else if (is_empty) {
|
||||||
assert(workspace_lookup(m, current_name) != NULL);
|
assert(workspace_lookup(m, current_name) != NULL);
|
||||||
|
|
Loading…
Add table
Reference in a new issue