river icon indicating copy to clipboard operation
river copied to clipboard

Geometry resize/move

Open nagy135 opened this issue 4 years ago • 5 comments

On x11/bspwm I was making use of xdo in a script that positioned window to exact size/location (width,height, x, y).

Use case: I was watching video via mpv and wanted to do other stuff as well so I had bind that put it to floating mode and positioned it at one of bottom corners as a miniature above everything (and much more).

As I understand, external program cant resize other window like this on wayland (correct me if I m wrong) so it would have to be implemented in river. I wanted to try implementing it but first I would like to ask if adding feature like this to river would be desired at all.

nagy135 avatar Jul 22 '21 18:07 nagy135

Did you look into snap,move and resize commands?

novakne avatar Jul 22 '21 18:07 novakne

Yes I did, what I m looking for is exact positioning with geometry these commands work with delta. Imagine you want to move currently focused window to size of 200x200 in bottom right corner. How would you script that? If I knew current size and location I can imagine writing some script I guess, not sure how to do that tho ...

edit: I could do what I want by snap right, snap bottom, (optionally move little away from side) but then i m not sure how to achieve exact size without knowing current one. Is there a way to get that information? If yes than I could script that but you gotta admit it would be much easier with geometry instead of delta

nagy135 avatar Jul 22 '21 19:07 nagy135

i m not sure how to achieve exact size without knowing current one. Is there a way to get that information?

No, that is currently not available.

I think a set-dimensions [width]x[height] and a set-position x y command is not unreasonable (with the normal window bounds applied, of course). In the future those could potentially even be moved to the river-toplevel protocol extension.

I recommend submitting a patch, those commands should be fairly easy to implement.

As a workaround for now you can use the snap command and try to set the size via an mpv command flag.

Leon-Plickat avatar Jul 22 '21 20:07 Leon-Plickat

I also think there should be instance agnostic way to achieve this because there are programs without command flag like that.

This exact usecase could be achieved with currently possible delta resize/move if i knew current size so i was thinking if cli command that dumps current state wouldnt be more reasonable. It might be usefull in other usecases as well (bspwm could dump json with that information). Any opinions about that? It might be more general solution to my feature request.

nagy135 avatar Jul 23 '21 03:07 nagy135

[...] cli command that dumps current state wouldnt be more reasonable. It might be usefull in other usecases as well (bspwm could dump json with that information). Any opinions about that?

Generally features are only implemented in river if they have a good use case, so until some concrete example that can not be solved better another way is found, I am against this. Your use case can be solved far easier with commands to directly set the position and dimensions of a window on an output (note that the output dimensions are already available).

I feel like this is information clients should not have, users would only it for weird hacks. We should keep doing what other Wayland compositors do and only expose information that is strictly needed.

But if we decide to do this, it would probably be using something like the river-toplevel protocol extension I proposed (see #314). That way it is up to the client whether the information is displayed as JSON or any other format, river would just send Wayland events. If we do that, I'll probably just extend lswt, which already can output data on Wayland toplevels (fancy word for windows) as JSON, to display river specific values.

Leon-Plickat avatar Jul 23 '21 09:07 Leon-Plickat