diff --git a/_sources/generated.json b/_sources/generated.json index a7955367..469fbe59 100644 --- a/_sources/generated.json +++ b/_sources/generated.json @@ -279,6 +279,26 @@ }, "version": "ed8ef015f97c357575b5013e18042c9faa6c068a" }, + "mpv": { + "cargoLocks": null, + "date": "2024-01-17", + "extract": null, + "name": "mpv", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "mpv", + "rev": "77dac62e40b957968cb22c430e3ad2c676d02e38", + "sha256": "sha256-vRLo8bKy8O3WvuX9IWy5lrTGkOrgZifQtxDFOScnP3Y=", + "type": "github" + }, + "version": "77dac62e40b957968cb22c430e3ad2c676d02e38" + }, "neovim": { "cargoLocks": null, "date": "2024-03-05", diff --git a/_sources/generated.nix b/_sources/generated.nix index b960d2c7..fafc353c 100644 --- a/_sources/generated.nix +++ b/_sources/generated.nix @@ -169,6 +169,18 @@ }; date = "2022-09-27"; }; + mpv = { + pname = "mpv"; + version = "77dac62e40b957968cb22c430e3ad2c676d02e38"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "mpv"; + rev = "77dac62e40b957968cb22c430e3ad2c676d02e38"; + fetchSubmodules = false; + sha256 = "sha256-vRLo8bKy8O3WvuX9IWy5lrTGkOrgZifQtxDFOScnP3Y="; + }; + date = "2024-01-17"; + }; neovim = { pname = "neovim"; version = "045e3499d9ec8d84635fb08877ae44fd33f6a38d"; diff --git a/modules/home-manager/mpv.nix b/modules/home-manager/mpv.nix new file mode 100644 index 00000000..f2e1213d --- /dev/null +++ b/modules/home-manager/mpv.nix @@ -0,0 +1,39 @@ +{ config +, lib +, sources +, ... +}: +let + cfg = config.programs.mpv.catppuccin; + enable = cfg.enable && config.programs.mpv.enable; + palette = (lib.importJSON "${sources.palette}/palette.json").${cfg.flavour}.colors; + themeDir = sources.mpv + /themes/${cfg.flavour}; +in +{ + options.programs.mpv.catppuccin = + lib.ctp.mkCatppuccinOpt "mpv" // { + accent = lib.ctp.mkAccentOpt "mpv"; + }; + + # Note that the theme is defined across multiple files + config.programs.mpv = lib.mkIf enable { + config = lib.ctp.fromINI (themeDir + "/mpv.conf"); + scriptOpts.stats = lib.ctp.fromINI + (themeDir + "/script-opts/stats.conf") // rec { + # Convert #RRGGBB into BBGGRR + plot_color = lib.trivial.pipe + palette.${cfg.accent}.hex + [ + # Strip initial # + (color: builtins.substring 1 6 color) + # Split into RR GG BB chunks + (x: builtins.genList + (n: builtins.substring (n * 2) 2 x) 3) + lib.lists.reverseList + lib.strings.concatStrings + ]; + + plot_bg_border_color = plot_color; + }; + }; +} diff --git a/nvfetcher.toml b/nvfetcher.toml index b5007bc0..d3be224a 100644 --- a/nvfetcher.toml +++ b/nvfetcher.toml @@ -54,6 +54,10 @@ fetch.github = "catppuccin/mako" src.git = "https://github.com/catppuccin/micro.git" fetch.github = "catppuccin/micro" +[mpv] +src.git = "https://github.com/catppuccin/mpv.git" +fetch.github = "catppuccin/mpv" + [neovim] src.git = "https://github.com/catppuccin/nvim.git" fetch.github = "catppuccin/nvim" diff --git a/test.nix b/test.nix index a9e59165..dcb23996 100644 --- a/test.nix +++ b/test.nix @@ -65,6 +65,7 @@ in kitty = ctpEnable; lazygit = ctpEnable; micro = ctpEnable; + mpv = ctpEnable; neovim = ctpEnable; starship = ctpEnable; tmux = ctpEnable;