nix/user/common/yazi/module/Yazi.nix

92 lines
2 KiB
Nix
Raw Normal View History

2024-06-22 23:34:03 +03:00
{ pkgs, setting, ... }: {
file = (pkgs.formats.toml {}).generate "YaziYaziConfig" {
manager = {
2024-06-23 01:50:46 +03:00
# linemode = "mtime";
2024-06-22 23:34:03 +03:00
mouse_events = [];
ratio = [ 1 4 3 ];
scrolloff = 1;
show_hidden = false;
show_symlink = true;
sort_by = "natural";
sort_dir_first = true;
sort_sensitive = true;
sort_translit = true;
};
2024-06-23 04:07:51 +03:00
preview = {
2024-06-23 05:49:28 +03:00
# image_filter = "triangle";
image_filter = "lanczos3";
2024-06-23 04:07:51 +03:00
image_quality = 80;
};
2024-06-22 23:34:03 +03:00
opener = let
openWith = app: "${app} \"$@\"";
in {
default = [{
2024-06-23 05:49:28 +03:00
desc = "Default";
2024-06-22 23:34:03 +03:00
orphan = true;
2024-06-23 05:49:28 +03:00
run = openWith "xdg-open";
2024-06-22 23:34:03 +03:00
}];
browser = [{
2024-06-23 05:49:28 +03:00
desc = "Browser";
2024-06-22 23:34:03 +03:00
orphan = true;
2024-06-23 04:55:57 +03:00
run = openWith setting.browser.bin;
2024-06-22 23:34:03 +03:00
}];
text = [{
2024-06-23 05:49:28 +03:00
desc = "Text";
2024-06-22 23:34:03 +03:00
block = true;
run = openWith "nvim";
}];
audio = [{
2024-06-23 05:49:28 +03:00
desc = "Audio";
2024-06-22 23:34:03 +03:00
orphan = true;
run = openWith "mpv --no-video";
}];
video = [{
2024-06-23 05:49:28 +03:00
desc = "Video";
2024-06-22 23:34:03 +03:00
orphan = true;
run = openWith "mpv";
}];
document = [{
2024-06-23 05:49:28 +03:00
desc = "Document";
2024-06-22 23:34:03 +03:00
orphan = true;
2024-06-23 05:49:28 +03:00
run = openWith "onlyoffice-desktopeditors";
2024-06-22 23:34:03 +03:00
}];
pdf = [{
2024-06-23 05:49:28 +03:00
desc = "Pdf";
2024-06-22 23:34:03 +03:00
orphan = true;
2024-06-23 05:49:28 +03:00
run = openWith "evince";
2024-06-22 23:34:03 +03:00
}];
image = [{
2024-06-23 05:49:28 +03:00
desc = "Image";
2024-06-22 23:34:03 +03:00
orphan = true;
2024-06-23 05:49:28 +03:00
run = openWith "loupe";
}];
archive = [{
desc = "Archive";
block = true;
run = openWith "unpack";
2024-06-22 23:34:03 +03:00
}];
};
open = {
2024-06-23 05:49:28 +03:00
rules = let
mkRule = mime: use: { inherit mime use; };
in [
(mkRule "application/gzip" "archive")
(mkRule "application/json" "text")
(mkRule "application/pdf" "pdf")
(mkRule "application/x-tar" "archive")
(mkRule "application/x-xz" "archive")
(mkRule "application/zip" "archive")
(mkRule "audio/*" "audio")
(mkRule "image/*" "image")
(mkRule "text/*" "text")
(mkRule "video/*" "video")
(mkRule "text/html" [ "browser" "text" ])
(mkRule "application/vnd.openxmlformats-officedocument.*" "document")
2024-06-22 23:34:03 +03:00
];
};
};
}