Return to previously selected window when navigating to middle of split #84
Labels
No labels
Arch PKGBUILD
bug
build
commandline
duplicate
enhancement
font
good first issue
help wanted
implemented
is-it-really-a-bug?
necromancy
not-reproducable
question
reproducable
rofi
solved?
stalled
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
bud/i3ass#84
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This happens to me quite often when I split my workspace like this:
AB
AC
Where A is the pane which takes the whole of the left hand size of the screen and B is on top of C. If I am in the B pane and I focus left, the focus will move to the A pane (which is correct), however when I focus back right, the focus moves to the C pane, then moving left and right will move between A and C panes. I would expect this behaviour to move to the last selected pane so B -> A -> B -> A... and C -> A -> C -> A...
I was wondering if you could address this in the next update :)
Hello Kabeer!
Interesting issue. At the moment i3viswiz tries to focus whatever window would be in the direction the focus is going and on the center (or slightly above) the current window:
if one would focus right from window A in the scenarios above the results would be:
But I understand what you request, and it sounds nice, I would like that myself, but it might be very difficult to implement, since this would mean keeping the last focused container in memory somehow.. It is very possible in a i3fyra context, but not otherwise. I will definitely keep this in mind, I am working on viswiz right now, and maybe there is a smart way to do it, hmm. It also depends on if B and C (from your example) are siblings in the same parent container (which then would be split vertically), but they could be separate nodes as well, it's things like this that makes it tricky to implement.
possible solution
there is this other tool called i3gopher that keeps track of the last focused window and lets you add a keybinding to focus that last window, and it is smart so it doesn't store temporary windows and stuff.
Hey Bud!
Thank you for getting back to me :) Yes so in the 3 scenarios you have above, I would fully expect 1 to go to B and 2 to go to C as those are the panes which are directionally right of A. In scenario 3, it seems to be going to C rather than B so I see that when there isn't a clear pane to choose, it goes slightly below. I was thinking that in this scenario it would go back to whichever was previously selected but I understand that is not easy. I actually do not know how my containers are laid out, the reason I decided to use i3viswiz is that I thought this was really unintuitive!
I am thinking actually with your i3gopher recommendation, if there was any way we can handle the ambiguous scenario and then pass it to i3gopher? For example in scenario 3 above, where there is not a clear decision to be made, we could instead invoke i3gopher and it would select the previously selected window.
And as soon as I wrote that comment I realised it wouldn't work:
AABBCC
AABBCC
AABBDD
AABBDD
Here if we went from A right and then right again, it would go A -> B ->A which would definitely not be expected. I understand that this is a complex problem so I appreciate you taking a look at it!
I am thinking out loud here a bit, i can't promise anything and it might be a bad idea, but:
We go to A from B (left), then store that info on container A. If we later go right from container A, we check if the proposed container (which probably would be C, assuming the lower container) matches the last focused container. It will not match, we then check to see if that container (B) is aligned on the same split as C, if it is we focus that, otherwise focus C. I think this is doable, and we only change this last focused container thing, whenever we focus left|right|up|down (not if a new window would automatically get focus ). And we only need to store one single thing something like:
last_directional_focus=A-B, yes i think this can work fine, i can store it in a mark on the root node or something. I don't like the idea of writing this "variable" to a file, since focusing can sometimes be very frequent (if the delayed autoshift is triggered by holding a key, it would mean ~10 file operations/second..).if that is possible I definitely think that would be nice :). Just trying to consider edge cases, if we have a situation like this:
Lets say we start at B and focus left, therefore storing
last_directional_focus=Binside the node at A. We then focus up which moves to node E since B does not lie on that split (correct action) and then we focus left to focus D and then back down, hencelast_directional_focus=Dgets stored within A. We would lose the memory of previously selecting B (unless we store the last focus for each direction) but I think that is fine. I also agree that these should be stored in memory and not in a file. Also if we are using node id's, we should not have any issues with nodes being deleted and new ones being created either.As a small side note, I also think that in the scenario of:
when focusing right from A and there is no last directional focus, I would expect B to be selected and not C, not a big deal but if its easy to add into this change it would be appreciated
It is very easy to add, and I will do that. I have also noticed that i am cheating a bit, regarding to the position of the bar, this is related, and also something that will be more accurate (it is important for multimonitor support to work).
Yes, I think the best implementation will be to only store one single last direction,
last_directional_focus=A-Bwhere A and B are Container ID's and that example would mean that the last directional movement was from A to B, it doesn't matter which direction (left, right, up, down). This means that it will be replaced whenever we focus in a direction:So, the memory will only work when one focus back in the opposite direction, but I believe this will be good enough. The reason why this is better is that we only need one single place (mark) to store the info. Storing this for each window (and direction), would be really messy if it's done with the current method.
focus in the future
I am quite tempted to experiment with a version of viswiz implemented in Go similar to how i3gopher works, doing so would make things like this a lot easier.
this feature is now implemented in i3viswiz