Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add client move global by direction #2437

Open
darrenswhite opened this issue Oct 15, 2018 · 8 comments

Comments

Projects
None yet
3 participants
@darrenswhite
Copy link

commented Oct 15, 2018

Similar to how awful.client.focus.global_bydirection and awful.client.swap.global_bydirection work except for moving a client in a given direction. This would be nice to have if possible! Thanks.

@Elv13

This comment has been minimized.

Copy link
Member

commented Oct 15, 2018

Here you go
https://github.com/elv13/collision

  • Select clients by direction
  • Move clients by direction
  • Move floating clients by relative offset
  • Select screens by direction
  • Select tag by direction
  • Move tag by direction
@actionless

This comment has been minimized.

Copy link
Member

commented Oct 16, 2018

i think it could be done as client:move_to_screen_bydirection as a counterpart to existing client:move_to_screen but i am running single-screen setup now so can't play with it

@Elv13

This comment has been minimized.

Copy link
Member

commented Oct 16, 2018

In that case it would be swap_by_direction, but it has some issues and isn't such a good idea because of floating vs. tiled clients.

If you implement a trivial swap by direction and the next client is floating and the origin isn't, you only have bad choice. Either you blindly swap them and it doesn't work. Either you make the target tiled and the origin floating, in which case you probably made your calculator or popup tiled by accident or you do nothing and it's confusing.

It's better to keep separate logic for floating and tiled clients when it comes to swapping. So a global method on the client isn't gonna work.

@actionless

This comment has been minimized.

Copy link
Member

commented Oct 16, 2018

but move_to_screen is not swap, move means what the client just goes away from this screen to some other

@Elv13

This comment has been minimized.

Copy link
Member

commented Oct 16, 2018

Ah, yeah, we could have that one. I always wanted to add move iterators and navigation methods to the screens to handle geometric navigation and iteration (from left to right, right to left, top to bottom, bottom to top) but I never did.

@actionless

This comment has been minimized.

Copy link
Member

commented Oct 16, 2018

but such kind of code should already reside in *_global_bydirection helpers, so mb it could be extracted and re-used?

@Elv13

This comment has been minimized.

Copy link
Member

commented Oct 16, 2018

It is in gears.geometry.rectangle.get_in_direction. However given the rarely changing screen layouts, it may be worth it to cache the result and daisy-chain the screens (internally, in Lua). Then add myscreen.left/right/up/down properties. However, as I said, it's only safe to do this for screens. Client and tags have many corner case that makes such accessors useless in practice.

@darrenswhite

This comment has been minimized.

Copy link
Author

commented Oct 20, 2018

I think client:move_to_screen_bydirection which @actionless suggested would work for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.