From 40e08b4821b1ff69017d34690138ffdb9601663c Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Fri, 16 Jun 2023 11:41:34 -0400 Subject: [PATCH] joshuto: Nixify mimetypes --- home/joshuto/default.nix | 325 +++++++++++++++++++-------------------- 1 file changed, 159 insertions(+), 166 deletions(-) diff --git a/home/joshuto/default.nix b/home/joshuto/default.nix index 78833ed..d2dbb6d 100644 --- a/home/joshuto/default.nix +++ b/home/joshuto/default.nix @@ -20,6 +20,165 @@ }; }; + mimetype = { + class = { + audio_default = [ + { command = "mpv"; args = [ "--" ]; } + { command = "mediainfo"; confirm_exit = true; } + ]; + + image_default = [ + { command = "feh"; args = [ "--" ]; fork = true; silent = true; } + ]; + + video_default = [ + { command = "mpv"; args = [ "--" ]; fork = true; silent = true; } + { command = "mediainfo"; confirm_exit = true; } + { command = "mpv"; args = [ "--mute" "on" "--" ]; fork = true; silent = true; } + ]; + + text_default = [ + { command = "nvim"; } + ]; + + reader_default = [ + { command = "zathura"; fork = true; silent = true; } + ]; + + libreoffice_default = [ + { command = "libreoffice"; fork = true; silent = true; } + ]; + }; + + extension = { + ## image formats + avif."inherit" = "image_default"; + bmp."inherit" = "image_default"; + gif."inherit" = "image_default"; + heic."inherit" = "image_default"; + jpeg."inherit" = "image_default"; + jpe."inherit" = "image_default"; + jpg."inherit" = "image_default"; + pgm."inherit" = "image_default"; + png."inherit" = "image_default"; + ppm."inherit" = "image_default"; + webp."inherit" = "image_default"; + + ## audio formats + flac."inherit" = "audio_default"; + m4a."inherit" = "audio_default"; + mp3."inherit" = "audio_default"; + ogg."inherit" = "audio_default"; + wav."inherit" = "audio_default"; + + ## video formats + avi."inherit" = "video_default"; + av1."inherit" = "video_default"; + flv."inherit" = "video_default"; + mkv."inherit" = "video_default"; + m4v."inherit" = "video_default"; + mov."inherit" = "video_default"; + mp4."inherit" = "video_default"; + ts."inherit" = "video_default"; + webm."inherit" = "video_default"; + wmv."inherit" = "video_default"; + + ## text formats + build."inherit" = "text_default"; + c."inherit" = "text_default"; + cmake."inherit" = "text_default"; + conf."inherit" = "text_default"; + cpp."inherit" = "text_default"; + css."inherit" = "text_default"; + csv."inherit" = "text_default"; + cu."inherit" = "text_default"; + ebuild."inherit" = "text_default"; + eex."inherit" = "text_default"; + env."inherit" = "text_default"; + ex."inherit" = "text_default"; + exs."inherit" = "text_default"; + go."inherit" = "text_default"; + h."inherit" = "text_default"; + hpp."inherit" = "text_default"; + hs."inherit" = "text_default"; + html."inherit" = "text_default"; + ini."inherit" = "text_default"; + java."inherit" = "text_default"; + js."inherit" = "text_default"; + json."inherit" = "text_default"; + kt."inherit" = "text_default"; + lock."inherit" = "text_default"; + lua."inherit" = "text_default"; + log."inherit" = "text_default"; + md."inherit" = "text_default"; + micro."inherit" = "text_default"; + ninja."inherit" = "text_default"; + py."inherit" = "text_default"; + rkt."inherit" = "text_default"; + rs."inherit" = "text_default"; + scss."inherit" = "text_default"; + sh."inherit" = "text_default"; + srt."inherit" = "text_default"; + svelte."inherit" = "text_default"; + toml."inherit" = "text_default"; + tsx."inherit" = "text_default"; + txt."inherit" = "text_default"; + vim."inherit" = "text_default"; + xml."inherit" = "text_default"; + yaml."inherit" = "text_default"; + yml."inherit" = "text_default"; + + # archive formats + "7z".app_list = [ { command = "7z"; args = [ "x" ]; confirm_exit = true; } ]; + rar.app_list = [ + { command = "unrar"; args = [ "x" ]; confirm_exit = true; } + { command = "file-roller"; fork = true; silent = true; } ]; + zip.app_list = [ + { command = "unzip"; confirm_exit = true; } + { command = "file-roller"; fork = true; silent = true; } ]; + + # misc formats + aup.app_list = [ + { command = "audacity"; fork = true; silent = true; } ]; + + odt."inherit" = "libreoffice_default"; + odf."inherit" = "libreoffice_default"; + ods."inherit" = "libreoffice_default"; + odp."inherit" = "libreoffice_default"; + + doc."inherit" = "libreoffice_default"; + docx."inherit" = "libreoffice_default"; + xls."inherit" = "libreoffice_default"; + xlsx."inherit" = "libreoffice_default"; + ppt."inherit" = "libreoffice_default"; + pptx."inherit" = "libreoffice_default"; + + pdf."inherit" = "reader_default"; + + kra.app_list = [ + { command = "krita"; fork = true; silent = true; } + ]; + kdenlive.app_list = [ + { command = "kdenlive"; fork = true; silent = true; } + ]; + + tex.app_list = [ + { command = "micro"; } + { command = "gedit"; fork = true; silent = true; } + { command = "bat"; confirm_exit = true; } + { command = "pdflatex"; } ]; + + torrent.app_list = [ + { command = "transmission-gtk"; } ]; + }; + + mimetype = { + application.subtype.octet-stream."inherit" = "video_default"; + text."inherit" = "text_default"; + video."inherit" = "video_default"; + }; + }; + keymap = { default_view = { keymap = [ @@ -279,172 +438,6 @@ xdg.configFile."joshuto/kitty-show.sh".source = ./kitty-show.sh; xdg.configFile."joshuto/kitty-remove.sh".source = ./kitty-remove.sh; - xdg.configFile."joshuto/mimetype.toml".text = /* toml */ '' - [class] - audio_default = [ - { command = "mpv", args = [ "--" ] }, - { command = "mediainfo", confirm_exit = true }, - ] - - image_default = [ - { command = "feh", args = [ "--" ], fork = true, silent = true }, - ] - - video_default = [ - { command = "mpv", args = [ "--" ] , fork = true, silent = true }, - { command = "mediainfo", confirm_exit = true }, - { command = "mpv", args = [ "--mute", "on", "--" ], fork = true, silent = true }, - ] - - text_default = [ - { command = "nvim" }, - ] - - reader_default = [ - { command = "zathura", fork = true, silent = true }, - ] - - libreoffice_default = [ - { command = "libreoffice", fork = true, silent = true }, - ] - - [extension] - - ## image formats - avif.inherit = "image_default" - bmp.inherit = "image_default" - gif.inherit = "image_default" - heic.inherit = "image_default" - jpeg.inherit = "image_default" - jpe.inherit = "image_default" - jpg.inherit = "image_default" - pgm.inherit = "image_default" - png.inherit = "image_default" - ppm.inherit = "image_default" - webp.inherit = "image_default" - - ## audio formats - flac.inherit = "audio_default" - m4a.inherit = "audio_default" - mp3.inherit = "audio_default" - ogg.inherit = "audio_default" - wav.inherit = "audio_default" - - ## video formats - avi.inherit = "video_default" - av1.inherit = "video_default" - flv.inherit = "video_default" - mkv.inherit = "video_default" - m4v.inherit = "video_default" - mov.inherit = "video_default" - mp4.inherit = "video_default" - ts.inherit = "video_default" - webm.inherit = "video_default" - wmv.inherit = "video_default" - - ## text formats - build.inherit = "text_default" - c.inherit = "text_default" - cmake.inherit = "text_default" - conf.inherit = "text_default" - cpp.inherit = "text_default" - css.inherit = "text_default" - csv.inherit = "text_default" - cu.inherit = "text_default" - ebuild.inherit = "text_default" - eex.inherit = "text_default" - env.inherit = "text_default" - ex.inherit = "text_default" - exs.inherit = "text_default" - go.inherit = "text_default" - h.inherit = "text_default" - hpp.inherit = "text_default" - hs.inherit = "text_default" - html.inherit = "text_default" - ini.inherit = "text_default" - java.inherit = "text_default" - js.inherit = "text_default" - json.inherit = "text_default" - kt.inherit = "text_default" - lock.inherit = "text_default" - lua.inherit = "text_default" - log.inherit = "text_default" - md.inherit = "text_default" - micro.inherit = "text_default" - ninja.inherit = "text_default" - py.inherit = "text_default" - rkt.inherit = "text_default" - rs.inherit = "text_default" - scss.inherit = "text_default" - sh.inherit = "text_default" - srt.inherit = "text_default" - svelte.inherit = "text_default" - toml.inherit = "text_default" - tsx.inherit = "text_default" - txt.inherit = "text_default" - vim.inherit = "text_default" - xml.inherit = "text_default" - yaml.inherit = "text_default" - yml.inherit = "text_default" - - # archive formats - 7z.app_list = [ { command = "7z", args = [ "x" ], confirm_exit = true } ] - rar.app_list = [ - { command = "unrar", args = [ "x" ], confirm_exit = true }, - { command = "file-roller", fork = true, silent = true } ] - zip.app_list = [ - { command = "unzip", confirm_exit = true }, - { command = "file-roller", fork = true, silent = true } ] - - # misc formats - aup.app_list = [ - { command = "audacity", fork = true, silent = true } ] - - odt.inherit = "libreoffice_default" - odf.inherit = "libreoffice_default" - ods.inherit = "libreoffice_default" - odp.inherit = "libreoffice_default" - - doc.inherit = "libreoffice_default" - docx.inherit = "libreoffice_default" - xls.inherit = "libreoffice_default" - xlsx.inherit = "libreoffice_default" - ppt.inherit = "libreoffice_default" - pptx.inherit = "libreoffice_default" - - pdf.inherit = "reader_default" - - kra.app_list = [ - { command = "krita", fork = true, silent = true } - ] - kdenlive.app_list = [ - { command = "kdenlive", fork = true, silent = true } - ] - - tex.app_list = [ - { command = "micro" }, - { command = "gedit", fork = true, silent = true }, - { command = "bat", confirm_exit = true }, - { command = "pdflatex" } ] - - torrent.app_list = [ - { command = "transmission-gtk" } ] - - [mimetype] - - # application/octet-stream - [mimetype.application.subtype.octet-stream] - inherit = "video_default" - - # text/* - [mimetype.text] - inherit = "text_default" - - # text/* - [mimetype.video] - inherit = "video_default" - ''; - xdg.configFile."joshuto/icons.toml".text = /* toml */ '' # Default fallback icons [defaults]