Hyprland icon indicating copy to clipboard operation
Hyprland copied to clipboard

windowrules: add 'solo' rule

Open haasn opened this issue 1 year ago • 5 comments

Describe your PR, what does it fix/add?

This adds a new window rule which matches a window if and only if it is the only non-floating window visible. Alternatively, it matches the window only if it is the 'root' of the layout tree.

See https://github.com/hyprwm/Hyprland/issues/2324

Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)

This is not necessarily the most elegant way of handling this condition. Perhaps it would be better to allow directly querying the number of floating / non-floating windows on the workspace, for example. That would allow encoding this rule with 'fullscreen:1andonworkspacenonfloating:1` (as two separate window rules).

But, I can't think of a good name for the "on workspace but non floating" rule. Maybe it would be better to instead generalize this substantially, so we could encode conditions in a more flexible way. But that is probably out-of-scope for this change.

Is it ready for merging, or does it need work?

Tested and working but see above.

haasn avatar Feb 14 '24 15:02 haasn

can't you just do windowrulev2 = [rule], onworkspace:1, floating:0?

phonetic112 avatar Feb 14 '24 16:02 phonetic112

can't you just do windowrulev2 = [rule], onworkspace:1, floating:0?

Consider the situation of there being one non-floating and one floating window on the same workspace. Your condition would be false for both, but the condition I want would be true for the non-floating window, as it is the only non-floating window.

The motivating use-case here is that I want to remove borders around windows when there is no reason to draw them, which is the case whenever a window effectively covers the whole screen - either because it is fullscreened, or because it is the only non-floating window.

haasn avatar Feb 14 '24 16:02 haasn

I'd rather expand the onworkspace to support tiled and floating.

vaxerski avatar Feb 14 '24 16:02 vaxerski

I'd rather expand the onworkspace to support tiled and floating.

Do we have a precedent for syntax? onworkspace.tiled:1, onworkspace:tiled:1?

haasn avatar Feb 16 '24 18:02 haasn

1 tiled, 2 floating, 2 floating 1 tiled sounds reasonable

(eg onworkspace: 2 floating)

vaxerski avatar Feb 16 '24 19:02 vaxerski