kitty now changes color scheme inside of nix-shell

This commit is contained in:
2024-11-24 14:25:17 -05:00
parent 836f24d416
commit ebe5b4d8df
9 changed files with 103 additions and 40 deletions

View File

@@ -12,7 +12,7 @@
right_format = "($custom)";
format = lib.concatStrings [
"($ssh_symbol)($username)($hostname)(bold white)($cmd_duration)($character)"
"($ssh_symbol)($username)($hostname)($nix_shell)(bold white)($cmd_duration)($character)"
"($git_branch)($git_status)($rust)($nix-shell)"
"($directory)"
"$line_break[ > ](bold #89b4fa)"
@@ -59,6 +59,11 @@
format = "[@](bold blue)[$hostname](bold red)";
};
nix_shell = {
format = " via [$symbol]($style)";
symbol = " ";
};
custom.shellver = {
command = "zsh --version";
when = ''test $SHELL = "/run/current-system/sw/bin/zsh"'';

View File

@@ -48,6 +48,7 @@ in {
gtrash
ripgrep
toilet
vkbasalt
] ++ scripts;
};
}

View File

@@ -20,6 +20,11 @@ in
export RESULT
echo "\$RESULT = $RESULT"
}
nix-shell() {
# set an environment variable to track if you're in a nix shell or not
trap 'NIX_SHELL=false kitty_theme' EXIT
NIX_SHELL=true command nix-shell "$@" --run zsh
}
nvim() {
${shellsound} ${sndpath}/nvim.wav
command nvim "$@"
@@ -29,9 +34,11 @@ in
command ssh "$@"
kitty_ssh_theme
}
kitty_ssh_theme() {
kitty_theme() {
if [ -n "$SSH_CONNECTION" ]; then
kitty @ set-colors -a ~/.config/kitty/ssh-theme.conf
elif [ "$name" = "nix-shell-env" ] || [ "$NIX_SHELL" = "true" ]; then
kitty @ set-colors -a ~/.config/kitty/nix-shell-theme.conf
else
kitty @ set-colors -a ~/.config/kitty/default-theme.conf
fi
@@ -154,7 +161,7 @@ in
autoload -U down-line-or-beginning-search; zle -N down-line-or-beginning-search
bindkey -v
kitty_ssh_theme
kitty_theme
type starship_zle-keymap-select >/dev/null || \
{
eval "$(starship init zsh)"