nixos-config/home-manager/modules/zellij/default.nix

604 lines
17 KiB
Nix
Raw Permalink Normal View History

{ config, lib, ... }:
2022-10-14 21:49:57 +02:00
with lib;
let
cfg = config.eboskma.programs.zellij;
2024-02-05 11:46:52 +01:00
placeholders = [
"@COPY_COMMAND@"
"@SCROLLBACK_EDITOR@"
];
replacements = [
cfg.copyCommand
"${config.eboskma.programs.emacs.package}/bin/emacsclient"
];
configKdl = builtins.replaceStrings placeholders replacements (builtins.readFile ./config.kdl);
2022-10-14 21:49:57 +02:00
in
{
2022-11-17 14:06:39 +01:00
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"'';
};
};
2022-10-14 21:49:57 +02:00
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;
2022-10-14 21:49:57 +02:00
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";
2022-10-14 21:49:57 +02:00
# 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 ];
# };
# };
2022-10-30 21:06:40 +01:00
# 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"; }];
# }
# ];
2022-10-14 21:49:57 +02:00
# 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"; }];
# }
# ];
2022-10-14 21:49:57 +02:00
# 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"; }];
# }
# ];
2022-10-14 21:49:57 +02:00
# 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"; }];
# }
# ];
2022-10-14 21:49:57 +02:00
# 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"; }];
# }
# ];
2022-10-14 21:49:57 +02:00
# 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"; }];
# }
# ];
2022-10-14 21:49:57 +02:00
# 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"; }];
# }
# ];
2022-10-14 21:49:57 +02:00
# 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"; }];
# }
# ];
2022-10-14 21:49:57 +02:00
# 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"; }];
# }
# ];
2022-10-14 21:49:57 +02:00
# tmux = [
# {
# unbind = true;
# }
# ];
# };
# };
2022-10-14 21:49:57 +02:00
};
};
}