mirror of
https://github.com/labwc/labwc.git
synced 2026-02-18 22:05:32 -05:00
window-switcher: add order parameter to allow stable window list ordering
Some checks failed
labwc.github.io / notify (push) Has been cancelled
Some checks failed
labwc.github.io / notify (push) Has been cancelled
Add a new configuration option to control the window switcher traversal order. `order="focus"` cycling is convenient for quick toggling, but some users - me as well - prefer a stable taskbar-like order which can now be achieved with `order="age"`.
This commit is contained in:
parent
eecb5d0947
commit
8fdf375af3
9 changed files with 45 additions and 2 deletions
|
|
@ -276,13 +276,31 @@ create_osd_on_output(struct output *output)
|
|||
assert(output->cycle_osd.tree);
|
||||
}
|
||||
|
||||
static void
|
||||
insert_view_ordered_by_age(struct wl_list *views, struct view *new_view)
|
||||
{
|
||||
struct wl_list *link = views;
|
||||
struct view *view;
|
||||
wl_list_for_each(view, views, cycle_link) {
|
||||
if (view->creation_id >= new_view->creation_id) {
|
||||
break;
|
||||
}
|
||||
link = &view->cycle_link;
|
||||
}
|
||||
wl_list_insert(link, &new_view->cycle_link);
|
||||
}
|
||||
|
||||
/* Return false on failure */
|
||||
static bool
|
||||
init_cycle(struct server *server)
|
||||
{
|
||||
struct view *view;
|
||||
for_each_view(view, &server->views, rc.window_switcher.criteria) {
|
||||
wl_list_append(&server->cycle.views, &view->cycle_link);
|
||||
if (rc.window_switcher.order == WINDOW_SWITCHER_ORDER_AGE) {
|
||||
insert_view_ordered_by_age(&server->cycle.views, view);
|
||||
} else {
|
||||
wl_list_append(&server->cycle.views, &view->cycle_link);
|
||||
}
|
||||
}
|
||||
if (wl_list_empty(&server->cycle.views)) {
|
||||
wlr_log(WLR_DEBUG, "no views to switch between");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue