修改mimeapps.list的配置方式
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
./core.nix
|
||||
../modules/home/vscode
|
||||
../modules/home/zsh
|
||||
../modules/home/xdg.nix
|
||||
../modules/home/xdg
|
||||
../modules/home/theme.nix
|
||||
../modules/home/fcitx.nix
|
||||
../modules/home/wechat.nix
|
||||
|
||||
@@ -49,11 +49,9 @@
|
||||
"augment.chat.userGuidelines": "Always response in 中文",
|
||||
"augment.completions.enableAutomaticCompletions": true,
|
||||
"editor.fontFamily": "'Source Code Pro', 'JetBrainsMono Nerd Font'",
|
||||
"github.copilot.enable": {
|
||||
"*": true,
|
||||
"plaintext": false,
|
||||
"markdown": false,
|
||||
"scminput": false,
|
||||
"nix": true
|
||||
}
|
||||
"github.copilot.nextEditSuggestions.enabled": true,
|
||||
"update.mode": "none",
|
||||
"github.copilot.chat.localeOverride": "zh-CN",
|
||||
"github.copilot.selectedCompletionModel": "GPT-4.1",
|
||||
"diffEditor.ignoreTrimWhitespace": false
|
||||
}
|
||||
@@ -25,12 +25,15 @@ in
|
||||
});
|
||||
};
|
||||
|
||||
xdg.configFile = {
|
||||
"Code/User/keybindings.json" = {
|
||||
source = config.home-libs.mkOutOfStoreSymlink "modules/home/vscode/keybindings.json";
|
||||
};
|
||||
"Code/User/settings.json" = {
|
||||
source = config.home-libs.mkOutOfStoreSymlink "modules/home/vscode/settings.json";
|
||||
};
|
||||
};
|
||||
# 使用map函数循环 conf 变量,动态的生成 home.file.<user>.config.${i}
|
||||
xdg.configFile = builtins.listToAttrs
|
||||
(builtins.map
|
||||
(name: {
|
||||
name = "Code/User/${name}";
|
||||
value = {
|
||||
source = config.home-libs.mkOutOfStoreSymlink "modules/home/vscode/conf/${name}";
|
||||
};
|
||||
})
|
||||
(builtins.attrNames (builtins.readDir ./conf))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
# 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/
|
||||
mimeApps = {
|
||||
enable = true;
|
||||
defaultApplications =
|
||||
let
|
||||
browser = [ "microsoft-edge.desktop" ];
|
||||
in
|
||||
{
|
||||
"application/json" = browser;
|
||||
"application/pdf" = browser; # TODO: pdf viewer
|
||||
|
||||
"text/html" = browser;
|
||||
"text/xml" = browser;
|
||||
"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/unknown" = browser;
|
||||
|
||||
"x-scheme-handler/discord" = [ "discord.desktop" ];
|
||||
"x-scheme-handler/tg" = [ "telegramdesktop.desktop" ];
|
||||
|
||||
"audio/*" = [ "vlc.desktop" ];
|
||||
"video/*" = [ "vlc.dekstop" ];
|
||||
"image/*" = [ "imv.desktop" ];
|
||||
"image/gif" = [ "imv.desktop" ];
|
||||
"image/jpeg" = [ "imv.desktop" ];
|
||||
"image/png" = [ "imv.desktop" ];
|
||||
"image/webp" = [ "imv.desktop" ];
|
||||
|
||||
"inode/directory" = [ ]
|
||||
++ (if config.xdg.enable then [ "nemo.desktop" ] else [ ])
|
||||
++ (if config.xdg.enable then [ "xdg-open.desktop" ] else [ ])
|
||||
++ (if config.xdg.enable then [ "nemo.desktop" ] else [ ])
|
||||
++ (if config.xdg.enable then [ "thunar.desktop" ] else [ ])
|
||||
++ (if config.xdg.enable then [ "org.gnome.Nautilus.desktop" ] else [ ]);
|
||||
};
|
||||
|
||||
associations.removed =
|
||||
{
|
||||
# ......
|
||||
};
|
||||
};
|
||||
|
||||
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";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
31
modules/home/xdg/conf/mimeapps.list
Normal file
31
modules/home/xdg/conf/mimeapps.list
Normal 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
|
||||
51
modules/home/xdg/default.nix
Normal file
51
modules/home/xdg/default.nix
Normal 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))
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user