From 66ef93c612f5a0c04d3d0f38eadafbf816f8c9b3 Mon Sep 17 00:00:00 2001 From: "Lennart J. Kurzweg (Nx2)" Date: Tue, 27 Jan 2026 16:45:54 +0100 Subject: [PATCH] clone yazi --- home-modules/fish.nix | 18 +++++++++++++++--- home-modules/yazi.nix | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/home-modules/fish.nix b/home-modules/fish.nix index 367c8d6..39c6602 100644 --- a/home-modules/fish.nix +++ b/home-modules/fish.nix @@ -96,7 +96,9 @@ interactiveShellInit = /* fish */ '' set -g fish_greeting if not set -q IN_NIX_SHELL - if set -q SESSION_FROM_DE + if set -q SESSION_FROM_DE; or set -q SESSION_CLONED_FROM_YAZI + set -e SESSION_FROM_DE + set -e SESSION_CLONED_FROM_YAZI set tmp (mktemp -t "yazi-cwd.XXXXX") yazi --cwd-file="$tmp" ~ if set cwd (cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ] @@ -105,7 +107,6 @@ rm -f -- "$tmp" end nxfetch - set -e SESSION_FROM_DE end ''; functions = { @@ -115,10 +116,21 @@ ''; nx_backup = let destination = if hyper.host == "NxNORTH" then "${hyper.home}/shared/" else "${hyper.home}/backups/"; - in pkgs.lib.mkIf (hyper.isPersonal) '' + in pkgs.lib.mkIf (hyper.isPersonal) /* fish */ '' set RPATH (curl -s https://${hyper.domain}/latest-backup) rsync -avz --info=progress2 -e "ssh -p ${builtins.toString secrets.ssh.port}" ${hyper.user}@ssh.${hyper.domain}:"$RPATH" ${destination} ''; + nx_yazi_into_fish = /* fish */ '' + set tmp (mktemp -t "yazi-cwd.XXXXX") + echo "$PWD" > "$tmp" + yazi --cwd-file="$tmp" + if set cwd (cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ] + builtin cd -- "$cwd" + end + rm -f "$tmp" + set -g SESSION_CLONED_FROM_YAZI TRUE + ''; + # gpg = ''; # set bold \e[1m # set green \e[32m diff --git a/home-modules/yazi.nix b/home-modules/yazi.nix index dc633c3..2aff87d 100644 --- a/home-modules/yazi.nix +++ b/home-modules/yazi.nix @@ -163,7 +163,7 @@ in { # Magic { on = ""; run = "shell 'hx .' --block"; desc = "Open current directoy in Helix"; } { on = ""; run = "shell 'lazygit' --block"; desc = "Open current directoy in Lazygit"; } - { on = ""; run = ''shell 'ghostty --command="yazi"' ''; desc = "Open current directoy in a new ghostty window"; } + { on = ""; run = ''shell 'ghostty --command="fish -C nx_yazi_into_fish"' --orphan ''; desc = "Open current directoy in a new ghostty window"; } ]; tasks.keymap = [ # Task