{ config, lib, ... }: with lib; let cfg = config.eboskma.programs.zellij; placeholders = [ "@COPY_COMMAND@" "@SCROLLBACK_EDITOR@" ]; replacements = [ cfg.copyCommand "${config.eboskma.programs.emacs.package}/bin/emacsclient" ]; configKdl = builtins.replaceStrings placeholders replacements (builtins.readFile ./config.kdl); in { options.eboskma.programs.zellij = { enable = mkEnableOption "zellij"; copyCommand = mkOption { description = "Command used to copy a selection"; type = types.str; example = literalExpression ''"''${pkgs.wl-clipboard}/bin/wl-copy"''; }; }; config = mkIf cfg.enable { assertions = [ { assertion = (builtins.length placeholders) == (builtins.length replacements); message = "Placeholders and replacements should be of equal length"; } ]; xdg.configFile."zellij/config.kdl".text = configKdl; programs.zellij = { enable = true; # settings = { # theme = "dracula"; # copy_command = cfg.copyCommand; # scrollback_editor = "${config.eboskma.programs.emacs.package}/bin/emacsclient"; # pane_frames = false; # default_layout = "compact"; # themes = { # dracula = { # fg = [ 248 248 242 ]; # bg = [ 40 42 54 ]; # black = [ 0 0 0 ]; # red = [ 255 85 85 ]; # green = [ 80 250 123 ]; # yellow = [ 241 250 140 ]; # blue = [ 98 114 164 ]; # magenta = [ 255 121 198 ]; # cyan = [ 139 233 253 ]; # white = [ 255 255 255 ]; # orange = [ 255 184 108 ]; # }; # }; # keybinds = { # normal = [ # { # unbind = [ # { Alt = "l"; } # { Alt = "j"; } # { Alt = "k"; } # { Ctrl = "n"; } # { Ctrl = "b"; } # ]; # } # { # action = [{ SwitchToMode = "Resize"; }]; # key = [{ Ctrl = "m"; }]; # } # { # action = [{ MoveFocusOrTab = "Left"; }]; # key = [{ Alt = "h"; } { Alt = "Left"; }]; # } # { # action = [{ MoveFocusOrTab = "Right"; }]; # key = [{ Alt = "i"; } { Alt = "Right"; }]; # } # { # action = [{ MoveFocus = "Down"; }]; # key = [{ Alt = "n"; } { Alt = "Down"; }]; # } # { # action = [{ MoveFocus = "Up"; }]; # key = [{ Alt = "e"; } { Alt = "Up"; }]; # } # { # action = [{ NewPane = null; }]; # key = [{ Alt = "c"; }]; # } # ]; # resize = [ # { # unbind = [ # { Char = "l"; } # { Char = "j"; } # { Char = "k"; } # { Alt = "l"; } # { Alt = "j"; } # { Alt = "k"; } # { Ctrl = "b"; } # ]; # } # { # action = [{ Resize = "Left"; }]; # key = [{ Char = "h"; } "Left"]; # } # { # action = [{ Resize = "Right"; }]; # key = [{ Char = "i"; } "Right"]; # } # { # action = [{ Resize = "Down"; }]; # key = [{ Char = "n"; } "Down"]; # } # { # action = [{ Resize = "Up"; }]; # key = [{ Char = "e"; } "Up"]; # } # { # action = [{ MoveFocusOrTab = "Left"; }]; # key = [{ Alt = "h"; } { Alt = "Left"; }]; # } # { # action = [{ MoveFocusOrTab = "Right"; }]; # key = [{ Alt = "i"; } { Alt = "Right"; }]; # } # { # action = [{ MoveFocus = "Down"; }]; # key = [{ Alt = "n"; } { Alt = "Down"; }]; # } # { # action = [{ MoveFocus = "Up"; }]; # key = [{ Alt = "e"; } { Alt = "Up"; }]; # } # ]; # pane = [ # { # unbind = [ # { Char = "l"; } # { Char = "j"; } # { Char = "k"; } # { Char = "n"; } # { Alt = "l"; } # { Alt = "j"; } # { Alt = "k"; } # { Char = "f"; } # { Ctrl = "n"; } # { Ctrl = "b"; } # ]; # } # { # action = [{ SwitchToMode = "Resize"; }]; # key = [{ Ctrl = "m"; }]; # } # { # action = [{ MoveFocus = "Left"; }]; # key = [{ Char = "h"; } "Left"]; # } # { # action = [{ MoveFocus = "Right"; }]; # key = [{ Char = "i"; } "Right"]; # } # { # action = [{ MoveFocus = "Down"; }]; # key = [{ Char = "n"; } "Down"]; # } # { # action = [{ MoveFocus = "Up"; }]; # key = [{ Char = "e"; } "Up"]; # } # { # action = [{ NewPane = null; } { SwitchToMode = "Normal"; }]; # key = [{ Char = "c"; }]; # } # { # action = [ "TogglePaneFrames" { SwitchToMode = "Normal"; } ]; # key = [{ Char = "z"; }]; # } # { # action = [ "ToggleFloatingPanes" { SwitchToMode = "Normal"; } ]; # key = [{ Char = "w"; }]; # } # { # action = [ "TogglePaneEmbedOrFloating" { SwitchToMode = "Normal"; } ]; # key = [{ Char = "f"; }]; # } # { # action = [{ NewPane = null; }]; # key = [{ Alt = "c"; }]; # } # { # action = [{ MoveFocusOrTab = "Left"; }]; # key = [{ Alt = "h"; } { Alt = "Left"; }]; # } # { # action = [{ MoveFocusOrTab = "Right"; }]; # key = [{ Alt = "i"; } { Alt = "Right"; }]; # } # { # action = [{ MoveFocus = "Down"; }]; # key = [{ Alt = "n"; } { Alt = "Down"; }]; # } # { # action = [{ MoveFocus = "Up"; }]; # key = [{ Alt = "e"; } { Alt = "Up"; }]; # } # { # action = [{ SwitchToMode = "RenamePane"; } { PaneNameInput = [ 0 ]; }]; # key = [{ Char = "m"; }]; # } # ]; # move = [ # { # unbind = [ # { Char = "l"; } # { Char = "j"; } # { Char = "k"; } # { Alt = "l"; } # { Alt = "j"; } # { Alt = "k"; } # { Char = "n"; } # { Ctrl = "n"; } # ]; # } # { # action = [{ SwitchToMode = "Resize"; }]; # key = [{ Ctrl = "m"; }]; # } # { # action = [{ MovePane = null; }]; # key = [{ Char = "c"; }]; # } # { # action = [{ MovePane = "Left"; }]; # key = [{ Char = "h"; } "Left"]; # } # { # action = [{ MovePane = "Right"; }]; # key = [{ Char = "i"; } "Right"]; # } # { # action = [{ MovePane = "Down"; }]; # key = [{ Char = "n"; } "Down"]; # } # { # action = [{ MovePane = "Up"; }]; # key = [{ Char = "e"; } "Up"]; # } # { # action = [{ NewPane = null; }]; # key = [{ Alt = "c"; }]; # } # { # action = [{ MoveFocusOrTab = "Left"; }]; # key = [{ Alt = "h"; } { Alt = "Left"; }]; # } # { # action = [{ MoveFocusOrTab = "Right"; }]; # key = [{ Alt = "i"; } { Alt = "Right"; }]; # } # { # action = [{ MoveFocus = "Down"; }]; # key = [{ Alt = "n"; } { Alt = "Down"; }]; # } # { # action = [{ MoveFocus = "Up"; }]; # key = [{ Alt = "e"; } { Alt = "Up"; }]; # } # ]; # tab = [ # { # unbind = [ # { Char = "l"; } # { Char = "j"; } # { Char = "k"; } # { Alt = "l"; } # { Alt = "j"; } # { Alt = "k"; } # { Char = "n"; } # { Ctrl = "n"; } # { Ctrl = "b"; } # ]; # } # { # action = [{ SwitchToMode = "Resize"; }]; # key = [{ Ctrl = "m"; }]; # } # { # action = [ "GoToPreviousTab" ]; # key = [{ Char = "h"; } "Left" "Up" { Char = "e"; }]; # } # { # action = [ "GoToNextTab" ]; # key = [{ Char = "i"; } "Right" "Down" { Char = "n"; }]; # } # { # action = [{ NewTab = null; } { SwitchToMode = "Normal"; }]; # key = [{ Char = "c"; }]; # } # { # action = [{ NewPane = null; }]; # key = [{ Alt = "c"; }]; # } # { # action = [{ MoveFocusOrTab = "Left"; }]; # key = [{ Alt = "h"; } { Alt = "Left"; }]; # } # { # action = [{ MoveFocusOrTab = "Right"; }]; # key = [{ Alt = "i"; } { Alt = "Right"; }]; # } # { # action = [{ MoveFocus = "Down"; }]; # key = [{ Alt = "n"; } { Alt = "Down"; }]; # } # { # action = [{ MoveFocus = "Up"; }]; # key = [{ Alt = "e"; } { Alt = "Up"; }]; # } # ]; # scroll = [ # { # unbind = [ # { Char = "l"; } # { Char = "j"; } # { Char = "k"; } # { Alt = "l"; } # { Alt = "j"; } # { Alt = "k"; } # { Ctrl = "n"; } # { Ctrl = "b"; } # ]; # } # { # action = [{ SwitchToMode = "Resize"; }]; # key = [{ Ctrl = "m"; }]; # } # { # action = [ "EditScrollback" { SwitchToMode = "Normal"; } ]; # key = [{ Char = "a"; }]; # } # { # action = [ "ScrollDown" ]; # key = [{ Char = "n"; } "Down"]; # } # { # action = [ "ScrollUp" ]; # key = [{ Char = "e"; } "Up"]; # } # { # action = [ "PageScrollDown" ]; # key = [{ Ctrl = "f"; } "PageDown" "Right" { Char = "i"; }]; # } # { # action = [ "PageScrollUp" ]; # key = [{ Ctrl = "b"; } "PageUp" "Left" { Char = "h"; }]; # } # { # action = [{ NewPane = null; }]; # key = [{ Alt = "c"; }]; # } # { # action = [{ MoveFocusOrTab = "Left"; }]; # key = [{ Alt = "h"; } { Alt = "Left"; }]; # } # { # action = [{ MoveFocusOrTab = "Right"; }]; # key = [{ Alt = "i"; } { Alt = "Right"; }]; # } # { # action = [{ MoveFocus = "Down"; }]; # key = [{ Alt = "n"; } { Alt = "Down"; }]; # } # { # action = [{ MoveFocus = "Up"; }]; # key = [{ Alt = "e"; } { Alt = "Up"; }]; # } # { # action = [{ SwitchToMode = "EnterSearch"; } { SearchInput = [ 0 ]; }]; # key = [{ Char = "s"; }]; # } # ]; # entersearch = [ # { # unbind = [ # { Char = "l"; } # { Char = "j"; } # { Char = "k"; } # { Alt = "l"; } # { Alt = "j"; } # { Alt = "k"; } # { Char = "e"; } # { Ctrl = "c"; } # ]; # } # { # action = [{ SearchInput = [ 27 ]; } { SwitchToMode = "Scroll"; }]; # key = [{ Ctrl = "s"; } "Esc"]; # } # { # action = [{ NewPane = null; }]; # key = [{ Alt = "c"; }]; # } # { # action = [{ MoveFocusOrTab = "Left"; }]; # key = [{ Alt = "h"; } { Alt = "Left"; }]; # } # { # action = [{ MoveFocusOrTab = "Right"; }]; # key = [{ Alt = "i"; } { Alt = "Right"; }]; # } # { # action = [{ MoveFocus = "Down"; }]; # key = [{ Alt = "n"; } { Alt = "Down"; }]; # } # { # action = [{ MoveFocus = "Up"; }]; # key = [{ Alt = "e"; } { Alt = "Up"; }]; # } # ]; # search = [ # { # unbind = [ # { Char = "l"; } # { Char = "j"; } # { Char = "k"; } # { Alt = "l"; } # { Alt = "j"; } # { Alt = "k"; } # { Ctrl = "c"; } # { Ctrl = "n"; } # { Char = "p"; } # { Ctrl = "b"; } # ]; # } # { # action = [{ SwitchToMode = "Resize"; }]; # key = [{ Ctrl = "m"; }]; # } # { # action = [ "ScrollDown" ]; # key = [{ Char = "n"; } "Down"]; # } # { # action = [ "ScrollUp" ]; # key = [{ Char = "e"; } "Up"]; # } # { # action = [ "PageScrollDown" ]; # key = [{ Ctrl = "f"; } "PageDown" "Right" { Char = "i"; }]; # } # { # action = [ "PageScrollUp" ]; # key = [{ Ctrl = "b"; } "PageUp" "Left" { Char = "h"; }]; # } # { # action = [{ NewPane = null; }]; # key = [{ Alt = "c"; }]; # } # { # action = [{ MoveFocusOrTab = "Left"; }]; # key = [{ Alt = "h"; } { Alt = "Left"; }]; # } # { # action = [{ MoveFocusOrTab = "Right"; }]; # key = [{ Alt = "i"; } { Alt = "Right"; }]; # } # { # action = [{ MoveFocus = "Down"; }]; # key = [{ Alt = "n"; } { Alt = "Down"; }]; # } # { # action = [{ MoveFocus = "Up"; }]; # key = [{ Alt = "e"; } { Alt = "Up"; }]; # } # { # action = [{ Search = "Down"; }]; # key = [{ Char = "k"; }]; # } # { # action = [{ Search = "Up"; }]; # key = [{ Char = "j"; }]; # } # ]; # renametab = [ # { # unbind = [ # { Alt = "l"; } # { Alt = "j"; } # { Alt = "k"; } # ]; # } # { # action = [{ NewPane = null; }]; # key = [{ Alt = "c"; }]; # } # { # action = [{ MoveFocusOrTab = "Left"; }]; # key = [{ Alt = "h"; } { Alt = "Left"; }]; # } # { # action = [{ MoveFocusOrTab = "Right"; }]; # key = [{ Alt = "i"; } { Alt = "Right"; }]; # } # { # action = [{ MoveFocus = "Down"; }]; # key = [{ Alt = "n"; } { Alt = "Down"; }]; # } # { # action = [{ MoveFocus = "Up"; }]; # key = [{ Alt = "e"; } { Alt = "Up"; }]; # } # ]; # renamepane = [ # { # unbind = [ # { Alt = "l"; } # { Alt = "j"; } # { Alt = "k"; } # ]; # } # { # action = [{ NewPane = null; }]; # key = [{ Alt = "c"; }]; # } # { # action = [{ MoveFocusOrTab = "Left"; }]; # key = [{ Alt = "h"; } { Alt = "Left"; }]; # } # { # action = [{ MoveFocusOrTab = "Right"; }]; # key = [{ Alt = "i"; } { Alt = "Right"; }]; # } # { # action = [{ MoveFocus = "Down"; }]; # key = [{ Alt = "n"; } { Alt = "Down"; }]; # } # { # action = [{ MoveFocus = "Up"; }]; # key = [{ Alt = "e"; } { Alt = "Up"; }]; # } # ]; # session = [ # { # unbind = [ # { Alt = "l"; } # { Alt = "j"; } # { Alt = "k"; } # { Ctrl = "n"; } # { Ctrl = "b"; } # ]; # } # { # action = [{ SwitchToMode = "Resize"; }]; # key = [{ Ctrl = "m"; }]; # } # { # action = [{ NewPane = null; }]; # key = [{ Alt = "c"; }]; # } # { # action = [{ MoveFocusOrTab = "Left"; }]; # key = [{ Alt = "h"; } { Alt = "Left"; }]; # } # { # action = [{ MoveFocusOrTab = "Right"; }]; # key = [{ Alt = "i"; } { Alt = "Right"; }]; # } # { # action = [{ MoveFocus = "Down"; }]; # key = [{ Alt = "n"; } { Alt = "Down"; }]; # } # { # action = [{ MoveFocus = "Up"; }]; # key = [{ Alt = "e"; } { Alt = "Up"; }]; # } # ]; # tmux = [ # { # unbind = true; # } # ]; # }; # }; }; }; }