mirror of
https://github.com/swaywm/sway.git
synced 2024-12-01 02:49:26 +00:00
Sort workspace on bar by num
This commit is contained in:
parent
5a9cc96446
commit
54c3e8458b
|
@ -98,6 +98,19 @@ void cairo_set_source_u32(cairo_t *cairo, uint32_t color) {
|
|||
(color & 0xFF) / 256.0);
|
||||
}
|
||||
|
||||
int workspace_cmp(const void *left, const void *right) {
|
||||
const struct workspace *a = left, *b = right;
|
||||
if (a->num > b->num) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (a->num < b->num) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ipc_update_workspaces() {
|
||||
if (workspaces) {
|
||||
free_flat_list(workspaces);
|
||||
|
@ -138,6 +151,9 @@ void ipc_update_workspaces() {
|
|||
json_object_put(ws_json);
|
||||
}
|
||||
|
||||
// sort by num
|
||||
list_sort(workspaces, workspace_cmp);
|
||||
|
||||
json_object_put(results);
|
||||
free(res);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue