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

Focus sibling of focused container by index in parent #5750

Open
alex-huff opened this issue Nov 2, 2023 · 2 comments
Open

Focus sibling of focused container by index in parent #5750

alex-huff opened this issue Nov 2, 2023 · 2 comments
Labels
enhancement requires-configuration This feature request requires new configuration

Comments

@alex-huff
Copy link

I'm submitting a…

[ ] Bug
[x] Feature Request
[ ] Documentation Request
[ ] Other (Please describe in detail)

Current Behavior

There is no way to focus a sibling of the currently focused container by its index in parent. (that I know of)

Desired Behavior

Something like:

# focus the container at index 3 in the currently focused container's parent
i3msg focus sibling 3

This would allow you to:

  • switch to the nth tab in a tab/stack layout
  • switch to the nth container in a horizonal/vertical layout

My current workaround is hacky, depends on jq, and has perceivable latency:

bindsym Mod4+Shift+1 exec i3-msg [con_id = $(i3-msg -t get_tree | jq '.nodes | recurse(.[].nodes) | select(any(.focused? == true)) | .[0].id // "__focused__"')] focus
bindsym Mod4+Shift+2 exec i3-msg [con_id = $(i3-msg -t get_tree | jq '.nodes | recurse(.[].nodes) | select(any(.focused? == true)) | .[1].id // "__focused__"')] focus
bindsym Mod4+Shift+3 exec i3-msg [con_id = $(i3-msg -t get_tree | jq '.nodes | recurse(.[].nodes) | select(any(.focused? == true)) | .[2].id // "__focused__"')] focus
bindsym Mod4+Shift+4 exec i3-msg [con_id = $(i3-msg -t get_tree | jq '.nodes | recurse(.[].nodes) | select(any(.focused? == true)) | .[3].id // "__focused__"')] focus
bindsym Mod4+Shift+5 exec i3-msg [con_id = $(i3-msg -t get_tree | jq '.nodes | recurse(.[].nodes) | select(any(.focused? == true)) | .[4].id // "__focused__"')] focus
bindsym Mod4+Shift+6 exec i3-msg [con_id = $(i3-msg -t get_tree | jq '.nodes | recurse(.[].nodes) | select(any(.focused? == true)) | .[5].id // "__focused__"')] focus
bindsym Mod4+Shift+7 exec i3-msg [con_id = $(i3-msg -t get_tree | jq '.nodes | recurse(.[].nodes) | select(any(.focused? == true)) | .[6].id // "__focused__"')] focus
bindsym Mod4+Shift+8 exec i3-msg [con_id = $(i3-msg -t get_tree | jq '.nodes | recurse(.[].nodes) | select(any(.focused? == true)) | .[7].id // "__focused__"')] focus
bindsym Mod4+Shift+9 exec i3-msg [con_id = $(i3-msg -t get_tree | jq '.nodes | recurse(.[].nodes) | select(any(.focused? == true)) | .[8].id // "__focused__"')] focus
bindsym Mod4+Shift+0 exec i3-msg [con_id = $(i3-msg -t get_tree | jq '.nodes | recurse(.[].nodes) | select(any(.focused? == true)) | .[9].id // "__focused__"')] focus

Impact

[x] This feature requires new configuration and/or commands
@i3bot
Copy link

i3bot commented Nov 2, 2023

Please note that new features which require additional configuration will usually not be considered. We are happy with the feature set of i3 and want to focus in fixing bugs instead. We do accept feature requests, however, and will evaluate whether the added benefit (clearly) outweighs the complexity it adds to i3.

Keep in mind that i3 provides a powerful way to interact with it through its IPC interface: https://i3wm.org/docs/ipc.html.

@i3bot i3bot added the requires-configuration This feature request requires new configuration label Nov 2, 2023
@orestisfl
Copy link
Member

Your workaround works without any delay in my system and I wouldn't really call it hacky, the point of the IPC system is to dynamically query and execute command on the i3 tree based on your custom needs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement requires-configuration This feature request requires new configuration
Projects
None yet
Development

No branches or pull requests

3 participants