main
1{den, ...}: {
2 den.aspects.desktop.app.mpv = {
3 cacheHome = {config, ...}: {
4 directories = [
5 "${config.xdg.stateHome}/mpv"
6 ];
7 };
8
9 homeManager = {pkgs, ...}: {
10 programs.mpv = {
11 enable = true;
12 defaultProfiles = ["gpu-hq"];
13 scripts = with pkgs.mpvScripts; [
14 mpris
15 uosc
16 thumbfast
17 autoload
18 reload
19 mpv-playlistmanager
20 ];
21 config = {
22 vo = "gpu-next";
23 hwdec = "auto-copy";
24 scale = "ewa_lanczossharp";
25 # --- 动态范围与色彩管理 --- #
26 target-colorspace-hint = "auto";
27 tone-mapping = "hable";
28 dither = "fruit";
29 dither-depth = "auto";
30 # --- 音频质量配置 --- #
31 ao = "pipewire";
32 audio-resample-filter-size = 64;
33 audio-resample-phase-shift = 10;
34 # --- 字幕配置 --- #
35 sub-auto = "fuzzy";
36 sub-bold = "yes";
37 sub-outline-size = 2.25;
38 sub-outline-color = "#111111";
39 sub-color = "#FEFEFE";
40 sub-font-size = "36";
41 sub-use-margins = "yes";
42 sub-ass-override = "force";
43 # --- 用户体验 --- #
44 save-position-on-quit = true;
45 keep-open = "yes";
46 osd-bar = "no"; # use uosc
47 # 音量控制
48 volume = 80;
49 volume-max = 120;
50 # OSD 显示
51 osd-duration = 2500;
52 osd-font-size = 32;
53 # 截图设置
54 screenshot-format = "png";
55 screenshot-dir = "$XDG_PICTURES_DIR/mpv";
56 screenshot-template = "%F-%P";
57 };
58
59 scriptOpts.uosc = {
60 languages = "slang,zh-hans";
61 };
62 };
63
64 xdg.mimeApps.defaultApplications = {
65 "audio/*" = ["mpv.desktop"];
66 "video/*" = ["mpv.desktop"];
67 };
68 };
69 };
70
71 den.aspects.desktop.app.mpv.themes = {
72 catppuccin = {
73 homeManager = {pkgs, ...}: let
74 catppuccin-mpv = pkgs.fetchFromGitHub {
75 owner = "catppuccin";
76 repo = "mpv";
77 rev = "08e90daf511eee2c10c98f0031b51bb9de240d60";
78 hash = "sha256-oUheJNWk2R6gNEmkK8H6PWX0iofx2KMGDoFWtnr420A=";
79 };
80 in {
81 programs.mpv = {
82 config = {
83 include = "${catppuccin-mpv}/mocha/mauve.conf";
84 };
85 };
86 };
87 };
88 };
89}