From 718c86b6d4fa083cbb5469a4601410f5886ebfdc Mon Sep 17 00:00:00 2001 From: jacekpoz Date: Fri, 1 Nov 2024 23:35:55 +0100 Subject: [PATCH] separate xdg config into mime apps and xdg ninja --- hosts/common/desktop/xdg-mime-apps.nix | 59 +++++++++++++++++++ .../common/desktop/{xdg.nix => xdg-ninja.nix} | 50 ---------------- 2 files changed, 59 insertions(+), 50 deletions(-) create mode 100644 hosts/common/desktop/xdg-mime-apps.nix rename hosts/common/desktop/{xdg.nix => xdg-ninja.nix} (51%) diff --git a/hosts/common/desktop/xdg-mime-apps.nix b/hosts/common/desktop/xdg-mime-apps.nix new file mode 100644 index 0000000..b783c8e --- /dev/null +++ b/hosts/common/desktop/xdg-mime-apps.nix @@ -0,0 +1,59 @@ +{ + config, + ... +}: let + inherit (config.poz.other.system) username; +in { + home-manager.users.${username} = { + xdg.mimeApps = { + enable = true; + defaultApplications = let + primary_browser = "firefox-schizo.desktop"; + secondary_browser = "firefox-unschizo.desktop"; + mail_client = "thunderbird.desktop"; + file_manager = "pcmanfm.desktop"; + media_player = "mpv.desktop"; + image_viewer = "imv.desktop"; + text_editor = "nvim.desktop"; + in { + "text/html" = [ primary_browser secondary_browser ]; + "x-scheme-handler/http" = [ primary_browser secondary_browser ]; + "x-scheme-handler/https" = [ primary_browser secondary_browser ]; + "x-scheme-handler/about" = [ primary_browser secondary_browser ]; + "x-scheme-handler/unknown" = [ primary_browser secondary_browser ]; + "x-scheme-handler/mailto" = [ mail_client ]; + "message/rfc822" = [ mail_client ]; + "x-scheme-handler/mid" = [ mail_client ]; + "inode/directory" = [ file_manager ]; + "x-scheme-handler/heroic" = [ "heroic.desktop" ]; + "audio/mp3" = [ media_player ]; + "audio/ogg" = [ media_player ]; + "audio/mpeg" = [ media_player ]; + "audio/aac" = [ media_player ]; + "audio/opus" = [ media_player ]; + "audio/wav" = [ media_player ]; + "audio/webm" = [ media_player ]; + "audio/3gpp" = [ media_player ]; + "audio/3gpp2" = [ media_player ]; + "video/mp4" = [ media_player ]; + "video/x-msvideo" = [ media_player ]; + "video/mpeg" = [ media_player ]; + "video/ogg" = [ media_player ]; + "video/mp2t" = [ media_player ]; + "video/webm" = [ media_player ]; + "video/3gpp" = [ media_player ]; + "video/3gpp2" = [ media_player ]; + "image/png" = [ image_viewer ]; + "image/jpeg" = [ image_viewer ]; + "image/gif" = [ media_player ]; + "image/avif" = [ image_viewer ]; + "image/bmp" = [ image_viewer ]; + "image/vnd.microsoft.icon" = [ image_viewer ]; + "image/svg+xml" = [ image_viewer ]; + "image/tiff" = [ image_viewer ]; + "image/webp" = [ image_viewer ]; + "text/plain" = [ text_editor ]; + }; + }; + }; +} diff --git a/hosts/common/desktop/xdg.nix b/hosts/common/desktop/xdg-ninja.nix similarity index 51% rename from hosts/common/desktop/xdg.nix rename to hosts/common/desktop/xdg-ninja.nix index f9731aa..f2b3db9 100644 --- a/hosts/common/desktop/xdg.nix +++ b/hosts/common/desktop/xdg-ninja.nix @@ -79,56 +79,6 @@ in { configHome = XDG_CONFIG_HOME; dataHome = XDG_DATA_HOME; stateHome = XDG_STATE_HOME; - mimeApps = { - enable = true; - defaultApplications = let - primary_browser = "firefox-schizo.desktop"; - secondary_browser = "firefox-unschizo.desktop"; - mail_client = "thunderbird.desktop"; - file_manager = "pcmanfm.desktop"; - media_player = "mpv.desktop"; - image_viewer = "imv.desktop"; - text_editor = "nvim.desktop"; - in{ - "text/html" = [ primary_browser secondary_browser ]; - "x-scheme-handler/http" = [ primary_browser secondary_browser ]; - "x-scheme-handler/https" = [ primary_browser secondary_browser ]; - "x-scheme-handler/about" = [ primary_browser secondary_browser ]; - "x-scheme-handler/unknown" = [ primary_browser secondary_browser ]; - "x-scheme-handler/mailto" = [ mail_client ]; - "message/rfc822" = [ mail_client ]; - "x-scheme-handler/mid" = [ mail_client ]; - "inode/directory" = [ file_manager ]; - "x-scheme-handler/heroic" = [ "heroic.desktop" ]; - "audio/mp3" = [ media_player ]; - "audio/ogg" = [ media_player ]; - "audio/mpeg" = [ media_player ]; - "audio/aac" = [ media_player ]; - "audio/opus" = [ media_player ]; - "audio/wav" = [ media_player ]; - "audio/webm" = [ media_player ]; - "audio/3gpp" = [ media_player ]; - "audio/3gpp2" = [ media_player ]; - "video/mp4" = [ media_player ]; - "video/x-msvideo" = [ media_player ]; - "video/mpeg" = [ media_player ]; - "video/ogg" = [ media_player ]; - "video/mp2t" = [ media_player ]; - "video/webm" = [ media_player ]; - "video/3gpp" = [ media_player ]; - "video/3gpp2" = [ media_player ]; - "image/png" = [ image_viewer ]; - "image/jpeg" = [ image_viewer ]; - "image/gif" = [ media_player ]; - "image/avif" = [ image_viewer ]; - "image/bmp" = [ image_viewer ]; - "image/vnd.microsoft.icon" = [ image_viewer ]; - "image/svg+xml" = [ image_viewer ]; - "image/tiff" = [ image_viewer ]; - "image/webp" = [ image_viewer ]; - "text/plain" = [ text_editor ]; - }; - }; }; }; }