Skip to content

Commit

Permalink
output: Fallback to sorting workspaces alphabetically
Browse files Browse the repository at this point in the history
Currently the order of unnumbered workspaces is the order they were
created. This is a bit unintuitive for workflows where workspaces are
created and named dynamically.

Instead of treating all unnumbered workspaces equal, fallback to sorting
them alphabetically based on the name of the workspace. This will make
the ordering more deterministic regardless of the order they were
created.
  • Loading branch information
epontan committed Mar 8, 2024
1 parent 23389eb commit e8cc8d0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sway/tree/output.c
Expand Up @@ -9,6 +9,7 @@
#include "sway/tree/workspace.h"
#include "sway/server.h"
#include "log.h"
#include "stringop.h"
#include "util.h"

enum wlr_direction opposite_direction(enum wlr_direction d) {
Expand Down Expand Up @@ -403,7 +404,7 @@ static int sort_workspace_cmp_qsort(const void *_a, const void *_b) {
} else if (isdigit(b->name[0])) {
return 1;
}
return 0;
return lenient_strcmp(a->name, b->name);
}

void output_sort_workspaces(struct sway_output *output) {
Expand Down

0 comments on commit e8cc8d0

Please sign in to comment.