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 "focus_wrapping" option #2953

Merged
merged 3 commits into from
Sep 27, 2017
Merged

Add "focus_wrapping" option #2953

merged 3 commits into from
Sep 27, 2017

Conversation

CyberShadow
Copy link
Contributor

This implements enhancement request #2352.

The actual change is trivial:

 void tree_next(char way, orientation_t orientation) {
-    _tree_next(focused, way, orientation, true);
+    _tree_next(focused, way, orientation, config.focus_wrapping);
 }

The rest is bureaucracy. :)

@CyberShadow CyberShadow force-pushed the focus_wrapping branch 2 times, most recently from 6740654 to 72f6473 Compare September 15, 2017 03:22
@Airblader
Copy link
Member

The change looks good to me. I'm not a huge fan of having both focus_wrapping and force_focus_wrapping and would prefer a single forcus_wrapping yes|no|force instead; but removing force_focus_wrapping would be a breaking change.

@stapelberg How do you feel about that? We could do what we did in other places and add focus_wrapping force as an alias to force_focus_wrapping yes, focus the documentation on the new syntax and only keep a small mention of the old syntax for trackability when someone searches for it.

@stapelberg
Copy link
Member

@stapelberg How do you feel about that? We could do what we did in other places and add focus_wrapping force as an alias to force_focus_wrapping yes, focus the documentation on the new syntax and only keep a small mention of the old syntax for trackability when someone searches for it.

Sounds good!

# the configuration.
# Ticket: #2352
# Bug still in: 4.14-72-g6411130c
use List::Util qw(first);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this line, you’re not using first

docs/userguide Outdated
default behavior so you can navigate to all your windows without having to use
+focus parent+.
By default, when in a container with several windows or child containers, the
first container will be focused when you use +focus down+ / +focus left+ on the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realize you haven’t touched this, but I don’t quite see why we only mention “focus down / focus left”, when any directional focus command might trigger wrapping.

Maybe “try to move focus over the edge of a container” is a more accurate term?

@CyberShadow
Copy link
Contributor Author

Sorry for the delay - I got involved with another project which has been rather time-consuming. I hope to make time to get back to this soon.

We could do what we did in other places

What's an example option which has been changed in this way that I can use as a reference?

@Airblader
Copy link
Member

The special value 1pixel for border is an example.

Focus wrapping applies to all kinds of containers, not just
tabbed/stacked ones.
@CyberShadow
Copy link
Contributor Author

Thanks, feedback addressed. I wasn't sure if I should add a test for testing the new option names - let me know if I should.

Copy link
Member

@stapelberg stapelberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall!

@@ -203,6 +204,11 @@ state MOUSE_WARPING:
value = 'none', 'output'
-> call cfg_mouse_warping($value)

# focus_wrapping
state FOCUS_WRAPPING:
value = word
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using word, could you enumerate the possible values here? I.e. 1, yes, true, on, enable, active, 0, no, false, off, disable, inactive, force. That way, i3 can produce more useful error messages. Also, that way we can keep using strcmp instead of strcasecmp in CFGFUN(focus_wrapping).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Speaking of this, I noticed there doesn't seem to be any validation for boolean options, so e.g. enalbe will be silently parsed to false. I think there is room for improvement there too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed! Pull requests welcome.

Allow enabling forced focus wrapping by specifying "focus_wrapping
force" in i3's configuration. This syntax supersedes the previous
"force_focus_wrapping yes" one, which remains available for backwards
compatibility.
@stapelberg stapelberg merged commit 54d61b5 into i3:next Sep 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants