treewide: add some yazi config and bind it to niri

This commit is contained in:
Anthony Rodriguez 2024-11-18 14:53:50 +01:00
parent bc2ebd6c82
commit 64db2313b0
Signed by: nezia
GPG key ID: EE3BE97C040A86CE
5 changed files with 29 additions and 15 deletions

View file

@ -15,10 +15,6 @@
programs = { programs = {
fzf.enable = true; fzf.enable = true;
hyfetch.enable = true; hyfetch.enable = true;
yazi = {
enable = true;
enableFishIntegration = true;
};
}; };
# miscellaneous programs that do not need to be configured # miscellaneous programs that do not need to be configured

View file

@ -9,14 +9,14 @@
browser = "firefox"; browser = "firefox";
prefix = "Alt"; prefix = "Alt";
guiFileManager = "nautilus"; guiFileManager = "nautilus";
cliFileManager = "${terminal} -e yazi"; cliFileManager = "yazi";
in { in {
programs.niri.settings.binds = { programs.niri.settings.binds = {
"${prefix}+D".action.spawn = appLauncher; "${prefix}+D".action.spawn = appLauncher;
"${prefix}+Return".action.spawn = terminal; "${prefix}+Return".action.spawn = terminal;
"${prefix}+W".action.spawn = browser; "${prefix}+W".action.spawn = browser;
"${prefix}+E".action.spawn = guiFileManager; "${prefix}+E".action.spawn = guiFileManager;
"${prefix}+Shift+E".action.spawn = cliFileManager; "${prefix}+Shift+E".action.spawn = [terminal "-e" cliFileManager];
"${prefix}+Shift+Slash".action = config.lib.niri.actions.show-hotkey-overlay; "${prefix}+Shift+Slash".action = config.lib.niri.actions.show-hotkey-overlay;
"${prefix}+Q".action = config.lib.niri.actions.close-window; "${prefix}+Q".action = config.lib.niri.actions.close-window;

View file

@ -4,8 +4,8 @@
./gnupg.nix ./gnupg.nix
./tmux.nix ./tmux.nix
./direnv.nix ./direnv.nix
./zellij.nix
./nix-index.nix ./nix-index.nix
./yazi.nix
]; ];
home.packages = with pkgs; [ home.packages = with pkgs; [

View file

@ -0,0 +1,26 @@
{pkgs, ...}: {
programs.yazi = let
# https://github.com/iynaix/dotfiles/blob/8bb1568019ea26f034ac1af9c499b3ff102391a5/home-manager/shell/yazi.nix#L9-L11
mkYaziPlugin = name: text: {
"${name}" = toString (pkgs.writeTextDir "${name}.yazi/init.lua" text) + "/${name}.yazi";
};
in {
enable = true;
enableFishIntegration = true;
plugins = mkYaziPlugin "smart-enter" ''
return {
entry = function()
local h = cx.active.current.hovered
ya.manager_emit(h and h.cha.is_dir and "enter" or "open", { hovered = true })
end,
}
'';
keymap.manager.prepend_keymap = [
{
on = "l";
run = "plugin --sync smart-enter";
desc = "Enter the child directory, or open the file";
}
];
};
}

View file

@ -1,8 +0,0 @@
{
programs.zellij = {
enable = true;
settings = {
pane_frames = false;
};
};
}