feat: add code for infinite window loop Between Left & Right#150
Conversation
|
Neat idea. Let's make this optional behavior. Please add a config option to config.lua and default the value to false. Then add a short description of the config and behavior to the README. |
88d5367 to
f782b7d
Compare
Hi, I have pushed the code back with adding a config option. I think the pr doesn't perfectly implement smooth scrolling. |
|
I did a quick test with this PR. It looks like the focus window behavior you implemented is working correctly. For your example of windows Are you saying that you wish to not just focus a window, but change the order of the tiled windows? For example, if window |
Yeah , that's what I wanted to say. |
When the user focuses left from a leftmost window or right from a rightmost window and the infinite_loop_window option is enabled, move the wrap around window column to the adjacent spot. Do this by updating the tiling indexes of the wrap around column windows. Then tile the space before changing focus. This will move the wrap around column windows, taking care to put them in the margin if moved off screen. The currently focused window will not move. Then let focusWindow() change the focus to a window in the wrap around column (as usual). The focus changed event handler will call tileSpace() again, this time sliding the wrap around column on screen from the expected direction. The end effect is the appearance of an infinite list of windows extending left or right.
|
@dev24hrs I added a new commit to this PR to move the wrap around column of windows to the adjacent spot. I believe this is the effect you wanted to achieve. Please give it a try. I did not do this for wrap around window focusing within a column. The window movement seemed unnecessary since you can always see all windows in a column. |
@mogenson Thank you for your code ; it is the behavior I expected. I'd like to know if you will implement this wrap window feature in a later version. |
Test focus directions UP, DOWN, LEFT, RIGHT. Test window focus wrapping with and without infinite_loop_window. Verify that wrapped windows / columns are moved for an infinite scroll.
Do you mind if I add to your PR? I've appended the previous commit to move windows when wrapping and I just added a new commit to include unit tests for Window.focusWindow() and wrapping. |
|
Of course u can , it would be my honor. This feature in the PR is just my immature idea; it would be perfect if it could be added to the project plan and accepted by users. |
|
Ha! Funnily enough, I was working on my own implementation that I was about to PR. Looks like the open source world has got me covered, great work! |
|
I want to mention that my config currently has these bindings because I have ctrl+j/k bound to switching spaces. focus_prev = { { "ctrl" }, "h" },
focus_next = { { "ctrl" }, "l" },It looks like the implementation for |
I see no reason why this couldn't be supported for the next / previous actions. @ArhanChaudhary could you try implementing it? I'd be happy to review and help. |
|
I have opened #151 :) |
First of all, I really like this software. However, there's one aspect I'd like to optimize during daily use: Unable to infinitely loop between windows.
For example: a -> b -> c -> d; however, d cannot switch to a be directly, and a cannot switch to d.
On my machine, it successfully loops left and right.
Since I do not use a top-and-bottom split-screen layout, I have not added any related code.
So I submitted a PR; I would appreciate your feedback or if you could merge it.