diff --git a/home/modules/window_manager/xmonad.nix b/home/modules/window_manager/xmonad.nix index 1292284..e14a742 100644 --- a/home/modules/window_manager/xmonad.nix +++ b/home/modules/window_manager/xmonad.nix @@ -9,18 +9,41 @@ let name = mkOption { type = types.str; }; - startHook = mkOption { - type = types.lines; + workdir = mkOption { + type = types.str; + }; + windowCount = mkOption { + type = types.ints.positive; + default = 1; + }; + terminalCommands = mkOption { + type = types.listOf types.str; + default = [ ]; + }; + spawnPrograms = mkOption { + type = types.listOf types.str; + default = [ ]; }; }; - }; - mkXmonadProject = { name, startHook }: + mkXmonadProjectSpawnProgram = program: + "spawn \"${program}\""; + + mkXmonadProjectTerminalCommand = command: + "spawn $ terminal' workdir $ Just \"${command}\""; + + + mkXmonadProject = { name, workdir, windowCount, spawnPrograms, terminalCommands }: '' Project { projectName = "${name}", - projectStartHook = ${startHook} + projectStartHook = + do + let workdir = "${workdir}" + ${lib.concatStringsSep "\n" (map mkXmonadProjectSpawnProgram spawnPrograms)} + ${lib.concatStringsSep "\n" (map mkXmonadProjectTerminalCommand terminalCommands)} + replicateM_ ${toString windowCount} $ spawn $ terminal workdir } ''; diff --git a/nixos/hosts/home/xmonad_projects.secret.nix b/nixos/hosts/home/xmonad_projects.secret.nix index da2efea..8134346 100644 Binary files a/nixos/hosts/home/xmonad_projects.secret.nix and b/nixos/hosts/home/xmonad_projects.secret.nix differ