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

mod left/right to rotate space focus mask #119

Merged
merged 1 commit into from
Aug 15, 2015
Merged

mod left/right to rotate space focus mask #119

merged 1 commit into from
Aug 15, 2015

Conversation

upwhere
Copy link
Contributor

@upwhere upwhere commented Aug 14, 2015

Basically provides easy access to the spaces n-1 and n+1 from space n. No problems going over the boundary between the highest-numbered space and the lowest-numbered space.

Any funky space masks that might be used are preserved as the whole thing is just shifted slightly.

Not so proud of:

  • Hardcoded to 10 spaces, will require separate attention (changing a variable in a function) if users want to change this.
  • Due to the use of some (one?) functions in core_functionality, is written in core_functionality. May not be desirable?
  • Uses two key_cb_ handlers, not sure what style reccomendations say about that...
  • Not ideal algorithm for shifting with an offset that isn't 1, but works.
  • Default set to the left- and right-arrow key which are terrible because they take your hands off the home row but I don't understand the keycodes well enough to program something better.

I had done the same thing way way back before plugins came around and I use it a lot, putting some related programs in the left- or right screen you can more quickly switch between them than trying to remember and hit the correct number.

@Cloudef
Copy link
Owner

Cloudef commented Aug 14, 2015

Hardcoded to 10 spaces, will require separate attention (changing a variable in a function) if users want to change this.

Commented this on the commit.

Due to the use of some (one?) functions in core_functionality, is written in core_functionality. May not be desirable?

This is a perfectly good core-functionality feature.

Uses two key_cb_ handlers, not sure what style reccomendations say about that...

That's only way right now, since the keybindings right now are backwards (you can't give them arguments).

Default set to the left- and right-arrow key which are terrible because they take your hands off the home row but I don't understand the keycodes well enough to program something better.

The defaults are not very well thought out at the moment anyways. For switching workspace I think that's reasonable default though. Key handling is supposed to change as well, it fails at certain scenarios.

About the PR:
You should be simply able to shift the bit right or left. Instead you seem to do some complicated bit twiddling, I look at it later more closely. Of course the wlc api itself allows multiple masks to be active (similar to dwm tags), but orbment for now does not have concept of tags, and not sure if that should be handled. Even then bit shifting is defined behavior (move all tags to right or left).

@upwhere
Copy link
Contributor Author

upwhere commented Aug 14, 2015

The reason I use 10 spaces instead of 32 is because you can only reach 10 spaces with the focus space x keys. You could just use something with sizeof and <limits.h> to get the 32. This is a detail that belongs to orbment and how many of those spaces it exposes to the user, hotkeys for all 32 spaces would probably not be a great idea!

The reason I do more than just shift is to preserve the bits that fall out at either end. I accounted for wlc's multiple masks so that any existing/future plugins that rely on it aren't inconvenienced here.

I'll take it functionality like requested in #16 is also core-functionality then.

@Cloudef
Copy link
Owner

Cloudef commented Aug 14, 2015

The reason I use 10 spaces instead of 32 is because you can only reach 10 spaces with the focus space x

Fair enough, it might be nice to add static variable in the core-functionality.c to configure this though.

You could just use something with sizeof and <limits.h> to get the 32.

The latter still needs to know what type wlc uses (For now it uses uint32_t, but that might not be true in year 2030)

I'll take it functionality like requested in #16 is also core-functionality then.

By default orbment will not do tags. If plugin that would bring tags conflicts with core-functionality, the workspace part from core-functionality should be split to core-workspace or something.

The reason I do more than just shift is to preserve the bits that fall out at either end. I accounted for wlc's multiple masks so that any existing/future plugins that rely on it aren't inconvenienced here.

You could use bitwise rotation https://en.wikipedia.org/wiki/Circular_shift with a mask to effectively attain a bitwise rotation with a modulo parameter. I wrote example here https://gist.github.com/Cloudef/7dbd884bace1aa29cf6e

Cloudef added a commit that referenced this pull request Aug 15, 2015
mod left/right to rotate space focus mask
@Cloudef Cloudef merged commit ba47a25 into Cloudef:master Aug 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants