Commit 757fc54

HPCesia <me@hpcesia.com>
2025-06-02 09:17:29
feat: xdg default application
1 parent 7ae6f05
Changed files (1)
home
linux
home/linux/gui/xdg.nix
@@ -0,0 +1,51 @@
+{
+  config,
+  pkgs,
+  ...
+}: {
+  home.packages = with pkgs; [
+    xdg-utils # provides cli tools such as `xdg-mime` `xdg-open`
+    xdg-user-dirs
+  ];
+
+  xdg.configFile."mimeapps.list".force = true;
+  xdg = {
+    enable = true;
+
+    cacheHome = "${config.home.homeDirectory}/.cache";
+    configHome = "${config.home.homeDirectory}/.config";
+    dataHome = "${config.home.homeDirectory}/.local/share";
+    stateHome = "${config.home.homeDirectory}/.local/state";
+
+    mimeApps = {
+      enable = true;
+      defaultApplications = let
+        browser = ["firefox.desktop"];
+        editor = ["Helix.desktop" "code.desktop"];
+      in {
+        "application/json" = browser;
+
+        "text/html" = browser;
+        "text/xml" = browser;
+        "text/plain" = editor;
+        "application/xml" = browser;
+        "application/xhtml+xml" = browser;
+        "application/xhtml_xml" = browser;
+        "application/rdf+xml" = browser;
+        "application/rss+xml" = browser;
+        "application/x-extension-htm" = browser;
+        "application/x-extension-html" = browser;
+        "application/x-extension-shtml" = browser;
+        "application/x-extension-xht" = browser;
+        "application/x-extension-xhtml" = browser;
+
+        "x-scheme-handler/about" = browser;
+        "x-scheme-handler/ftp" = browser;
+        "x-scheme-handler/http" = browser;
+        "x-scheme-handler/https" = browser;
+        "x-scheme-handler/tg" = ["org.telegram.desktop.desktop "];
+        "x-scheme-handler/tonsite" = ["org.telegram.desktop.desktop "];
+      };
+    };
+  };
+}