ZaneA / HashTWM

An automatic Tiling Window Manager for the Windows OS.
Other
459 stars 33 forks source link

Mod + space doesn't cycle through all available tiling modes #16

Closed cparadis6191 closed 9 years ago

cparadis6191 commented 9 years ago

There are four tiling modes listed in the README.md: vertical, horizontal, grid, and fullscreen. These can all be accessed with the -t flag but when cycling with the mod + space binding it only cycles through three of them (fullscreen can't be accessed by cycling).

This line with the modulo looks to me to be the problem. Changing that to a four should fix it. I'm assuming this problem popped up when a new tiling mode was added so a better way to fix it might be something like the following:

// Tiling modes
enum tiling_modes {
  MODE_VERTICAL = 0,
  MODE_HORIZONTAL,
  MODE_GRID,
  MODE_FULLSCREEN,
  // Keep this at the end if adding tiling modes
  MODE_END
};

and changing the modulo to

tags[current_tag].tilingMode = (tags[current_tag].tilingMode + 1) % (MODE_END - 1);

This way adding or removing a tiling mode won't break cycling. I'd do a pull request but I don't have the compiler set up so I can't test it properly. Thanks for your time.

ZaneA commented 9 years ago

Hey, sorry I'm horrendous at maintaining my repos! I've implemented your fix above, though had to use MODE_END as opposed to (MODE_END - 1). But now it is possible to switch to fullscreen mode as intended. Thanks for your help :)