Cloudef / orbment

Modular Wayland compositor
Other
246 stars 16 forks source link

mod left/right to rotate space focus mask #119

Closed upwhere closed 9 years ago

upwhere commented 9 years ago

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:

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 commented 9 years ago

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 keycb 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 commented 9 years ago

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 commented 9 years ago

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 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