nix/home/config/yazi/module/Yazi.nix

107 lines
2.5 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;
2024-08-20 20:24:43 +03:00
run = openWith "firefox-esr";
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";
}];
2024-07-01 14:49:38 +03:00
image_edit = [{
desc = "Image Edit";
orphan = true;
run = openWith "gimp";
}];
2024-06-23 05:49:28 +03:00
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
defaultUse = [ "text" "hex" ];
mkMime = mime: use: { inherit mime; use = use ++ defaultUse; };
mkName = name: use: { inherit name; use = use ++ defaultUse; };
2024-06-23 05:49:28 +03:00
in [
2024-09-18 02:06:59 +03:00
# Use `file -i file.txt` to find file mime type.
# Use `xdg-mime query default "text/plain"` to find default app.
(mkMime "application/gzip" [ "archive" ])
(mkMime "application/x-tar" [ "archive" ])
(mkMime "application/x-xz" [ "archive" ])
(mkMime "application/zip" [ "archive" ])
(mkMime "application/x-7z-compressed" [ "archive" ])
(mkMime "application/pdf" [ "pdf" ])
(mkMime "audio/*" [ "audio" ])
(mkName "*.mka" [ "audio" ])
(mkMime "image/*" [ "image" "image_edit" ])
(mkMime "video/*" [ "video" ])
(mkMime "text/html" [ "browser" ])
(mkMime "application/vnd.openxmlformats-officedocument.*" [ "document" ])
(mkMime "*" [ ])
2024-06-22 23:34:03 +03:00
];
};
};
}