mirror of
https://github.com/FelixKratz/SketchyBar
synced 2024-11-10 05:44:16 +00:00
fix duplicate keys in space_windows_change INFO (#498)
This commit is contained in:
parent
6801874d08
commit
9c88e3c957
1 changed files with 14 additions and 2 deletions
|
@ -123,13 +123,26 @@ static void app_windows_post_event_for_space(struct app_windows* windows, uint64
|
|||
pid_count[j]++;
|
||||
if (!pid_name[j]) {
|
||||
pid_name[j] = workspace_copy_app_name_for_pid(pid_list[j]);
|
||||
length += pid_name[j] ? strlen(pid_name[j]) + 16 : 0;
|
||||
length += pid_name[j] ? (strlen(pid_name[j]) + 16) : 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < windows->num_windows; i++) {
|
||||
for (int j = i + 1; j < windows->num_windows; j++) {
|
||||
if (pid_name[i]
|
||||
&& pid_name[j]
|
||||
&& strcmp(pid_name[i], pid_name[j]) == 0) {
|
||||
free(pid_name[j]);
|
||||
pid_name[j] = NULL;
|
||||
|
||||
pid_count[i] += pid_count[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
char payload[length];
|
||||
memset(payload, 0, length);
|
||||
snprintf(payload, length, "{\n"
|
||||
|
@ -156,7 +169,6 @@ static void app_windows_post_event_for_space(struct app_windows* windows, uint64
|
|||
cursor = payload + strlen(payload);
|
||||
}
|
||||
|
||||
|
||||
snprintf(cursor, length - (cursor - payload), "\n\t}\n}\n");
|
||||
struct event event = { payload, SPACE_WINDOWS_CHANGED };
|
||||
event_post(&event);
|
||||
|
|
Loading…
Reference in a new issue