From 559bb1d471e5aa9326e66eed1ff590ce6c431710 Mon Sep 17 00:00:00 2001 From: Christoph Urlacher Date: Fri, 5 Jun 2026 12:37:31 +0200 Subject: [PATCH] Modules/Yazi: Update for new HM update --- home/homemodules/yazi/default.nix | 233 ++++++++++++++++++++++-------- 1 file changed, 172 insertions(+), 61 deletions(-) diff --git a/home/homemodules/yazi/default.nix b/home/homemodules/yazi/default.nix index 962ebc29..c15bc330 100644 --- a/home/homemodules/yazi/default.nix +++ b/home/homemodules/yazi/default.nix @@ -5,10 +5,12 @@ mylib, pkgs, ... -}: let +}: +let inherit (config.homemodules) yazi color; -in { - options.homemodules.yazi = import ./options.nix {inherit lib mylib;}; +in +{ + options.homemodules.yazi = import ./options.nix { inherit lib mylib; }; config = lib.mkIf yazi.enable { programs.yazi = { @@ -17,7 +19,18 @@ in { shellWrapperName = "y"; plugins = { - inherit (pkgs.yaziPlugins) chmod diff full-border git lazygit mount ouch rsync starship sudo; # smart-paste + inherit (pkgs.yaziPlugins) + chmod + diff + full-border + git + lazygit + mount + ouch + rsync + starship + sudo + ; # smart-paste }; initLua = '' @@ -70,7 +83,12 @@ in { { run = ''mpv "$@"''; orphan = true; - desc = "Play selection"; + desc = "Play selection with mpv"; + } + { + run = ''vlc "$@"''; + orphan = true; + desc = "Play selection with vlc"; } ]; edit = [ @@ -81,14 +99,18 @@ in { } ]; open = [ + { + run = ''imv "$@"''; + desc = "Open selection with imv"; + } { run = ''xdg-open "$@"''; - desc = "Open selection"; + desc = "Open selection with xdg-open"; } { # TODO: For some reason, junction does not exit after choosing an application... run = ''junction "$@"''; - desc = "Open selection in chosen application"; + desc = "Open selection with junction"; } ]; extract = [ @@ -106,13 +128,13 @@ in { plugin.prepend_fetchers = [ { - id = "git"; - name = "*"; + group = "git"; + url = "*"; run = "git"; } { - id = "git"; - name = "*/"; + group = "git"; + url = "*/"; run = "git"; } ]; @@ -162,42 +184,66 @@ in { mgr.prepend_keymap = [ { - on = ["" "m"]; + on = [ + "" + "m" + ]; run = "plugin mount"; desc = "Manage device mounts"; } { - on = ["" "c"]; + on = [ + "" + "c" + ]; run = "plugin chmod"; desc = "Chmod selection"; } { - on = ["" "g"]; + on = [ + "" + "g" + ]; run = "plugin lazygit"; desc = "Run LazyGit"; } { - on = ["" "a"]; + on = [ + "" + "a" + ]; run = "plugin ouch"; desc = "Add selection to archive"; } { - on = ["" "d"]; + on = [ + "" + "d" + ]; run = ''shell -- ripdrag -a -n "$@"''; desc = "Drag & drop selection"; } { - on = ["" "D"]; + on = [ + "" + "D" + ]; run = "plugin diff"; desc = "Diff the selected with the hovered file"; } { - on = ["" "r"]; + on = [ + "" + "r" + ]; run = "plugin rsync"; desc = "Copy files using rsync"; } { - on = ["" "w"]; + on = [ + "" + "w" + ]; run = ''wl-copy < "$0"''; desc = "Copy hovered file contents using wl-copy"; } @@ -209,7 +255,10 @@ in { } { on = "y"; - run = [''shell -- for path in "$@"; do echo "file://$path"; done | wl-copy -t text/uri-list'' "yank"]; + run = [ + ''shell -- for path in "$@"; do echo "file://$path"; done | wl-copy -t text/uri-list'' + "yank" + ]; desc = "Copy files to system clipboard on yank"; } # { @@ -228,7 +277,9 @@ in { # https://github.com/catppuccin/yazi/blob/main/themes/mocha/catppuccin-mocha-lavender.toml theme = { mgr = { - cwd = {fg = color.hexS.teal;}; + cwd = { + fg = color.hexS.teal; + }; hovered = { fg = color.hexS.accentText; @@ -285,7 +336,9 @@ in { }; border_symbol = "│"; - border_style = {fg = color.hexS.overlay0;}; + border_style = { + fg = color.hexS.overlay0; + }; }; tabs = { @@ -354,58 +407,104 @@ in { bg = color.hexS.surface0; }; - perm_type = {fg = color.hexS.blue;}; - perm_read = {fg = color.hexS.yellow;}; - perm_write = {fg = color.hexS.red;}; - perm_exec = {fg = color.hexS.green;}; - perm_sep = {fg = color.hexS.overlay0;}; + perm_type = { + fg = color.hexS.blue; + }; + perm_read = { + fg = color.hexS.yellow; + }; + perm_write = { + fg = color.hexS.red; + }; + perm_exec = { + fg = color.hexS.green; + }; + perm_sep = { + fg = color.hexS.overlay0; + }; }; input = { - border = {fg = color.hexS.accentDim;}; - title = {}; - value = {}; - selected = {reversed = true;}; + border = { + fg = color.hexS.accentDim; + }; + title = { }; + value = { }; + selected = { + reversed = true; + }; }; pick = { - border = {fg = color.hexS.accentDim;}; - active = {fg = color.hexS.accentHl;}; - inactive = {}; + border = { + fg = color.hexS.accentDim; + }; + active = { + fg = color.hexS.accentHl; + }; + inactive = { }; }; confirm = { - border = {fg = color.hexS.accentDim;}; - title = {fg = color.hexS.accentDim;}; - content = {}; - list = {}; - btn_yes = {reversed = true;}; - btn_no = {}; + border = { + fg = color.hexS.accentDim; + }; + title = { + fg = color.hexS.accentDim; + }; + content = { }; + list = { }; + btn_yes = { + reversed = true; + }; + btn_no = { }; }; cmp = { - border = {fg = color.hexS.accentDim;}; + border = { + fg = color.hexS.accentDim; + }; }; tasks = { - border = {fg = color.hexS.accentDim;}; - title = {}; - hovered = {underline = true;}; + border = { + fg = color.hexS.accentDim; + }; + title = { }; + hovered = { + underline = true; + }; }; which = { - cand = {fg = color.hexS.accent;}; - desc = {fg = color.hexS.accentHl;}; - mask = {bg = color.hexS.surface0;}; - rest = {fg = color.hexS.surface0;}; + cand = { + fg = color.hexS.accent; + }; + desc = { + fg = color.hexS.accentHl; + }; + mask = { + bg = color.hexS.surface0; + }; + rest = { + fg = color.hexS.surface0; + }; separator = "  "; - separator_style = {fg = color.hexS.text;}; + separator_style = { + fg = color.hexS.text; + }; }; help = { - on = {fg = color.hexS.accent;}; - run = {fg = color.hexS.accentHl;}; - desc = {fg = color.hexS.text;}; + on = { + fg = color.hexS.accent; + }; + run = { + fg = color.hexS.accentHl; + }; + desc = { + fg = color.hexS.text; + }; hovered = { fg = color.hexS.accentText; # TODO: This is not applied @@ -420,19 +519,31 @@ in { }; notify = { - title_info = {fg = color.hexS.teal;}; - title_warn = {fg = color.hexS.yellow;}; - title_error = {fg = color.hexS.red;}; + title_info = { + fg = color.hexS.teal; + }; + title_warn = { + fg = color.hexS.yellow; + }; + title_error = { + fg = color.hexS.red; + }; }; spot = { - border = {fg = color.hexS.lavender;}; - title = {fg = color.hexS.lavender;}; + border = { + fg = color.hexS.lavender; + }; + title = { + fg = color.hexS.lavender; + }; tbl_cell = { fg = color.hexS.lavender; reversed = true; }; - tbl_col = {bold = true;}; + tbl_col = { + bold = true; + }; }; # Default rules good enough @@ -442,9 +553,9 @@ in { # Prepend to override default config icon = { - prepend_dirs = import ./specialDirectories.nix {inherit color;}; - prepend_files = import ./specialFiles.nix {inherit color;}; - prepend_exts = import ./specialExtensions.nix {inherit color;}; + prepend_dirs = import ./specialDirectories.nix { inherit color; }; + prepend_files = import ./specialFiles.nix { inherit color; }; + prepend_exts = import ./specialExtensions.nix { inherit color; }; }; }; };