]> git.mdlowis.com Git - proto/labwc.git/commitdiff
window-rules: add fixedPosition property
authorJohan Malm <jgm323@gmail.com>
Thu, 9 Nov 2023 21:44:51 +0000 (21:44 +0000)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Fri, 10 Nov 2023 20:46:15 +0000 (21:46 +0100)
...to address regression introduced by 57075ce and enables panel/desktop
clients which rely on window rules to remain in the same position when
the usable-area changes (normally because an exclusive layer-shell
clients is started/finished).

Also disallows interactive move/resize, for example by alt +
mouse-press.

Fixes: #1235
docs/labwc-config.5.scd
docs/rc.xml.all
include/window-rules.h
src/config/rcxml.c
src/interactive.c
src/view.c
src/window-rules.c

index f258aa18805ec7a5a5fcf97e56e2f5a1bcd6511b..bf658ebc42475e81c4268d69bf3410b5865bba45 100644 (file)
@@ -526,6 +526,12 @@ situation.
 *<windowRules><windowRule ignoreFocusRequest="">* [yes|no|default]
        *ignoreFocusRequest* prevent window to activate itself.
 
+*<windowRules><windowRule fixedPosition="">* [yes|no|default]
+       *fixedPosition* disallows interactive move/resize and prevents
+       re-positioning in response to changes in reserved output space, which
+       can be caused by *<margin>* settings or exclusive layer-shell clients
+       such as panels.
+
 ## ENVIRONMENT VARIABLES
 
 *XCURSOR_THEME* and *XCURSOR_SIZE* are supported to set cursor theme
index 5b32337102c2144df7b136e741588dbb72fbbedc..92a5920aa50c8fa288b95a561291db5f18ed43a7 100644 (file)
       <windowRule title="pcmanfm-desktop*">
         <skipTaskbar>yes</skipTaskbar>
         <skipWindowSwitcher>yes</skipWindowSwitcher>
+       <fixedPosition>yes</fixedPosition>
         <action name="MoveTo" x="0" y="0" />
         <action name="ToggleAlwaysOnBottom"/>
       </windowRule>
index fae1daf7a4b3d0294febfa6cf18d1fff579cfd6c..626fb540b85af47faf563f74b39fdf0ba2e8fde9 100644 (file)
@@ -30,6 +30,7 @@ struct window_rule {
        enum property skip_taskbar;
        enum property skip_window_switcher;
        enum property ignore_focus_request;
+       enum property fixed_position;
 
        struct wl_list link; /* struct rcxml.window_rules */
 };
index 0308b6376fbcea7e028f02443b04999c49f92602..ed4c1847e3cfcd97efcbd9f93d2018ade88deffb 100644 (file)
@@ -159,6 +159,8 @@ fill_window_rule(char *nodename, char *content)
                set_property(content, &current_window_rule->skip_window_switcher);
        } else if (!strcasecmp(nodename, "ignoreFocusRequest")) {
                set_property(content, &current_window_rule->ignore_focus_request);
+       } else if (!strcasecmp(nodename, "fixedPosition")) {
+               set_property(content, &current_window_rule->fixed_position);
 
        /* Actions */
        } else if (!strcmp(nodename, "name.action")) {
index 25139e8bbe6f997845a1f64248fdffd07c3e1c4f..31c3c076e45def44452078241aa188339b980d5b 100644 (file)
@@ -4,6 +4,7 @@
 #include "regions.h"
 #include "resize_indicator.h"
 #include "view.h"
+#include "window-rules.h"
 
 static int
 max_move_scale(double pos_cursor, double pos_current,
@@ -34,6 +35,10 @@ interactive_begin(struct view *view, enum input_mode mode, uint32_t edges)
                return;
        }
 
+       if (window_rules_get_property(view, "fixedPosition") == LAB_PROP_TRUE) {
+               return;
+       }
+
        switch (mode) {
        case LAB_INPUT_STATE_MOVE:
                if (view->fullscreen) {
index e11c6c14c4f150fd0ed09290b61693181727687e..4bafe7cd068ca6b54542b98e78256738fa748e7b 100644 (file)
@@ -587,6 +587,10 @@ view_adjust_floating_geometry(struct view *view, struct wlr_box *geometry)
                return false;
        }
 
+       if (window_rules_get_property(view, "fixedPosition") == LAB_PROP_TRUE) {
+               return false;
+       }
+
        bool adjusted = false;
        /*
         * First check whether the view is onscreen. For now, "onscreen"
index 2607199a76eb7154732643fb68171cb32249b54e..d3ed888ec67c26317ec8e886168469d15d5c78c4 100644 (file)
@@ -128,6 +128,10 @@ window_rules_get_property(struct view *view, const char *property)
                                        && !strcasecmp(property, "ignoreFocusRequest")) {
                                return rule->ignore_focus_request;
                        }
+                       if (rule->fixed_position
+                                       && !strcasecmp(property, "fixedPosition")) {
+                               return rule->fixed_position;
+                       }
                }
        }
        return LAB_PROP_UNSPECIFIED;