1
0
Fork 0
forked from foxora/nix
flake-foxora/homes/modules/programs/yazi/yazi.nix

180 lines
3.9 KiB
Nix
Raw Normal View History

2026-03-03 04:26:35 +00:00
{upkgs, ...}: {
2026-02-12 18:53:24 +00:00
# optional dependencies can be found here:
# https://yazi-rs.github.io/docs/installation/
2026-02-13 23:27:35 +10:00
home.packages = with upkgs; [
# dependencies
2026-02-12 18:53:24 +00:00
ripdrag
];
programs.yazi = {
enable = true;
2026-03-01 19:11:17 +00:00
enableZshIntegration = false; # i modified the script in my .zshrc
2026-02-12 18:53:24 +00:00
settings = {
mgr = {
show_hidden = true;
2026-04-09 05:49:50 +01:00
mouse_events = ["scroll"];
2026-02-12 18:53:24 +00:00
};
log = {
enabled = false;
};
};
keymap = {
mgr.prepend_keymap = [
# drag and drop!!
2026-02-13 23:27:35 +10:00
{
2026-03-03 04:26:35 +00:00
on = ["<S-c>"];
2026-02-13 23:27:35 +10:00
run = ''shell "ripdrag -x -a \"$@\"" --confirm'';
}
2026-02-12 18:53:24 +00:00
# copy hovered file to clipboard
2026-02-13 23:27:35 +10:00
{
2026-03-03 04:26:35 +00:00
on = ["<S-y>"];
2026-02-13 23:27:35 +10:00
run = ''shell -- path=%h; echo "file://$path" | wl-copy -t text/uri-list'';
}
2026-02-12 18:53:24 +00:00
];
};
# they changed it to custom colors, i don't like that, so this is the config
# i did like:
# https://github.com/sxyazi/yazi/blob/97d0c6bb23df413f4add8b888071233c912c49a3/yazi-config/preset/theme-dark.toml
theme = {
icon = {
dirs = [
2026-02-13 23:27:35 +10:00
{
name = ".config";
text = "";
fg = "red";
}
{
name = ".git";
text = "";
fg = "blue";
}
{
name = ".github";
text = "";
fg = "blue";
}
{
name = ".npm";
text = "";
fg = "blue";
}
{
name = "Desktop";
text = "";
fg = "magenta";
}
{
name = "Documents";
text = "";
fg = "magenta";
}
{
name = "Downloads";
text = "";
fg = "red";
}
{
name = "Library";
text = "";
fg = "magenta";
}
{
name = "Movies";
text = "";
fg = "magenta";
}
{
name = "Music";
text = "";
fg = "magenta";
}
{
name = "Pictures";
text = "";
fg = "magenta";
}
{
name = "Public";
text = "";
fg = "magenta";
}
{
name = "Videos";
text = "";
fg = "red";
}
2026-02-12 18:53:24 +00:00
];
2026-02-13 23:27:35 +10:00
conds = [
# special files
{
"if" = "orphan";
text = "";
}
{
"if" = "link";
text = "";
}
{
"if" = "block";
text = "";
}
{
"if" = "char";
text = "";
}
{
"if" = "fifo";
text = "";
}
{
"if" = "sock";
text = "";
}
{
"if" = "sticky";
text = "";
}
{
"if" = "dummy";
text = "";
}
2026-02-12 18:53:24 +00:00
2026-02-13 23:27:35 +10:00
# fallback
{
"if" = "dir";
text = "";
fg = "blue";
}
{
"if" = "exec";
text = "";
}
{
"if" = "!dir";
text = "";
}
];
2026-02-12 18:53:24 +00:00
};
};
};
# helped me fix it not working:
# https://github.com/hunkyburrito/xdg-desktop-portal-termfilechooser/issues/56
# also, the portal must be enabled in configuration.nix
# i can't seem to get it working any other way
xdg.configFile."xdg-desktop-portal-termfilechooser/config" = {
force = true;
text = ''
[filechooser]
2026-02-13 23:27:35 +10:00
cmd=${upkgs.xdg-desktop-portal-termfilechooser}/share/xdg-desktop-portal-termfilechooser/yazi-wrapper.sh
2026-02-12 18:53:24 +00:00
default_dir=$HOME
env=TERMCMD='alacritty --title filechooser -e '
2026-02-12 18:53:24 +00:00
open_mode=suggested
save_mode=last
'';
};
}