alex-courtis / wideriver

GNU General Public License v3.0
25 stars 3 forks source link

Custom border width when smart gaps hides gaps #11

Closed senkowo closed 1 month ago

senkowo commented 1 month ago

Missing behavior

Making the border width thinner or non-existent when smart gaps activates/hides gaps, bringing an appearance more like monocle mode. To exemplify, if wideriver is ran with the args --border-width 2 --border-width-monocle 0 --smart-gaps and if only one view is present, then when in the monocle layout, there are no borders and the one view takes up the full screen. Meanwhile, if in any other layout with only one view present, there is a thick 2 pixel border that surrounds the one view taking up the full screen. It would be nice if this border could be made thinner or non-existent when in this specific situation (smart gaps && only one view && not monocle mode).

Desired solution

A new command line argument that sets a border width for when smart gaps activates/hides gaps (in layouts other than monocle). An argument like --border-width-smart-gaps <pixels>, where its value has no effect if --no-smart-gaps. Some alternative solutions (although less desirable): a boolean argument that causes the smart gaps border width to be inherited from the value of --border-width-monocle. Or one that simply sets the border width to 0.

Ideas

I made a fork and modified the source code to where it always inherits the value for --border-width-monocle if (view_count == 1 && tag->smart_gaps) at https://github.com/senkowo/wideriver-fork and it seems to be working just fine (I implemented the second of the three solutions I proposed since it's the easiest to implement). If it seems reasonable, maybe the first proposed solution could be implemented based on the change that I made to the fork. I'm not the best at C so I don't trust myself with implementing the rest just yet, but may in the future. It's also my first time ever making a feature/pull request so let me know if there's anything else I should do/know.

Thanks!

alex-courtis commented 1 month ago

That's a fantastic idea - it is indeed very jarring when toggling between monocle and tiled.

The solution looks great, I'd be really grateful for a pull request, see CONTRIBUTING.md for instructions on setup, testing etc.

I'm happy to help you with documentation, tests etc. when you raise the PR - it doesn't have to be perfect.

Implementation plan:

  1. add the new argument to args.c
  2. test the new argument via args_parse_cli__valid
  3. add the boolean setting to Cfg
  4. apply it as you have done in displ.c
  5. add --help and man entry