Sort dock clients by class and instance
This is similar to #3820 but does not use qsort but an insertion sort in con_attach. Since each bar block automatically gets its own incremental bar id, bards end up being sorted according to their definition order in the config file. For i3bar, the WM_CLASS is modified to include an instance name which depends on the bar_id. This could be useful for other reason, e.g. users targeting a specific bar instance. Fixes #3491
This commit is contained in:
@ -110,3 +110,20 @@ ssize_t swrite(int fd, const void *buf, size_t count) {
|
||||
else
|
||||
return n;
|
||||
}
|
||||
|
||||
/*
|
||||
* Like strcasecmp but considers the case where either string is NULL.
|
||||
*
|
||||
*/
|
||||
int strcasecmp_nullable(const char *a, const char *b) {
|
||||
if (a == b) {
|
||||
return 0;
|
||||
}
|
||||
if (a == NULL) {
|
||||
return -1;
|
||||
}
|
||||
if (b == NULL) {
|
||||
return 1;
|
||||
}
|
||||
return strcasecmp(a, b);
|
||||
}
|
||||
|
Reference in New Issue
Block a user