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

96 lines
2.1 KiB
Nix
Raw Normal View History

{ pkgs, config, ... }: {
2024-06-22 23:34:03 +03:00
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;
run = openWith config.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
}];
2024-06-24 15:24:31 +03:00
hex = [{
desc = "Hex";
block = true;
run = openWith "radare2 -c V -w";
2024-06-24 15:24:31 +03:00
}];
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 = use ++ [ "text" "hex" ]; };
2024-06-23 05:49:28 +03:00
in [
(mkRule "application/gzip" [ "archive" ])
(mkRule "application/x-tar" [ "archive" ])
(mkRule "application/x-xz" [ "archive" ])
(mkRule "application/zip" [ "archive" ])
(mkRule "application/pdf" [ "pdf" ])
(mkRule "audio/*" [ "audio" ])
(mkRule "image/*" [ "image" ])
(mkRule "video/*" [ "video" ])
(mkRule "text/html" [ "browser" ])
(mkRule "application/vnd.openxmlformats-officedocument.*" [ "document" ])
(mkRule "*" [ ])
2024-06-22 23:34:03 +03:00
];
};
};
}