Modules/Mime: Fix duplicate keys with identical video and audio players
This commit is contained in:
@ -16,15 +16,27 @@ in {
|
|||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
defaultApplications = let
|
defaultApplications = let
|
||||||
associations = {
|
associations =
|
||||||
${mime.defaultTextEditor} = mime.textTypes;
|
{
|
||||||
${mime.defaultFileBrowser} = ["inode/directory"];
|
${mime.defaultTextEditor} = mime.textTypes;
|
||||||
${mime.defaultWebBrowser} = mime.webTypes;
|
${mime.defaultFileBrowser} = ["inode/directory"];
|
||||||
${mime.defaultPdfViewer} = ["application/pdf"];
|
${mime.defaultWebBrowser} = mime.webTypes;
|
||||||
${mime.defaultImageViewer} = mime.imageTypes;
|
${mime.defaultPdfViewer} = ["application/pdf"];
|
||||||
${mime.defaultAudioPlayer} = mime.audioTypes;
|
${mime.defaultImageViewer} = mime.imageTypes;
|
||||||
${mime.defaultVideoPlayer} = mime.videoTypes;
|
|
||||||
};
|
# 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
|
# Applied to a single app and a single type
|
||||||
# Result: { "image/jpg" = ["imv.desktop"]; }
|
# Result: { "image/jpg" = ["imv.desktop"]; }
|
||||||
|
Reference in New Issue
Block a user