i3-gaps: add as window manager

Closes #15917
This commit is contained in:
Franz Thoma 2016-05-30 23:33:15 +02:00 committed by obadz
parent b60b7eeaab
commit 688d7cd3a6

View File

@ -3,14 +3,10 @@
with lib; with lib;
let let
cfg = config.services.xserver.windowManager.i3; wmCfg = config.services.xserver.windowManager;
in
{
options = {
services.xserver.windowManager.i3 = {
enable = mkEnableOption "i3";
i3option = name: {
enable = mkEnableOption name;
configFile = mkOption { configFile = mkOption {
default = null; default = null;
type = types.nullOr types.path; type = types.nullOr types.path;
@ -20,20 +16,30 @@ in
''; '';
}; };
}; };
};
config = mkIf cfg.enable { i3config = name: pkg: cfg: {
services.xserver.windowManager = { services.xserver.windowManager.session = [{
session = [{ inherit name;
name = "i3";
start = '' start = ''
${pkgs.i3}/bin/i3 ${optionalString (cfg.configFile != null) ${pkg}/bin/i3 ${optionalString (cfg.configFile != null)
"-c \"${cfg.configFile}\"" "-c \"${cfg.configFile}\""
} & } &
waitPID=$! waitPID=$!
''; '';
}]; }];
environment.systemPackages = [ pkg ];
}; };
environment.systemPackages = with pkgs; [ i3 ];
in
{
options.services.xserver.windowManager = {
i3 = i3option "i3";
i3-gaps = i3option "i3-gaps";
}; };
config = mkMerge [
(mkIf wmCfg.i3.enable (i3config "i3" pkgs.i3 wmCfg.i3))
(mkIf wmCfg.i3-gaps.enable (i3config "i3-gaps" pkgs.i3-gaps wmCfg.i3-gaps))
];
} }