hyprwm / Hyprland

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
https://hyprland.org
BSD 3-Clause "New" or "Revised" License
21.07k stars 881 forks source link

[Feature Request] Event driven hooks for Window rules or change default behavior of child floating windows. #8039

Open ctilley83 opened 1 week ago

ctilley83 commented 1 week ago

Description

It would be useful if a shell script could be executed when a window rule is triggered. I encountered a scenario using pcmanfm-qt, now built on Qt6. When selecting a context menu item like "file properties," the default behavior is to tile the window. After creating a window rule to float the dialog, it gets centered on the screen, which isn't ideal. I wrote a script to calculate the center of the parent window and position the dialog above it. However, there's no way to trigger the script automatically. A keybind won’t work, as it would be impractical to manually move the window after the dialog has opened.

If there are no plans to implement the above functionality, another solution to my specific issue is to force floating windows to position themselves centered to the parent window, or at least close to it while staying within the bounds of the screen. This would change the default behavior although it could be implemented as a second option.

Just something to note. Thunar's default behavior is to center the dialog above the window, so that indicates to me that developers control the positioning and whether to float the window. However it would be nice to have built in ways to override that with window rule scripts.

Edit: Thunar only centers the file properties window, not the preferences window 🤷‍♂️

vaxerski commented 1 week ago

For static rules although this would work it wouldn't make sense.

For dynamic, it doesn't make sense as the properties are re-evaluated all the time.

Why doesn't it make sense?

socket2 exists and you can listen to the window opened event, it should solve your problem?