home/wm: simplify xmonad project settings
This commit is contained in:
parent
b02bcdd82d
commit
6f7991184d
2 changed files with 28 additions and 5 deletions
|
@ -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
|
||||
}
|
||||
'';
|
||||
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue