1

Modules/Mime: Fix duplicate keys with identical video and audio players

This commit is contained in:
2025-07-08 19:05:26 +02:00
parent 278775c0fe
commit 1495d0935d

View File

@ -16,15 +16,27 @@ in {
enable = true;
defaultApplications = let
associations = {
${mime.defaultTextEditor} = mime.textTypes;
${mime.defaultFileBrowser} = ["inode/directory"];
${mime.defaultWebBrowser} = mime.webTypes;
${mime.defaultPdfViewer} = ["application/pdf"];
${mime.defaultImageViewer} = mime.imageTypes;
${mime.defaultAudioPlayer} = mime.audioTypes;
${mime.defaultVideoPlayer} = mime.videoTypes;
};
associations =
{
${mime.defaultTextEditor} = mime.textTypes;
${mime.defaultFileBrowser} = ["inode/directory"];
${mime.defaultWebBrowser} = mime.webTypes;
${mime.defaultPdfViewer} = ["application/pdf"];
${mime.defaultImageViewer} = mime.imageTypes;
# If audio and video player are equal, we assign all types to the audio player,
# as multiple identical keys cannot exist in attrsets.
${mime.defaultAudioPlayer} =
mime.audioTypes
++ (lib.optionals
(mime.defaultAudioPlayer == mime.defaultVideoPlayer)
mime.videoTypes);
}
# If audio and video player are not equal, we associate the video types with
# the chosen video player. Otherwise video types will be included with audio.
// (lib.optionalAttrs (mime.defaultAudioPlayer != mime.defaultVideoPlayer) {
${mime.defaultVideoPlayer} = mime.videoTypes;
});
# Applied to a single app and a single type
# Result: { "image/jpg" = ["imv.desktop"]; }