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

Allow cycling through windows when using '[title="foo"] focus' #840

i3bot opened this issue Oct 11, 2012 · 2 comments

Allow cycling through windows when using '[title="foo"] focus' #840

i3bot opened this issue Oct 11, 2012 · 2 comments


Copy link

@i3bot i3bot commented Oct 11, 2012

[Originally reported by anonymous]
(At the moment when doing something like
$ i3-msg '[title="foo"] focus'
the 'focus' command is issued to all of the matching windows. Presumably in order of their creation, as the focus rests on the window, which was created last.

While this behavior is quite useful when doing
$ i3-msg '[title="foo"] move workspace current
$ i3-msg '[title="foo"] border none
I think it is not so useful with focus, as only one window can (or should?) actually have the focus. An additional side effect is that any urgent flags on matching windows get lost.

Would it be possible to add something like this
[title="foo"] focus next
[title="foo"] focus previous
or maybe like this using the 'window'-field I saw with get_tree
[title="foo" window="next_higher"] focus
[title="foo" window="next_lower"] focus
so that one can cycle through the windows one by one?


Copy link

@stapelberg stapelberg commented Oct 11, 2012

Cycling through windows in focus order (like alt-tab) is something we don’t want to implement:

  1. The order in which alt+tab switches through windows is not easily predictable (due to our internal tree layout), thus either not doing what you want or making a separate visual element necessary (like a window list).
  2. Having such a visual element as discussed in 1 would need hand-eye coordination: you press a key (hand), then look at the screen, figure out what you want, then press another key.
  3. Direction focus is quicker. Instead of having one shortcut to go through all windows, you have 4.

Maybe slowpoke’s window switching script (ask him on IRC) is what you are looking for.

If it’s not, maybe you can build your idea with the IPC interface. It’s not going to be in core i3, though.

Copy link

@i3bot i3bot commented Oct 11, 2012

[Original comment by anonymous]

Thanks for the quick response. I can see your point for not making this a core feature.

Just to clarify:
I wasn't really looking for a way to cycle through all windows, I'm quite thankful for direction focus. (So thank you :) )
I was trying to focus a specific window on a different workspace by title (as per the user guide) and didn't get the window I was expecting, but another with the same (partial) title.
Repeated calls with the same command consistently focused on the same window, which seemed to me - after some testing - to be the latest matching window created. This being consistent is why I thought there may be an easy way to cycle through a list of matching windows and thus allow me to find the window I was actually looking for.
But seeing your arguments I have to agree, this feature is best left to other window managers.

Oh and thanks for the pointer to slowpoke's script. I think this is actually way better than what I was asking for.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants