From 82f572050b832d1fd246bd8115128c184b081bd0 Mon Sep 17 00:00:00 2001 From: sefidel Date: Fri, 21 Jan 2022 23:33:10 +0900 Subject: zellij: provide default layout option --- home/modules/programs/zellij/default.nix | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'home') diff --git a/home/modules/programs/zellij/default.nix b/home/modules/programs/zellij/default.nix index cd048f8..1729768 100644 --- a/home/modules/programs/zellij/default.nix +++ b/home/modules/programs/zellij/default.nix @@ -1,12 +1,17 @@ { config, lib, pkgs, ... }: with lib; +with lib.types; let - cfg = config.programs.zellij; yamlFormat = pkgs.formats.yaml { }; + prim = oneOf [ bool int str ]; + primOrPrimAttrs = either prim (attrsOf prim); + entry = either prim (listOf primOrPrimAttrs); + entryOrAttrsOf = t: either entry (attrsOf t); + entries = entryOrAttrsOf (entryOrAttrsOf entry); in { meta.maintainers = with lib.maintainers; [ boppyt ]; @@ -22,15 +27,7 @@ in }; settings = mkOption { - type = with types; - let - prim = oneOf [ bool int str ]; - primOrPrimAttrs = either prim (attrsOf prim); - entry = either prim (listOf primOrPrimAttrs); - entryOrAttrsOf = t: either entry (attrsOf t); - entries = entryOrAttrsOf (entryOrAttrsOf entry); - in - attrsOf entries // { description = "zellij configuration"; }; + type = attrsOf entries // { description = "zellij configuration"; }; default = { }; description = '' Configuration written to @@ -45,6 +42,17 @@ in } ''; }; + + defaultLayout = mkOption { + type = attrsOf entries // { description = "zellij default pane layout"; }; + default = { }; + description = '' + Configuration written to + $XDG_CONFIG_HOME/zellij/layout/default.yaml. See + for a list of available options. + ''; + }; }; config = mkIf cfg.enable { @@ -54,5 +62,9 @@ in xdg.configFile."zellij/config.yaml" = mkIf (cfg.settings != { }) { source = yamlFormat.generate "zellij-config" cfg.settings; }; + + xdg.configFile."zellij/layout/default.yaml" = mkIf (cfg.defaultLayout != { }) { + source = yamlFormat.generate "zellij-layout" cfg.defaultLayout; + }; }; } -- cgit 1.4.1