修改mimeapps.list的配置方式

This commit is contained in:
2025-05-19 10:41:29 +08:00
parent 91b8e65a79
commit b1540dfb96
7 changed files with 99 additions and 108 deletions

View File

@@ -0,0 +1,31 @@
[Default Applications]
application/json=microsoft-edge.desktop
application/pdf=microsoft-edge.desktop
application/rdf+xml=microsoft-edge.desktop
application/rss+xml=microsoft-edge.desktop
application/x-extension-htm=microsoft-edge.desktop
application/x-extension-html=microsoft-edge.desktop
application/x-extension-shtml=microsoft-edge.desktop
application/x-extension-xht=microsoft-edge.desktop
application/x-extension-xhtml=microsoft-edge.desktop
application/xhtml+xml=microsoft-edge.desktop
application/xhtml_xml=microsoft-edge.desktop
application/xml=microsoft-edge.desktop
audio/*=vlc.desktop
image/*=imv.desktop
image/gif=imv.desktop
image/jpeg=imv.desktop
image/png=imv.desktop
image/webp=imv.desktop
inode/directory=nemo.desktop;xdg-open.desktop;nemo.desktop;thunar.desktop;org.gnome.Nautilus.desktop
text/html=microsoft-edge.desktop
text/xml=microsoft-edge.desktop
video/*=vlc.dekstop
x-scheme-handler/about=microsoft-edge.desktop
x-scheme-handler/discord=discord.desktop
x-scheme-handler/ftp=microsoft-edge.desktop
x-scheme-handler/http=microsoft-edge.desktop
x-scheme-handler/https=microsoft-edge.desktop
x-scheme-handler/tg=telegramdesktop.desktop
x-scheme-handler/unknown=microsoft-edge.desktop
text/plain=code.desktop

View File

@@ -0,0 +1,51 @@
# XDG stands for "Cross-Desktop Group", with X used to mean "cross".
# It's a bunch of specifications from freedesktop.org intended to standardize desktops and
# other GUI applications on various systems (primarily Unix-like) to be interoperable:
# https://www.freedesktop.org/wiki/Specifications/
{ config, pkgs, ... }: {
home.packages = with pkgs; [
xdg-utils # provides cli tools such as `xdg-mime` `xdg-open`
xdg-user-dirs
];
xdg = {
enable = true;
cacheHome = config.home.homeDirectory + "/.cache";
# manage $XDG_CONFIG_HOME/mimeapps.list
# xdg search all desktop entries from $XDG_DATA_DIRS, check it by command:
# echo $XDG_DATA_DIRS
# the system-level desktop entries can be list by command:
# ls -l /run/current-system/sw/share/applications/
# the user-level desktop entries can be list by command(user ryan):
# ls /etc/profiles/per-user/ryan/share/applications/
userDirs = {
enable = true;
createDirectories = false;
documents = config.home.homeDirectory + "/doc";
music = config.home.homeDirectory + "/doc/music";
desktop = config.home.homeDirectory + "/tmp";
download = config.home.homeDirectory + "/tmp";
videos = config.home.homeDirectory + "/tmp";
pictures = config.home.homeDirectory + "/tmp";
# templates = config.home.homeDirectory + "/tmp";
# publicShare = config.home.homeDirectory + "/tmp";
extraConfig = {
XDG_SCREENSHOTS_DIR = config.home.homeDirectory + "/tmp/Screenshots";
};
};
};
# 使用map函数循环 conf 变量,动态的生成 home.file.<user>.config.${i}
xdg.configFile = builtins.listToAttrs
(builtins.map
(name: {
inherit name;
value = {
source = config.home-libs.mkOutOfStoreSymlink "modules/home/xdg/conf/${name}";
};
})
(builtins.attrNames (builtins.readDir ./conf))
);
}