phenax / bsp-layout

Manage layouts in bspwm (tall and wide)
MIT License
373 stars 30 forks source link

The `bsp-layout` _listener_ prints empty lines to `stdout` #57

Open amtoine opened 2 years ago

amtoine commented 2 years ago

What did you expect to happen?

When i run bsp-layout {subcommand} especially bsp-layout set, i expect the command to either (1) print nothing to stdout if nothing has to be printed or (2) print useful information.

What actually happened?

When i run bsp-layout set tall 2, on first monitor, from desktop 4, on second monitor, and switch to desktop 2, bsp-layout prints empy lines to stdout

Here is a demo of the phenomenon!

Describe your attempts to resolve the issue

That looks like something buried in the code, so i think there is nothing to do from the user's perspective :yum:

Steps to reproduce

  1. open a terminal
  2. run bsp-layout set {layout} {some_desktop} (grid and even do not appear to have the problem)
  3. switch to some_desktop back and forth
  4. empty lines get printed to stdout in the original terminal

System Information

i've used make PREFIX=$PWD/build install to install bsp-layout

$ uname -osrm
Linux 5.18.5-arch1-1 x86_64 GNU/Linux
$ ./build/bin/bsp-layout version
0.0.10-1
f-ell commented 1 year ago

For the set-subcommand, this is caused by the fall-through case in the layout's option processing and affects all layouts that take options (i.e. all but even, grid, and rgrid).

[...] bsp-layout prints empy lines to stdout

The fall-through echoes a non-assigned variable x and an additional newline - see tall.sh, l. 16 for an example of the code in question. Repeated printing happens every time __recalculate_layout and thus run_layout is called inside the bspc-event listener (layout.sh, l. 159).

I'm not terribly familiar with the codebase, but would assume that this should print an invalid option error instead. Especially since I couldn't find a reference to x anywhere else.