This commit is contained in:
Manuel 2024-04-30 22:56:27 -05:00 committed by GitHub
commit e76f48848b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 58 additions and 6 deletions

View File

@ -485,6 +485,12 @@
keys =
[{ fingerprint = "75F0 AB7C FE01 D077 AEE6 CAFD 353E 4A18 EE0F AB72"; }];
};
tennox = {
name = "Manu";
github = "tennox";
githubId = 2084639;
matrix = "@tennox:matrix.org";
};
tensor5 = {
github = "tensor5";
githubId = 1545895;

View File

@ -9,7 +9,7 @@ let
zellijCmd = getExe cfg.package;
in {
meta.maintainers = [ hm.maintainers.mainrs ];
meta.maintainers = with hm.maintainers; [ mainrs tennox ];
options.programs.zellij = {
enable = mkEnableOption "zellij";
@ -49,9 +49,28 @@ in {
default = false;
};
enableFishIntegration = mkEnableOption "Fish integration" // {
enableFishIntegration = mkEnableOption
"Fish integration (enables both enableFishAutoStart and enableFishCompletions)"
// {
default = false;
};
enableFishCompletions = mkEnableOption "load zellij completions" // {
default = false;
};
enableFishAutoStart =
mkEnableOption "autostart zellij in interactive sessions" // {
default = false;
};
autoStartAttachIfSessionExists = mkEnableOption
"If the zellij session already exists, attach to the default session. (requires enableFishAutoStart)"
// {
default = false;
};
autoStartExitShellOnZellijExit = mkEnableOption
"When zellij exits, exit the shell as well. (requires enableFishAutoStart)"
// {
default = false;
};
};
config = mkIf cfg.enable {
@ -77,9 +96,22 @@ in {
eval "$(${zellijCmd} setup --generate-auto-start zsh)"
'');
programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration
(mkOrder 200 ''
eval (${zellijCmd} setup --generate-auto-start fish | string collect)
'');
home.sessionVariables = {
ZELLIJ_AUTO_ATTACH =
if cfg.autoStartAttachIfSessionExists then "true" else "false";
ZELLIJ_AUTO_EXIT =
if cfg.autoStartExitShellOnZellijExit then "true" else "false";
};
programs.fish.interactiveShellInit = mkIf (cfg.enableFishIntegration
|| cfg.enableFishAutoStart || cfg.enableFishCompletions) (mkOrder 200
((if cfg.enableFishIntegration || cfg.enableFishCompletions then ''
eval (${zellijCmd} setup --generate-completion fish | string collect)
'' else
"") + (if cfg.enableFishIntegration || cfg.enableFishAutoStart then ''
eval (${zellijCmd} setup --generate-auto-start fish | string collect)
'' else
"")));
};
}

View File

@ -7,6 +7,10 @@
enableBashIntegration = true;
enableZshIntegration = true;
enableFishIntegration = true;
enableFishAutoStart = true;
enableFishCompletions = true;
autoStartAttachIfSessionExists = true;
autoStartExitShellOnZellijExit = true;
};
bash.enable = true;
zsh.enable = true;
@ -37,5 +41,15 @@
assertFileContains \
home-files/.config/fish/config.fish \
'eval (@zellij@/bin/dummy setup --generate-auto-start fish | string collect)'
assertFileContains \
home-files/.config/fish/config.fish \
'eval (@zellij@/bin/dummy setup --generate-completion fish | string collect)'
assertFileExists home-path/etc/profile.d/hm-session-vars.sh
assertFileContains \
home-path/etc/profile.d/hm-session-vars.sh \
'export ZELLIJ_AUTO_ATTACH="true"'
assertFileContains \
home-path/etc/profile.d/hm-session-vars.sh \
'export ZELLIJ_AUTO_EXIT="true"'
'';
}