From b50f5b7c1e64e7401a8bbb0377d1fe1d906b3636 Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Tue, 30 Jan 2024 18:04:43 +0000 Subject: [PATCH] window-rules: add root-toplevel critiera --- include/view.h | 1 + src/desktop.c | 1 + src/osd.c | 1 + src/view.c | 5 +++++ 4 files changed, 8 insertions(+) diff --git a/include/view.h b/include/view.h index 0b2bb01a..8456fec4 100644 --- a/include/view.h +++ b/include/view.h @@ -255,6 +255,7 @@ enum lab_view_criteria { /* Positive criteria */ LAB_VIEW_CRITERIA_FULLSCREEN = 1 << 1, LAB_VIEW_CRITERIA_ALWAYS_ON_TOP = 1 << 2, + LAB_VIEW_CRITERIA_ROOT_TOPLEVEL = 1 << 3, /* Negative criteria */ LAB_VIEW_CRITERIA_NO_ALWAYS_ON_TOP = 1 << 6, diff --git a/src/desktop.c b/src/desktop.c index 8792af8d..a1299f65 100644 --- a/src/desktop.c +++ b/src/desktop.c @@ -127,6 +127,7 @@ desktop_cycle_view(struct server *server, struct view *start_view, * here and in the osd.c window-switcher code */ enum lab_view_criteria criteria = LAB_VIEW_CRITERIA_CURRENT_WORKSPACE + | LAB_VIEW_CRITERIA_ROOT_TOPLEVEL | LAB_VIEW_CRITERIA_NO_SKIP_WINDOW_SWITCHER; /* diff --git a/src/osd.c b/src/osd.c index 6f47f16c..c6affa23 100644 --- a/src/osd.c +++ b/src/osd.c @@ -410,6 +410,7 @@ display_osd(struct output *output) wl_array_init(&views); view_array_append(server, &views, LAB_VIEW_CRITERIA_CURRENT_WORKSPACE + | LAB_VIEW_CRITERIA_ROOT_TOPLEVEL | LAB_VIEW_CRITERIA_NO_SKIP_WINDOW_SWITCHER); float scale = output->wlr_output->scale; diff --git a/src/view.c b/src/view.c index 46a9599a..7bc09c9b 100644 --- a/src/view.c +++ b/src/view.c @@ -107,6 +107,11 @@ matches_criteria(struct view *view, enum lab_view_criteria criteria) return false; } } + if (criteria & LAB_VIEW_CRITERIA_ROOT_TOPLEVEL) { + if (view != view_get_root(view)) { + return false; + } + } if (criteria & LAB_VIEW_CRITERIA_NO_ALWAYS_ON_TOP) { if (view_is_always_on_top(view)) { return false;