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