Yazi : Add archive rules.

This commit is contained in:
Dmitry Voronin 2024-06-23 05:49:28 +03:00
parent a77a9515e6
commit 2e0a1fb3e7
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k

View file

@ -23,67 +23,68 @@
openWith = app: "${app} \"$@\"";
in {
default = [{
desc = "Default";
orphan = true;
run = openWith "xdg-open";
}];
browser = [{
desc = "Browser";
orphan = true;
run = openWith setting.browser.bin;
}];
text = [{
desc = "Text";
block = true;
run = openWith "nvim";
}];
audio = [{
desc = "Audio";
orphan = true;
run = openWith "mpv --no-video";
}];
video = [{
desc = "Video";
orphan = true;
run = openWith "mpv";
}];
document = [{
desc = "Document";
orphan = true;
run = openWith "onlyoffice-desktopeditors";
}];
pdf = [{
desc = "Pdf";
orphan = true;
run = openWith "evince";
}];
image = [{
desc = "Image";
orphan = true;
run = openWith "loupe";
}];
archive = [{
desc = "Archive";
block = true;
run = openWith "unpack";
}];
};
open = {
rules = [
{
mime = "application/pdf";
use = "pdf";
} {
mime = "text/*";
use = "text";
} {
mime = "application/vnd.openxmlformats-officedocument.*";
use = "document";
} {
mime = "image/*";
use = "image";
} {
mime = "video/*";
use = "video";
} {
mime = "audio/*";
use = "audio";
} {
mime = "application/json";
use = "text";
} {
# name = "*.html";
mime = "text/html";
use = [ "browser" "text" ];
}
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")
];
};
};