From f514d76495c31400ca2b279c067b670f4c82ee44 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Sat, 29 Jun 2024 23:24:37 -0400 Subject: [PATCH] home/defaultApps: overhaul mimetype associations --- homeManagerModules/defaultApps.nix | 281 +++++++++++++++++++++++++---- 1 file changed, 241 insertions(+), 40 deletions(-) diff --git a/homeManagerModules/defaultApps.nix b/homeManagerModules/defaultApps.nix index 093a1618..1148dd0a 100644 --- a/homeManagerModules/defaultApps.nix +++ b/homeManagerModules/defaultApps.nix @@ -37,46 +37,247 @@ mimeApps = { enable = true; - defaultApplications = { - "application/json" = "defaultEditor.desktop"; - "application/pdf" = "defaultPdfViewer.desktop"; - "application/x-extension-htm" = "defaultWebBrowser.desktop"; - "application/x-extension-html" = "defaultWebBrowser.desktop"; - "application/x-extension-shtml" = "defaultWebBrowser.desktop"; - "application/x-extension-xht" = "defaultWebBrowser.desktop"; - "application/x-extension-xhtml" = "defaultWebBrowser.desktop"; - "application/x-shellscript" = "defaultEditor.desktop"; - "application/xhtml+xml" = "defaultWebBrowser.desktop"; - "audio/aac" = "defaultAudioPlayer.desktop"; - "audio/flac" = "defaultAudioPlayer.desktop"; - "audio/mpeg" = "defaultAudioPlayer.desktop"; - "audio/ogg" = "defaultAudioPlayer.desktop"; - "audio/opus" = "defaultAudioPlayer.desktop"; - "audio/wav" = "defaultAudioPlayer.desktop"; - "audio/webm" = "defaultAudioPlayer.desktop"; - "image/gif" = "defaultImageViewer.desktop"; - "image/jpeg" = "defaultImageViewer.desktop"; - "image/png" = "defaultImageViewer.desktop"; - "image/svg+xml" = "defaultImageViewer.desktop"; - "image/tiff" = "defaultImageViewer.desktop"; - "image/webp" = "defaultImageViewer.desktop"; - "inode/directory" = "defaultFileManager.desktop"; - "text/html" = "defaultWebBrowser.desktop"; - "text/markdown" = "defaultEditor.desktop"; - "text/plain" = "defaultEditor.desktop"; - "text/x-python" = "defaultEditor.desktop"; - "text/xml" = "defaultWebBrowser.desktop"; - "video/mp2t" = "defaultVideoPlayer.desktop"; - "video/mp4" = "defaultVideoPlayer.desktop"; - "video/mpeg" = "defaultVideoPlayer.desktop"; - "video/ogg" = "defaultVideoPlayer.desktop"; - "video/webm" = "defaultVideoPlayer.desktop"; - "video/x-msvideo" = "defaultVideoPlayer.desktop"; - "x-scheme-handler/chrome" = "defaultWebBrowser.desktop"; - "x-scheme-handler/ftp" = "defaultWebBrowser.desktop"; - "x-scheme-handler/http" = "defaultWebBrowser.desktop"; - "x-scheme-handler/https" = "defaultWebBrowser.desktop"; - }; + defaultApplications = let + audioTypes = + lib.genAttrs [ + "application/mpeg4-iod" + "application/mpeg4-muxcodetable" + "application/mxf" + "application/ogg" + "application/vnd.apple.mpegurl" + "application/vnd.ms-asf" + "application/vnd.rn-realmedia-vbr" + "application/vnd.rn-realmedia" + "application/x-extension-m4a" + "application/x-flac" + "application/x-ogg" + "application/x-streamingmedia" + "audio/3gpp" + "audio/3gpp2" + "audio/aac" + "audio/ac3" + "audio/amr-wb" + "audio/amr" + "audio/basic" + "audio/dv" + "audio/eac3" + "audio/flac" + "audio/m4a" + "audio/midi" + "audio/mp1" + "audio/mp2" + "audio/mp3" + "audio/mp4" + "audio/mpeg" + "audio/mpegurl" + "audio/mpg" + "audio/ogg" + "audio/opus" + "audio/scpls" + "audio/vnd.dolby.heaac.1" + "audio/vnd.dolby.heaac.2" + "audio/vnd.dolby.mlp" + "audio/vnd.dts.hd" + "audio/vnd.dts" + "audio/vnd.rn-realaudio" + "audio/wav" + "audio/webm" + "audio/x-aac" + "audio/x-aiff" + "audio/x-ape" + "audio/x-flac" + "audio/x-gsm" + "audio/x-it" + "audio/x-m4a" + "audio/x-matroska" + "audio/x-mod" + "audio/x-mp1" + "audio/x-mp2" + "audio/x-mp3" + "audio/x-mpeg" + "audio/x-mpegurl" + "audio/x-mpg" + "audio/x-ms-asf" + "audio/x-ms-wma" + "audio/x-musepack" + "audio/x-opus+ogg" + "audio/x-pn-aiff" + "audio/x-pn-au" + "audio/x-pn-realaudio" + "audio/x-pn-wav" + "audio/x-real-audio" + "audio/x-realaudio" + "audio/x-s3m" + "audio/x-scpls" + "audio/x-shorten" + "audio/x-speex" + "audio/x-tta" + "audio/x-vorbis" + "audio/x-vorbis+ogg" + "audio/x-wav" + "audio/x-wavpack" + "audio/x-xm" + "x-content/audio-cdda" + "x-content/audio-player" + ] + (_: ["defaultAudioPlayer.desktop"]); + + browserTypes = + lib.genAttrs [ + "application/vnd.mozilla.xul+xml" + "application/x-extension-htm" + "application/x-extension-html" + "application/x-extension-shtml" + "application/x-extension-xht" + "application/x-extension-xhtml" + "application/xhtml+xml" + "text/html" + "text/xml" + "x-scheme-handler/chrome" + "x-scheme-handler/ftp" + "x-scheme-handler/http" + "x-scheme-handler/http" + "x-scheme-handler/https" + ] + (_: ["defaultWebBrowser.desktop"]); + + documentTypes = + lib.genAttrs [ + "application/illustrator" + "application/oxps" + "application/pdf" + "application/postscript" + "application/vnd.comicbook-rar" + "application/vnd.comicbook+zip" + "application/vnd.ms-xpsdocument" + "application/x-bzdvi" + "application/x-bzpdf" + "application/x-bzpostscript" + "application/x-cb7" + "application/x-cbr" + "application/x-cbt" + "application/x-cbz" + "application/x-dvi" + "application/x-ext-cb7" + "application/x-ext-cbr" + "application/x-ext-cbt" + "application/x-ext-cbz" + "application/x-ext-djv" + "application/x-ext-djvu" + "application/x-ext-dvi" + "application/x-ext-eps" + "application/x-ext-pdf" + "application/x-ext-ps" + "application/x-gzdvi" + "application/x-gzpdf" + "application/x-gzpostscript" + "application/x-xzpdf" + "image/tiff" + "image/vnd.djvu" + "image/x-bzeps" + "image/x-eps" + "image/x-gzeps" + ] + (_: ["defaultPdfViewer.desktop"]); + + editorTypes = + lib.genAttrs [ + "application/json" + "application/x-shellscript" + "application/x-shellscript" + "text/markdown" + "text/plain" + "text/x-python" + ] + (_: ["defaultEditor.desktop"]); + + folderTypes = {"inode/directory" = "defaultFIleManager.desktop";}; + + imageTypes = + lib.genAttrs [ + "image/bmp" + "image/gif" + "image/jpeg" + "image/jpg" + "image/pjpeg" + "image/png" + "image/svg+xml-compressed" + "image/svg+xml" + "image/tiff" + "image/vnd.wap.wbmp" + "image/webp" + "image/x-bmp" + "image/x-gray" + "image/x-icb" + "image/x-icns" + "image/x-ico" + "image/x-pcx" + "image/x-png" + "image/x-portable-anymap" + "image/x-portable-bitmap" + "image/x-portable-graymap" + "image/x-portable-pixmap" + "image/x-xbitmap" + "image/x-xpixmap" + ] + (_: ["defaultImageViewer.desktop"]); + + videoTypes = + lib.genAttrs [ + "application/mpeg4-iod" + "application/mpeg4-muxcodetable" + "application/vnd.apple.mpegurl" + "application/x-extension-m4a" + "application/x-extension-mp4" + "application/x-flash-video" + "application/x-matroska" + "video/3gp" + "video/3gpp" + "video/3gpp2" + "video/divx" + "video/dv" + "video/fli" + "video/flv" + "video/mp2t" + "video/mp4" + "video/mp4v-es" + "video/mpeg-system" + "video/mpeg" + "video/msvideo" + "video/ogg" + "video/quicktime" + "video/vnd.mpegurl" + "video/vnd.rn-realvideo" + "video/webm" + "video/x-avi" + "video/x-flc" + "video/x-fli" + "video/x-flv" + "video/x-m4v" + "video/x-matroska" + "video/x-mpeg-system" + "video/x-mpeg" + "video/x-mpeg2" + "video/x-ms-asf" + "video/x-ms-wm" + "video/x-ms-wmv" + "video/x-ms-wmx" + "video/x-msvideo" + "video/x-nsv" + "video/x-ogm+ogg" + "video/x-theora" + "video/x-theora+ogg" + "x-content/video-dvd" + ] + (_: ["defaultVideoPlayer.desktop"]); + in + audioTypes + // browserTypes + // documentTypes + // editorTypes + // folderTypes + // imageTypes + // videoTypes; }; desktopEntries = let