From 28d08a5c8ab2bbbe5574e85b46db97703cb20708 Mon Sep 17 00:00:00 2001 From: DashieTM Date: Sat, 23 Aug 2025 17:15:10 +0200 Subject: [PATCH] feature(yazi): Add yazi plugins --- modules/programs/browser/zen.nix | 2 ++ modules/programs/hypr/hyprland.nix | 19 ++++++++++--------- modules/programs/yazi/default.nix | 11 +++++++++++ modules/programs/yazi/yazi.nix | 18 +++++++++++------- 4 files changed, 34 insertions(+), 16 deletions(-) diff --git a/modules/programs/browser/zen.nix b/modules/programs/browser/zen.nix index e26c9a9..0e2b48a 100644 --- a/modules/programs/browser/zen.nix +++ b/modules/programs/browser/zen.nix @@ -79,6 +79,7 @@ in { "zen.theme.accent-color" = "#b4bbff"; "extensions.autoDisableScopes" = 0; "cookiebanners.service.mode" = 2; + "widget.use-xdg-desktop-portal.file-picker" = 1; }; isDefault = true; id = 0; @@ -95,6 +96,7 @@ in { "zen.view.welcome-screen.seen" = true; "zen.theme.accent-color" = "#b4bbff"; "extensions.autoDisableScopes" = 0; + "widget.use-xdg-desktop-portal.file-picker" = 1; }; isDefault = false; id = 1; diff --git a/modules/programs/hypr/hyprland.nix b/modules/programs/hypr/hyprland.nix index d46f83e..d7e5b4f 100644 --- a/modules/programs/hypr/hyprland.nix +++ b/modules/programs/hypr/hyprland.nix @@ -193,16 +193,17 @@ in { ) "$mod SUPERSHIFT,F,exec,${browserName} -p special") "$mod SUPER,T,exec,kitty -1" "$mod SUPER,E,exec,nautilus -w" + (lib.mkIf config.mods.yazi.enable "$mod SUPER,Y,exec, EDITOR='neovide --no-fork' kitty yazi") "$mod SUPER,N,exec,neovide" - (lib.mkIf (config.mods.anyrun.enable) "$mod SUPER,R,exec,anyrun") - (lib.mkIf (config.mods.oxi.oxirun.enable) "$mod SUPER,R,exec,oxirun") - (lib.mkIf (config.mods.oxi.oxidash.enable) "$mod SUPER,M,exec,oxidash") - (lib.mkIf (config.mods.oxi.oxicalc.enable) "$mod SUPER,G,exec,oxicalc") - (lib.mkIf (config.mods.oxi.oxishut.enable) "$mod SUPER,D,exec,oxishut") - (lib.mkIf (config.mods.oxi.oxipaste.enable) "$mod SUPER,A,exec,oxipaste") - (lib.mkIf (config.mods.oxi.hyprdock.enable) "$mod SUPERSHIFT,P,exec,hyprdock --gui") - (lib.mkIf (config.mods.hypr.hyprlock.enable) "$mod SUPERSHIFT,L,exec, playerctl -a pause & hyprlock & systemctl suspend") - (lib.mkIf (config.mods.hypr.hyprlock.enable) "$mod SUPERSHIFT,K,exec, playerctl -a pause & hyprlock & systemctl hibernate") + (lib.mkIf config.mods.anyrun.enable "$mod SUPER,R,exec,anyrun") + (lib.mkIf config.mods.oxi.oxirun.enable "$mod SUPER,R,exec,oxirun") + (lib.mkIf config.mods.oxi.oxidash.enable "$mod SUPER,M,exec,oxidash") + (lib.mkIf config.mods.oxi.oxicalc.enable "$mod SUPER,G,exec,oxicalc") + (lib.mkIf config.mods.oxi.oxishut.enable "$mod SUPER,D,exec,oxishut") + (lib.mkIf config.mods.oxi.oxipaste.enable "$mod SUPER,A,exec,oxipaste") + (lib.mkIf config.mods.oxi.hyprdock.enable "$mod SUPERSHIFT,P,exec,hyprdock --gui") + (lib.mkIf config.mods.hypr.hyprlock.enable "$mod SUPERSHIFT,L,exec, playerctl -a pause & hyprlock & systemctl suspend") + (lib.mkIf config.mods.hypr.hyprlock.enable "$mod SUPERSHIFT,K,exec, playerctl -a pause & hyprlock & systemctl hibernate") # media keys (lib.mkIf config.mods.scripts.audioControl ",XF86AudioMute,exec, audioControl mute") diff --git a/modules/programs/yazi/default.nix b/modules/programs/yazi/default.nix index 4e7fb59..9caed87 100644 --- a/modules/programs/yazi/default.nix +++ b/modules/programs/yazi/default.nix @@ -1,4 +1,5 @@ { + pkgs, lib, config, options, @@ -35,16 +36,26 @@ type = with lib.types; attrsOf anything; description = "Additional keymap for yazi"; }; + plugins = lib.mkOption { + default = { + inherit (pkgs.yaziPlugins) piper diff gitui; + }; + example = {}; + type = with lib.types; attrsOf anything; + description = "Additional keymap for yazi"; + }; }; config = let conf = import ./yazi.nix; in lib.optionalAttrs (options ? home.packages) ( lib.mkIf config.mods.yazi.enable { + home.packages = [pkgs.glow]; programs.yazi = { enable = conf.enable; settings = conf.settings // config.mods.yazi.additionalKeymap; keymap = conf.keymap // config.mods.yazi.additionalConfig; + plugins = config.mods.yazi.plugins; }; } ); diff --git a/modules/programs/yazi/yazi.nix b/modules/programs/yazi/yazi.nix index 233ab22..bed1c03 100644 --- a/modules/programs/yazi/yazi.nix +++ b/modules/programs/yazi/yazi.nix @@ -85,19 +85,23 @@ }; plugin = { prepend_previewers = [ + { + name = "*.tar"; + run = ''piper --format=url -- tar tf "$1"''; + } { name = "*.md"; - run = "glow"; + run = ''piper -- CLICOLOR_FORCE=1 glow -w=$w -s=dark "$1"''; } { mime = "text/csv"; - run = "miller"; + run = ''piper -- bat -p --color=always "$1"''; } ]; }; }; keymap = { - manager.keymap = [ + mgr.keymap = [ { on = [""]; run = "escape"; @@ -368,13 +372,13 @@ desc = "Cancel the ongoing search"; } { - on = ["z"]; - run = "jump zoxide"; + on = ["Z"]; + run = "plugin zoxide"; desc = "Jump to a directory using zoxide"; } { - on = ["Z"]; - run = "jump fzf"; + on = ["z"]; + run = "plugin fzf"; desc = "Jump to a directory or reveal a file using fzf"; }