From 47b0e9125a97c8a55d5068f2f9d87d4937cf44d7 Mon Sep 17 00:00:00 2001 From: "Lennart J. Kurzweg (Nx2)" Date: Sun, 23 Nov 2025 23:11:17 +0100 Subject: [PATCH] yazi fix --- home-modules/yazi.nix | 121 +++++++++++++++++++++++------------------- 1 file changed, 67 insertions(+), 54 deletions(-) diff --git a/home-modules/yazi.nix b/home-modules/yazi.nix index 2bf9517..82b553a 100644 --- a/home-modules/yazi.nix +++ b/home-modules/yazi.nix @@ -30,24 +30,24 @@ in { { on = ""; run = "arrow 100%"; desc = "Move cursor down one page"; } { on = ""; run = "arrow -100%"; desc = "Move cursor up one page"; } { on = ""; run = "arrow 100%"; desc = "Move cursor down one page"; } - { on = [ "g" "g" ]; run = "arrow top"; desc = "Move cursor to the top"; } - { on = [ "g" "e" ]; run = "arrow bot"; desc = "Move cursor to the end"; } - { on = [ "g" "h" ]; run = "cd ~"; desc = "Go to the home directory"; } - { on = [ "g" "n" ]; run = "cd ~/nix-dots"; desc = "Go to the Nix-Dotfiles directory"; } - (pkgs.lib.mkIf (hyper.host == "NxACE") { on = [ "g" "s" ]; run = "cd /var/lib/hugo/nx2site"; desc = "Go to the Hugo Nx2.Site directory"; }) - { on = [ "g" "n" ]; run = "cd /nix/store"; desc = "Go to the Nix-Store"; } - { on = [ "g" "c" ]; run = "cd ~/.config"; desc = "Go to the config directory"; } - { on = [ "g" "l" ]; run = "cd ~/.locale"; desc = "Go to the .locale directory"; } { on = [ "g" "C" ]; run = "cd ~/.cache"; desc = "Go to the .cache directory"; } - { on = [ "g" "m" ]; run = "cd ~/media"; desc = "Go to the media (udiskie mount) directory"; } - { on = [ "g" "v" ]; run = "cd ~/Videos"; desc = "Go to the Videos directory"; } - { on = [ "g" "t" ]; run = "cd /tmp"; desc = "Go to the /tmp directory"; } - { on = [ "g" "d" ]; run = "cd ~/Downloads"; desc = "Go to the downloads directory"; } + { on = [ "g" "c" ]; run = "cd ~/.config"; desc = "Go to the config directory"; } { on = [ "g" "D" ]; run = "cd ~/Documents"; desc = "Go to the Documents directory"; } - { on = [ "g" "r" ]; run = "cd /"; desc = "Go to the root (/) directory"; } + { on = [ "g" "d" ]; run = "cd ~/Downloads"; desc = "Go to the downloads directory"; } + { on = [ "g" "e" ]; run = "arrow bot"; desc = "Move cursor to the end"; } + { on = [ "g" "g" ]; run = "arrow top"; desc = "Move cursor to the top"; } + { on = [ "g" "h" ]; run = "cd ~"; desc = "Go to the home directory"; } + { on = [ "g" "l" ]; run = "cd ~/.locale"; desc = "Go to the .locale directory"; } + { on = [ "g" "m" ]; run = "cd ~/media"; desc = "Go to the media (udiskie mount) directory"; } + { on = [ "g" "n" ]; run = "cd ~/nix-dots"; desc = "Go to the Nix-Dotfiles directory"; } + { on = [ "g" "N" ]; run = "cd /nix/store"; desc = "Go to the Nix-Store"; } { on = [ "g" "p" ]; run = "cd ~/projects"; desc = "Go to the projects directory"; } + { on = [ "g" "r" ]; run = "cd /"; desc = "Go to the root (/) directory"; } { on = [ "g" "/" ]; run = "cd /"; desc = "Go to the root (/) directory"; } + { on = [ "g" "t" ]; run = "cd /tmp"; desc = "Go to the /tmp directory"; } + { on = [ "g" "v" ]; run = "cd ~/Videos"; desc = "Go to the Videos directory"; } { on = [ "g" "" ]; run = "cd --interactive"; desc = "Go to a directory interactively"; } + (pkgs.lib.mkIf (hyper.host == "NxACE") { on = [ "g" "s" ]; run = "cd /var/lib/hugo/nx2site"; desc = "Go to the Hugo Nx2.Site directory"; }) # Navigation { on = "h"; run = "leave"; desc = "Go back to the parent directory"; } { on = "l"; run = "enter"; desc = "Enter the child directory"; } @@ -70,8 +70,7 @@ in { { on = "O"; run = "open --interactive"; desc = "Open selected files interactively"; } { on = ""; run = "open"; desc = "Open selected files"; } { on = ""; run = "open --interactive"; desc = "Open selected files interactively"; } - { on = "y"; run = [ ''shell -- for path in "$@"; do echo "file://$path"; done | wl-copy -t text/uri-list'' - "yank" ]; desc = "Yank selected files (copy)"; } + { on = "y"; run = [ ''shell -- for path in "$@"; do echo "file://$path"; done | wl-copy -t text/uri-list'' "yank" ]; desc = "Yank selected files (copy)"; } { on = "y"; run = "yank"; desc = "Yank selected files (copy)"; } { on = "x"; run = "yank --cut"; desc = "Yank selected files (cut)"; } { on = "p"; run = "paste"; desc = "Paste yanked "; } @@ -158,6 +157,7 @@ in { { on = "{"; run = "tab_swap -1"; desc = "Swap current tab with previous tab"; } { on = "{"; run = "tab_swap -1"; desc = "Swap current tab wittab"; } { on = "}"; run = "tab_swap 1"; desc = "Swap current tab with next tab"; } + { on = ""; run = "spot"; desc = "Show Spot View"; } # Tasks { on = "w"; run = "tasks:show"; desc = "Show Task View"; } ]; @@ -179,6 +179,19 @@ in { { on = "?"; run = "help"; desc = "Open help"; } { on = ""; run = "help"; desc = "Open help"; } ]; + spot.keymap = [ + # Spot + { on = ""; run = "close"; desc = "Close Spot View"; } + { on = "q"; run = "close"; desc = "Close Spot View"; } + { on = ""; run = "close"; desc = "Close Spot View"; } + { on = "j"; run = "arrow -1"; desc = "Up in list"; } + { on = "k"; run = "arrow 1"; desc = "Down in list"; } + { on = "u"; run = "arrow -5"; desc = "Up in list (fast)"; } + { on = "d"; run = "arrow 5"; desc = "Down in list (fast)"; } + { on = [ "g" "g" ]; run = "arrow top"; desc = "Move cursor to the top"; } + { on = [ "g" "e" ]; run = "arrow bot"; desc = "Move cursor to the end"; } + { on = "c"; run = "arrow bot"; desc = "Copy Selected Cell"; } + ]; }; settings = { mgr = { @@ -193,74 +206,76 @@ in { }; opener = { "edit" = [ - { run = ''hx "$@"''; desc = "helix"; block = true; } - { run = ''codium "$@"''; desc = "code"; orphan = true; } + { run = ''hx "$0" "$@"''; desc = "Helix"; block = true; } + { run = ''codium "$0" "$@"''; desc = "VS Code"; orphan = true; } + { run = ''antigravity "$0" "$0"''; desc = "Antigravity"; orphan = true; } + { run = ''cat "$0" "$@" | wl-copy''; desc = "Copy Contents"; } ]; "play" = [ - { run = ''mpv "$@"''; desc = "mpv"; orphan = true; } - { run = ''mpv --vf=negate "$@"''; desc = "mpv inverted"; orphan = true; } - { run = ''mediainfo "$1"; echo "Press enter to exit"; read''; block = true; desc = "Show mediainfo"; } + { run = ''mpv "$0" "$@"''; desc = "mpv"; orphan = true; } + { run = ''mpv --vf=negate "$0" "$@"''; desc = "mpv inverted"; orphan = true; } + { run = ''mediainfo "$0"; echo "Press enter to return to yazi"; read''; block = true; desc = "Show mediainfo"; } ]; "archive" = [ - { run = ''unar "$1"''; desc = "Extract here"; } - { run = ''tar -x "$1"''; desc = "tar -x"; } - { run = ''unzip "$1"''; desc = "unzip"; } + { run = ''unar "$0" "$@"''; desc = "Extract here"; } + { run = ''tar -x "$0" "$@"''; desc = "tar -x"; } + { run = ''unzip "$0" "$@"''; desc = "unzip"; } ]; "image" = [ - { run = ''imv "$@"''; desc = "imv"; orphan = true; } - { run = ''gimp "$@"''; desc = "gimp"; orphan = true; } + { run = ''imv "$0" "$@"''; desc = "imv"; orphan = true; } + { run = ''gimp "$0" "$@"''; desc = "gimp"; orphan = true; } { run = ''swww img --transition-type wipe --transition-angle 60 --transition-step 120 --transition-fps 120 "$@"''; desc = "swww wallpaper"; } - { run = ''exiftool "$@"; echo "Press enter to exit"; read''; desc = "View Exif Data"; } - { run = ''for f in "$@"; do magick "$f" -auto-orient "''${f%.*}.pdf"; done''; desc = "Convert to PDF"; } + { run = ''exiftool "$0"; echo "Press enter to return to yazi"; read''; desc = "View Exif Data"; } + { run = ''for f in "$0"; do magick "$f" -auto-orient "''${f%.*}.pdf"; done''; desc = "Convert to PDF"; } ]; "svg" = [ - { run = ''inkscape "$@"''; desc = "inkscape"; orphan = true; } - { run = ''firefox "$@"''; desc = "firefox"; orphan = true; } + { run = ''inkscape "$0" "$@"''; desc = "inkscape"; orphan = true; } + { run = ''firefox "$0" "$@"''; desc = "firefox"; orphan = true; } ]; "font" = [ - { run = ''fontpreview "$@"''; desc = "fontpreview"; orphan = true; } - { run = ''fontforge "$@"''; desc = "fortforge"; orphan = true; } + { run = ''fontpreview "$0" "$@"''; desc = "fontpreview"; orphan = true; } + { run = ''fontforge "$0" "$@"''; desc = "fortforge"; orphan = true; } ]; "document" = [ - { run = ''zathura "$@"''; desc = "zathura"; orphan = true; } - { run = ''xournal "$@"''; desc = "xournal"; orphan = true; } - { run = ''firefox "$@"''; desc = "firefox"; orphan = true; } - { run = ''nxgs flip "$@"''; desc = "nxgs flip"; } - { run = ''nxgs rotate "$@"''; desc = "nxgs rotate"; } - { run = ''nxgs interactive-merge "$@"''; block = true; desc = "nxgs merge"; } + { run = ''zathura "$0" "$@"''; desc = "zathura"; orphan = true; } + { run = ''xournal "$0" "$@"''; desc = "xournal"; orphan = true; } + { run = ''firefox "$0" "$@"''; desc = "firefox"; orphan = true; } + { run = ''nxgs flip "$0" "$@"''; desc = "nxgs flip"; } + { run = ''nxgs rotate "$0" "$@"''; desc = "nxgs rotate"; } + { run = ''nxgs interactive-merge "$0" "$@"''; block = true; desc = "nxgs merge"; } ]; "browser" = [ - { run = ''firefox "$@"''; desc = "firefox"; orphan = true; } - { run = ''zen "$@"''; desc = "zen"; orphan = true; } - { run = ''chromium --enable-features=UseOzonePlatform --ozone-platform=wayland "$@"''; desc = "chromium"; orphan = true; } - { run = ''w3m "$@"''; desc = "w3m"; } - { run = ''lynx "$@"''; desc = "lynx"; } + { run = ''firefox "$0" "$@"''; desc = "firefox"; orphan = true; } + { run = ''chromium --enable-features=UseOzonePlatform --ozone-platform=wayland "$0" "$@"''; desc = "chromium"; orphan = true; } + { run = ''w3m "$0" "$@"''; desc = "w3m"; } + { run = ''lynx "$0" "$@"''; desc = "lynx"; } ]; "office" = [ - { run = ''libreoffice "$@"''; desc = "libreoffice"; orphan = true; } - { run = ''libreoffice --view "$@"''; desc = "libreoffice read-only"; orphan = true; } + { run = ''libreoffice "$0" "$@"''; desc = "libreoffice"; orphan = true; } + { run = ''libreoffice --view "$0" "$@"''; desc = "libreoffice read-only"; orphan = true; } ]; "shell" = [ - { run = ''bash -c "$@"''; desc = "bash -c"; } - { run = ''fish -c "$@"''; desc = "fish -c"; } - { run = ''sh -c "$@"''; desc = "sh -c"; } + { run = ''bash -c "$0"; echo "Press enter to return to yazi"; read''; desc = "bash -c"; } + { run = ''fish -c "$0"; echo "Press enter to return to yazi"; read''; desc = "fish -c"; } + { run = ''sh -c "$0"; echo "Press enter to return to yazi"; read''; desc = "sh -c"; } ]; "python" = [ - { run = ''python "$@"''; desc = "python"; } + { run = ''python "$@"; echo "Press enter to return to yazi"; read''; desc = "python"; block = true; } ]; "directory" = [ - { run = ''lazygit "$@"''; desc = "python"; } + { run = ''lazygit "$0"''; desc = "lazygit"; } ]; }; open.rules = [ { mime = "text/html"; use = [ "edit" "browser" ]; } { mime = "text/htm"; use = [ "edit" "browser" ]; } - { mime = "text/x-python"; use = "python"; } + { mime = "text/x-script.python"; use = [ "edit" "python" ]; } + { mime = "text/script.python"; use = [ "edit" "python" ]; } { mime = "text/*"; use = "edit"; } { mime = "text"; use = "edit"; } - { mine = "inode/x-empty"; use = "edit"; } - { mine = "inode/directory"; use = "edit"; } + { mine = "inode/x-empty"; use = "directory"; } + { mine = "inode/directory"; use = "directory"; } { mime = "image/*"; use = "image"; } { mime = "image/svg"; use = [ "image" "edit" ]; } @@ -311,8 +326,6 @@ in { tabs = { active = { fg = secondary.dark; bg = secondary.base; }; inactive = { fg = secondary.base; bg = secondary.dark; }; - # sep_inner = - # sep_outer = }; status = { separator_open = " "; #"";