From b1104860bf554b9e96b99d6888eeefe408ab470b Mon Sep 17 00:00:00 2001 From: Integral Date: Thu, 21 Nov 2024 18:29:33 +0800 Subject: [PATCH 1/4] feat: preview & extract file formats supported by 7-zip --- yazi-config/preset/theme.toml | 7 +++++-- yazi-config/preset/yazi.toml | 30 ++++++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/yazi-config/preset/theme.toml b/yazi-config/preset/theme.toml index d98bdad0..a0c9d1f0 100644 --- a/yazi-config/preset/theme.toml +++ b/yazi-config/preset/theme.toml @@ -190,8 +190,11 @@ rules = [ { mime = "{audio,video}/*", fg = "magenta" }, # Archives - { mime = "application/{,g}zip", fg = "red" }, - { mime = "application/{tar,bzip*,7z-compressed,xz,rar}", fg = "red" }, + { mime = "application/{zip,gzip,zstd,zlib,arj}", fg = "red" }, + { mime = "application/{zip,gzip,x}-compressed", fg = "red" }, + { mime = "application/x-{rar,tar,xz,bzip*,lzma,compress,archive,cpio,arj,deflate,xar}", fg = "red" }, + { mime = "application/x-{zip,rar,7z,gzip,arj}-compressed", fg = "red" }, + { mime = "application/vnd.ms-cab-compressed", fg = "red" }, # Documents { mime = "application/{pdf,doc,rtf,vnd.*}", fg = "cyan" }, diff --git a/yazi-config/preset/yazi.toml b/yazi-config/preset/yazi.toml index 863291cf..c5beaa65 100644 --- a/yazi-config/preset/yazi.toml +++ b/yazi-config/preset/yazi.toml @@ -67,8 +67,15 @@ rules = [ # Media { mime = "{audio,video}/*", use = [ "play", "reveal" ] }, # Archive - { mime = "application/{,g}zip", use = [ "extract", "reveal" ] }, - { mime = "application/{tar,bzip*,7z-compressed,xz,rar}", use = [ "extract", "reveal" ] }, + { mime = "application/{zip,gzip,zstd,zlib,arj}", use = [ "extract", "reveal" ] }, + { mime = "application/{zip,gzip,x}-compressed", use = [ "extract", "reveal" ] }, + { mime = "application/x-{rar,tar,xz,bzip*,lzma,compress,archive,cpio,arj,deflate,xar}", use = [ "extract", "reveal" ] }, + { mime = "application/x-{zip,rar,7z,gzip,arj}-compressed", use = [ "extract", "reveal" ] }, + { mime = "application/x-{debian-package,redhat-package-manager,rpm}", use = [ "extract", "reveal" ] }, + { mime = "application/vnd.debian.binary-package", use = [ "extract", "reveal" ] }, + { mime = "application/vnd.android.package-archive", use = [ "extract", "reveal" ] }, + { mime = "application/vnd.ms-cab-compressed", use = [ "extract", "reveal" ] }, + { name = "*.{AppImage, appimage}", use = [ "extract", "reveal" ] }, # JSON { mime = "application/{json,ndjson}", use = [ "edit", "reveal" ] }, { mime = "*/javascript", use = [ "edit", "reveal" ] }, @@ -132,8 +139,23 @@ previewers = [ # PDF { mime = "application/pdf", run = "pdf" }, # Archive - { mime = "application/{,g}zip", run = "archive" }, - { mime = "application/{tar,bzip*,7z-compressed,xz,rar,iso9660-image}", run = "archive" }, + { mime = "application/{zip,gzip,zstd,zlib,arj}", run = "archive" }, + { mime = "application/{zip,gzip,x}-compressed", run = "archive" }, + { mime = "application/x-{rar,tar,xz,bzip*,lzma,compress,archive,cpio,arj,deflate,xar}", run = "archive" }, + { mime = "application/x-{zip,rar,7z,gzip,arj}-compressed", run = "archive" }, + { mime = "application/x-{debian-package,redhat-package-manager,rpm}", run = "archive" }, + { mime = "application/vnd.debian.binary-package", run = "archive" }, + { mime = "application/vnd.android.package-archive", run = "archive" }, + { mime = "application/vnd.ms-cab-compressed", run = "archive" }, + { name = "*.{AppImage, appimage}", run = "archive" }, + # Virtual Disk / Disk Image + { mime = "application/x-iso9660-image", run = "archive" }, + { mime = "application/x-{qemu,vhd,vhdx,vdi,vmdk}-disk", run = "archive" }, + { mime = "application/x-{vhd,vmdk}", run = "archive" }, + { mime = "application/x-virtualbox-{vdi,vhd,vhdx,vmdk}", run = "archive" }, + { mime = "application/x-ms-wim", run = "archive" }, + { mime = "application/x-apple-diskimage", run = "archive" }, + { name = "*.{fat,ext,ext2,ext3,ext4,squashfs,ntfs,hfs,hfsx,img}", run = "archive" }, # Font { mime = "font/*", run = "font" }, { mime = "application/vnd.ms-opentype", run = "font" }, From ce8013c97e6fbef2243f3a27af61849fce8798be Mon Sep 17 00:00:00 2001 From: Integral Date: Thu, 21 Nov 2024 19:11:26 +0800 Subject: [PATCH 2/4] Remove the x- prefix from MIME types to comply with #1927 --- yazi-config/preset/theme.toml | 6 ++---- yazi-config/preset/yazi.toml | 27 +++++++++++---------------- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/yazi-config/preset/theme.toml b/yazi-config/preset/theme.toml index a0c9d1f0..a063e040 100644 --- a/yazi-config/preset/theme.toml +++ b/yazi-config/preset/theme.toml @@ -190,10 +190,8 @@ rules = [ { mime = "{audio,video}/*", fg = "magenta" }, # Archives - { mime = "application/{zip,gzip,zstd,zlib,arj}", fg = "red" }, - { mime = "application/{zip,gzip,x}-compressed", fg = "red" }, - { mime = "application/x-{rar,tar,xz,bzip*,lzma,compress,archive,cpio,arj,deflate,xar}", fg = "red" }, - { mime = "application/x-{zip,rar,7z,gzip,arj}-compressed", fg = "red" }, + { mime = "application/{zip,rar,tar,gzip,xz,zstd,bzip*,zlib,lzma,compress,compressed,archive,cpio,arj,deflate,xar}", fg = "red" }, + { mime = "application/{zip,rar,7z,gzip,arj}-compressed", fg = "red" }, { mime = "application/vnd.ms-cab-compressed", fg = "red" }, # Documents diff --git a/yazi-config/preset/yazi.toml b/yazi-config/preset/yazi.toml index c5beaa65..a26f2e92 100644 --- a/yazi-config/preset/yazi.toml +++ b/yazi-config/preset/yazi.toml @@ -67,11 +67,9 @@ rules = [ # Media { mime = "{audio,video}/*", use = [ "play", "reveal" ] }, # Archive - { mime = "application/{zip,gzip,zstd,zlib,arj}", use = [ "extract", "reveal" ] }, - { mime = "application/{zip,gzip,x}-compressed", use = [ "extract", "reveal" ] }, - { mime = "application/x-{rar,tar,xz,bzip*,lzma,compress,archive,cpio,arj,deflate,xar}", use = [ "extract", "reveal" ] }, - { mime = "application/x-{zip,rar,7z,gzip,arj}-compressed", use = [ "extract", "reveal" ] }, - { mime = "application/x-{debian-package,redhat-package-manager,rpm}", use = [ "extract", "reveal" ] }, + { mime = "application/{zip,rar,tar,gzip,xz,zstd,bzip*,zlib,lzma,compress,compressed,archive,cpio,arj,deflate,xar}", use = [ "extract", "reveal" ] }, + { mime = "application/{zip,rar,7z,gzip,arj}-compressed", use = [ "extract", "reveal" ] }, + { mime = "application/{debian-package,redhat-package-manager,rpm}", use = [ "extract", "reveal" ] }, { mime = "application/vnd.debian.binary-package", use = [ "extract", "reveal" ] }, { mime = "application/vnd.android.package-archive", use = [ "extract", "reveal" ] }, { mime = "application/vnd.ms-cab-compressed", use = [ "extract", "reveal" ] }, @@ -139,22 +137,19 @@ previewers = [ # PDF { mime = "application/pdf", run = "pdf" }, # Archive - { mime = "application/{zip,gzip,zstd,zlib,arj}", run = "archive" }, - { mime = "application/{zip,gzip,x}-compressed", run = "archive" }, - { mime = "application/x-{rar,tar,xz,bzip*,lzma,compress,archive,cpio,arj,deflate,xar}", run = "archive" }, - { mime = "application/x-{zip,rar,7z,gzip,arj}-compressed", run = "archive" }, - { mime = "application/x-{debian-package,redhat-package-manager,rpm}", run = "archive" }, + { mime = "application/{zip,rar,tar,gzip,xz,zstd,bzip*,zlib,lzma,compress,compressed,archive,cpio,arj,deflate,xar}", run = "archive" }, + { mime = "application/{zip,rar,7z,gzip,arj}-compressed", run = "archive" }, + { mime = "application/{debian-package,redhat-package-manager,rpm}", run = "archive" }, { mime = "application/vnd.debian.binary-package", run = "archive" }, { mime = "application/vnd.android.package-archive", run = "archive" }, { mime = "application/vnd.ms-cab-compressed", run = "archive" }, { name = "*.{AppImage, appimage}", run = "archive" }, # Virtual Disk / Disk Image - { mime = "application/x-iso9660-image", run = "archive" }, - { mime = "application/x-{qemu,vhd,vhdx,vdi,vmdk}-disk", run = "archive" }, - { mime = "application/x-{vhd,vmdk}", run = "archive" }, - { mime = "application/x-virtualbox-{vdi,vhd,vhdx,vmdk}", run = "archive" }, - { mime = "application/x-ms-wim", run = "archive" }, - { mime = "application/x-apple-diskimage", run = "archive" }, + { mime = "application/iso9660-image", run = "archive" }, + { mime = "application/{qemu,vhd,vhdx,vdi,vmdk}-disk", run = "archive" }, + { mime = "application/{vhd,vmdk}", run = "archive" }, + { mime = "application/virtualbox-{vdi,vhd,vhdx,vmdk}", run = "archive" }, + { mime = "application/{ms-wim,apple-diskimage}", run = "archive" }, { name = "*.{fat,ext,ext2,ext3,ext4,squashfs,ntfs,hfs,hfsx,img}", run = "archive" }, # Font { mime = "font/*", run = "font" }, From 2f65ec961b40e20a98e3918a8f219443823a4e28 Mon Sep 17 00:00:00 2001 From: Integral Date: Thu, 21 Nov 2024 19:27:38 +0800 Subject: [PATCH 3/4] Remove redundant spaces --- yazi-config/preset/yazi.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yazi-config/preset/yazi.toml b/yazi-config/preset/yazi.toml index a26f2e92..fa01a3e1 100644 --- a/yazi-config/preset/yazi.toml +++ b/yazi-config/preset/yazi.toml @@ -73,7 +73,7 @@ rules = [ { mime = "application/vnd.debian.binary-package", use = [ "extract", "reveal" ] }, { mime = "application/vnd.android.package-archive", use = [ "extract", "reveal" ] }, { mime = "application/vnd.ms-cab-compressed", use = [ "extract", "reveal" ] }, - { name = "*.{AppImage, appimage}", use = [ "extract", "reveal" ] }, + { name = "*.{AppImage,appimage}", use = [ "extract", "reveal" ] }, # JSON { mime = "application/{json,ndjson}", use = [ "edit", "reveal" ] }, { mime = "*/javascript", use = [ "edit", "reveal" ] }, @@ -143,7 +143,7 @@ previewers = [ { mime = "application/vnd.debian.binary-package", run = "archive" }, { mime = "application/vnd.android.package-archive", run = "archive" }, { mime = "application/vnd.ms-cab-compressed", run = "archive" }, - { name = "*.{AppImage, appimage}", run = "archive" }, + { name = "*.{AppImage,appimage}", run = "archive" }, # Virtual Disk / Disk Image { mime = "application/iso9660-image", run = "archive" }, { mime = "application/{qemu,vhd,vhdx,vdi,vmdk}-disk", run = "archive" }, From cfa096fece8a94117513a8c791d1c2f8e3a82de5 Mon Sep 17 00:00:00 2001 From: Integral Date: Fri, 22 Nov 2024 17:41:17 +0800 Subject: [PATCH 4/4] Remove application/zlib & add .dmg/.DMG --- yazi-config/preset/yazi.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yazi-config/preset/yazi.toml b/yazi-config/preset/yazi.toml index fa01a3e1..306128c8 100644 --- a/yazi-config/preset/yazi.toml +++ b/yazi-config/preset/yazi.toml @@ -67,7 +67,7 @@ rules = [ # Media { mime = "{audio,video}/*", use = [ "play", "reveal" ] }, # Archive - { mime = "application/{zip,rar,tar,gzip,xz,zstd,bzip*,zlib,lzma,compress,compressed,archive,cpio,arj,deflate,xar}", use = [ "extract", "reveal" ] }, + { mime = "application/{zip,rar,tar,gzip,xz,zstd,bzip*,lzma,compress,compressed,archive,cpio,arj,deflate,xar}", use = [ "extract", "reveal" ] }, { mime = "application/{zip,rar,7z,gzip,arj}-compressed", use = [ "extract", "reveal" ] }, { mime = "application/{debian-package,redhat-package-manager,rpm}", use = [ "extract", "reveal" ] }, { mime = "application/vnd.debian.binary-package", use = [ "extract", "reveal" ] }, @@ -137,7 +137,7 @@ previewers = [ # PDF { mime = "application/pdf", run = "pdf" }, # Archive - { mime = "application/{zip,rar,tar,gzip,xz,zstd,bzip*,zlib,lzma,compress,compressed,archive,cpio,arj,deflate,xar}", run = "archive" }, + { mime = "application/{zip,rar,tar,gzip,xz,zstd,bzip*,lzma,compress,compressed,archive,cpio,arj,deflate,xar}", run = "archive" }, { mime = "application/{zip,rar,7z,gzip,arj}-compressed", run = "archive" }, { mime = "application/{debian-package,redhat-package-manager,rpm}", run = "archive" }, { mime = "application/vnd.debian.binary-package", run = "archive" }, @@ -150,7 +150,7 @@ previewers = [ { mime = "application/{vhd,vmdk}", run = "archive" }, { mime = "application/virtualbox-{vdi,vhd,vhdx,vmdk}", run = "archive" }, { mime = "application/{ms-wim,apple-diskimage}", run = "archive" }, - { name = "*.{fat,ext,ext2,ext3,ext4,squashfs,ntfs,hfs,hfsx,img}", run = "archive" }, + { name = "*.{dmg,DMG,img,fat,ext,ext2,ext3,ext4,squashfs,ntfs,hfs,hfsx}", run = "archive" }, # Font { mime = "font/*", run = "font" }, { mime = "application/vnd.ms-opentype", run = "font" },