fix: avoid use null mon when in mmsg

This commit is contained in:
DreamMaoMao 2026-05-26 20:12:55 +08:00
parent 9d96116fe5
commit 431b1c1282
2 changed files with 4 additions and 2 deletions

View file

@ -19,7 +19,7 @@ struct wl_list workspaces;
static void handle_ext_commit(struct wl_listener *listener, void *data);
static struct wl_listener ext_manager_commit_listener = {.notify =
handle_ext_commit};
handle_ext_commit};
void goto_workspace(struct workspace *target) {
uint32_t tag;

View file

@ -154,11 +154,13 @@ static cJSON *monitor_active_tags(Monitor *m) {
static cJSON *build_client_json(Client *c) {
cJSON *obj = cJSON_CreateObject();
cJSON_AddNumberToObject(obj, "id", c->id);
cJSON_AddNumberToObject(obj, "pid", c->pid);
cJSON_AddStringToObject(obj, "title", client_get_title(c));
cJSON_AddStringToObject(obj, "appid", client_get_appid(c));
cJSON_AddStringToObject(obj, "monitor", c->mon->wlr_output->name);
cJSON_AddStringToObject(obj, "monitor",
c->mon ? c->mon->wlr_output->name : "");
cJSON_AddItemToObject(obj, "tags", tags_mask_to_array(c->tags));
cJSON_AddBoolToObject(obj, "is_focused", c->isfocusing);
cJSON_AddBoolToObject(obj, "is_fullscreen", c->isfullscreen);