Support window-rules

Two types of window rules are supported, actions and properties. They are
defined as shown below.

    <windowRules>

      <!-- Action -->
      <windowRule identifier="some-application">
        <action name="Maximize"/>
      </windowRule>

      <!-- Property -->
      <windowRule identifier="foo*" serverDecoration="yes|no"/>

    </windowRules>

Rules are applied if windows match the criteria defined by the
'identifier' attribute which relates to app_id for native Wayland windows
and WM_CLASS for XWayland clients.

Matching against patterns with '*' (wildcard) and '?' (joker) is
supported.

Add 'serverDecoration' property.
This commit is contained in:
Johan Malm 2023-04-28 21:41:41 +01:00 committed by Johan Malm
parent d0aafb684f
commit d609c9e3f9
12 changed files with 281 additions and 3 deletions

View file

@ -6,6 +6,7 @@
#include "node.h"
#include "view.h"
#include "view-impl-common.h"
#include "window-rules.h"
#include "workspaces.h"
#define CONFIGURE_TIMEOUT_MS 100
@ -49,6 +50,16 @@ handle_new_xdg_popup(struct wl_listener *listener, void *data)
static bool
has_ssd(struct view *view)
{
/* Window-rules take priority if they exist for this view */
switch (window_rules_get_property(view, "serverDecoration")) {
case LAB_PROP_TRUE:
return true;
case LAB_PROP_FALSE:
return false;
default:
break;
}
/*
* view->ssd_preference may be set by the decoration implementation
* e.g. src/decorations/xdg-deco.c or src/decorations/kde-deco.c.
@ -425,13 +436,13 @@ xdg_toplevel_view_map(struct view *view)
view->current.y = view->pending.y;
view_moved(view);
view->been_mapped = true;
}
view->commit.notify = handle_commit;
wl_signal_add(&xdg_surface->surface->events.commit, &view->commit);
view_impl_map(view);
view->been_mapped = true;
}
static void