Bspwm setup declaratively

Is there a way to declarative setup bspwm, without pointing to a config file? I’m using flakes and want to have all “configs” within the flakes

Is this not ok?

services.xserver.windowManager.bspwm.configFile = pkgs.writeText "bspwmrc"
  ''
    bspc config borderless_monocle    true
    bspc config gapless_monocle       true
    bspc config focus_follows_pointer true
    # ...
  '';

That will work, how would you do it with rules?

External rules, I presume. You could just add

  bspc config external_rules_command ${pkgs.writeText "rules"
  ''
    ...
  ''}

but it would probably be handier to store bspmwrc rules in a subdirectory and do:

# bspwm/bspwmrc
bspc config external_rules_command "$(dirname "$0")/rules"

# bspwm/rules
# ...

# configuration.nix
services.xserver.windowManager.bspwm.configFile = "${./bspwm}/bspwmrc";

thank you, will make this work

I might be doing something wrong, but it aint using the config file.
setup

and this is my bspwmrc

Ah, I think bspwm requires those files to be executable (chmod +x). If you go for the first solution you’d be better using pkgs.writeShellScript.

I moved the config to home-manager and now it works…
except only have one workspace…

my new config

I cannot see anything wrong on why only one workspace?