home/mimetypes: refactor
This commit is contained in:
parent
f20a9bd89e
commit
0dc4fa7860
|
@ -1,143 +1,121 @@
|
||||||
{ lib, ... }:
|
{ lib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
mime = {
|
||||||
# Applications
|
image = {
|
||||||
google-chrome = "google-chrome.desktop";
|
apng = "image/apng";
|
||||||
firefox = "firefox.desktop";
|
avif = "image/avif";
|
||||||
gimp = "gimp.desktop";
|
|
||||||
inkscape = "org.inkscape.Inkscape.desktop";
|
|
||||||
vscode = "code.desktop";
|
|
||||||
mpv = "mpv.desktop";
|
|
||||||
zathura = "org.pwmt.zathura.desktop";
|
|
||||||
sxiv = "sxiv.desktop";
|
|
||||||
font-viewer = "org.gnome.font-viewer.desktop";
|
|
||||||
|
|
||||||
# Formats
|
|
||||||
"3g2-audio" = "audio/3gpp";
|
|
||||||
"3g2-video" = "video/3gpp";
|
|
||||||
"3gp-audio" = "audio/3gpp";
|
|
||||||
"3gp-video" = "video/3gpp";
|
|
||||||
aac = "audio/aac";
|
|
||||||
avi = "video/x-msvideo";
|
|
||||||
bmp = "image/bmp";
|
bmp = "image/bmp";
|
||||||
|
gif = "image/gif";
|
||||||
|
ico = "image/vnd.microsoft.icon";
|
||||||
|
icox = "image/x-icon";
|
||||||
|
jpg = "image/jpeg";
|
||||||
|
jxl = "image/jxl";
|
||||||
|
pic = "image/x-pict";
|
||||||
|
png = "image/png";
|
||||||
|
psd = "image/vnd.adobe.photoshop";
|
||||||
|
svg = "image/svg+xml";
|
||||||
|
tif = "image/tif";
|
||||||
|
tiff = "image/tiff";
|
||||||
|
webp = "image/webp";
|
||||||
|
xbm = "image/x-xbitmap";
|
||||||
|
xpm = "image/x-xpixmap";
|
||||||
|
};
|
||||||
|
|
||||||
|
audio = {
|
||||||
|
"3g2-audio" = "audio/3gpp";
|
||||||
|
"3gp-audio" = "audio/3gpp";
|
||||||
|
aac = "audio/aac";
|
||||||
|
aiff = "audio/aiff";
|
||||||
|
flac = "audio/flac";
|
||||||
|
mkv = "audio/x-matroska";
|
||||||
|
mpeg = "audio/mpeg"; # NOTE: this is the real mp3, but the other one also exists
|
||||||
|
mpeg3 = "audio/mpeg3";
|
||||||
|
mp3 = "audio/mp3";
|
||||||
|
mp4 = "audio/mp4";
|
||||||
|
ogg = "audio/ogg";
|
||||||
|
opus = "audio/opus";
|
||||||
|
wav = "audio/wav";
|
||||||
|
wavx = "audio/x-wav";
|
||||||
|
webm-audio = "audio/webm";
|
||||||
|
};
|
||||||
|
|
||||||
|
video = {
|
||||||
|
"3g2-video" = "video/3gpp";
|
||||||
|
"3gp-video" = "video/3gpp";
|
||||||
|
avi = "video/x-msvideo";
|
||||||
|
flv = "video/x-flv";
|
||||||
|
m4v = "video/x-m4v";
|
||||||
|
mkv = "video/x-matroska";
|
||||||
|
mov = "video/quicktime";
|
||||||
|
mp4 = "video/mp4";
|
||||||
|
mpeg = "video/mpeg";
|
||||||
|
ogv = "video/ogg";
|
||||||
|
webm-video = "video/webm";
|
||||||
|
wmv = "video/x-ms-wmv";
|
||||||
|
};
|
||||||
|
|
||||||
|
font = {
|
||||||
|
otf = "font/otf";
|
||||||
|
ttf = "font/ttf";
|
||||||
|
woff = "font/woff";
|
||||||
|
woff2 = "font/woff2";
|
||||||
|
};
|
||||||
|
|
||||||
|
documents = {
|
||||||
|
azv = "application/vnd.amazon.ebook";
|
||||||
cbr = "application/vnd.comicbook+rar";
|
cbr = "application/vnd.comicbook+rar";
|
||||||
cbrx = "application/x-cbr";
|
cbrx = "application/x-cbr";
|
||||||
cbz = "application/vnd.comicbook+zip";
|
cbz = "application/vnd.comicbook+zip";
|
||||||
cbzx = "application/x-cbz";
|
cbzx = "application/x-cbz";
|
||||||
djvu = "image/vnd.djvu";
|
djvu = "image/vnd.djvu";
|
||||||
epub = "application/epub+zip";
|
epub = "application/epub+zip";
|
||||||
flv = "video/x-flv";
|
|
||||||
gif = "image/gif";
|
|
||||||
html = "text/html";
|
|
||||||
http = "x-scheme-handler/http";
|
|
||||||
https = "x-scheme-handler/https";
|
|
||||||
ico = "image/vnd.microsoft.icon";
|
|
||||||
icox = "image/x-icon";
|
|
||||||
ini = "application/x-wine-extension-ini";
|
|
||||||
jpg = "image/jpeg";
|
|
||||||
m4v = "video/x-m4v";
|
|
||||||
mkv = "video/x-matroska";
|
|
||||||
mov = "video/quicktime";
|
|
||||||
mp3 = "audio/mpeg";
|
|
||||||
mp4 = "video/mp4";
|
|
||||||
mpeg = "video/mpeg";
|
|
||||||
ogg = "audio/ogg";
|
|
||||||
ogv = "video/ogg";
|
|
||||||
opus = "audio/opus";
|
|
||||||
otf = "font/otf";
|
|
||||||
pdf = "application/pdf";
|
pdf = "application/pdf";
|
||||||
pic = "image/x-pict";
|
};
|
||||||
png = "image/png";
|
|
||||||
psd = "image/vnd.adobe.photoshop";
|
code = {
|
||||||
svg = "image/svg+xml";
|
css = "text/css";
|
||||||
tiff = "image/tiff";
|
csv = "text/csv";
|
||||||
ttf = "font/ttf";
|
html = "text/html";
|
||||||
txt = "text/plain";
|
txt = "text/plain";
|
||||||
url = "application/x-mswinurl";
|
|
||||||
wav = "audio/wav";
|
|
||||||
wavx = "audio/x-wav";
|
|
||||||
webm-audio = "audio/webm";
|
|
||||||
webm-video = "video/webm";
|
|
||||||
webp = "image/webp";
|
|
||||||
wmv = "video/x-ms-wmv";
|
|
||||||
woff = "font/woff";
|
|
||||||
woff2 = "font/woff2";
|
|
||||||
xbm = "image/x-xbitmap";
|
|
||||||
xcf = "image/x-xcf";
|
|
||||||
xhtml = "application/xhtml+xml";
|
xhtml = "application/xhtml+xml";
|
||||||
xml = "text/xml";
|
xml = "text/xml";
|
||||||
xpm = "image/x-xpixmap";
|
};
|
||||||
|
|
||||||
|
misc = {
|
||||||
|
http = "x-scheme-handler/http";
|
||||||
|
https = "x-scheme-handler/https";
|
||||||
|
wine-ini = "application/x-wine-extension-ini";
|
||||||
|
ics = "text/calendar";
|
||||||
|
url = "application/x-mswinurl";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
# Generalizations
|
# Applications
|
||||||
audio-player = mpv;
|
firefox = "firefox.desktop";
|
||||||
gui-text-editor = vscode;
|
vscode = "code.desktop";
|
||||||
image-viewer = sxiv;
|
mpv = "mpv.desktop";
|
||||||
pdf-viewer = zathura;
|
zathura = "org.pwmt.zathura.desktop";
|
||||||
video-player = mpv;
|
sxiv = "sxiv.desktop";
|
||||||
web-browser = firefox;
|
font-viewer = "org.gnome.font-viewer.desktop";
|
||||||
|
|
||||||
in {
|
in {
|
||||||
|
|
||||||
xdg.configFile."mimeapps.list".force = true;
|
xdg.configFile."mimeapps.list".force = true;
|
||||||
xdg.mimeApps = {
|
xdg.mimeApps = {
|
||||||
enable = true;
|
enable = true;
|
||||||
# associations.added = {};
|
# associations.added = {};
|
||||||
# associations.removed = {};
|
# associations.removed = {};
|
||||||
defaultApplications = {
|
defaultApplications =
|
||||||
${"3g2-audio"} = audio-player;
|
(lib.mapAttrs' (_: v: lib.nameValuePair v sxiv) mime.image)
|
||||||
${"3g2-video"} = video-player;
|
// (lib.mapAttrs' (_: v: lib.nameValuePair v mpv) mime.audio)
|
||||||
${"3gp-audio"} = audio-player;
|
// (lib.mapAttrs' (_: v: lib.nameValuePair v mpv) mime.video)
|
||||||
${"3gp-video"} = video-player;
|
// (lib.mapAttrs' (_: v: lib.nameValuePair v font-viewer) mime.font)
|
||||||
${aac} = audio-player;
|
// (lib.mapAttrs' (_: v: lib.nameValuePair v zathura) mime.documents)
|
||||||
${avi} = video-player;
|
// (lib.mapAttrs' (_: v: lib.nameValuePair v vscode) mime.code)
|
||||||
${bmp} = image-viewer;
|
// {
|
||||||
${cbrx} = zathura;
|
${mime.misc.http} = firefox;
|
||||||
${cbr} = zathura;
|
${mime.misc.https} = firefox;
|
||||||
${cbzx} = zathura;
|
${mime.misc.wine-ini} = vscode;
|
||||||
${cbz} = zathura;
|
${mime.misc.ics} = vscode;
|
||||||
${djvu} = pdf-viewer;
|
${mime.misc.url} = firefox;
|
||||||
${epub} = zathura;
|
|
||||||
${flv} = video-player;
|
|
||||||
${gif} = image-viewer;
|
|
||||||
${html} = web-browser;
|
|
||||||
${https} = web-browser;
|
|
||||||
${http} = web-browser;
|
|
||||||
${icox} = image-viewer;
|
|
||||||
${ico} = image-viewer;
|
|
||||||
${jpg} = image-viewer;
|
|
||||||
${m4v} = video-player;
|
|
||||||
${mkv} = video-player;
|
|
||||||
${mov} = video-player;
|
|
||||||
${mp3} = audio-player;
|
|
||||||
${mp4} = video-player;
|
|
||||||
${mpeg} = video-player;
|
|
||||||
${ogg} = audio-player;
|
|
||||||
${ogv} = video-player;
|
|
||||||
${opus} = audio-player;
|
|
||||||
${otf} = font-viewer;
|
|
||||||
${pdf} = pdf-viewer;
|
|
||||||
${pic} = image-viewer;
|
|
||||||
${png} = image-viewer;
|
|
||||||
${psd} = gimp;
|
|
||||||
${svg} = image-viewer;
|
|
||||||
${tiff} = image-viewer;
|
|
||||||
${ttf} = font-viewer;
|
|
||||||
${txt} = gui-text-editor;
|
|
||||||
${url} = web-browser;
|
|
||||||
${wav} = audio-player;
|
|
||||||
${webm-audio} = audio-player;
|
|
||||||
${webm-video} = video-player;
|
|
||||||
${webp} = image-viewer;
|
|
||||||
${wmv} = video-player;
|
|
||||||
${woff2} = font-viewer;
|
|
||||||
${woff} = font-viewer;
|
|
||||||
${xbm} = image-viewer;
|
|
||||||
${xcf} = gimp;
|
|
||||||
${xhtml} = web-browser;
|
|
||||||
${xml} = gui-text-editor;
|
|
||||||
${xpm} = image-viewer;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue