Skip to content

Commit

Permalink
feat(home-manager/mpv): add uosc
Browse files Browse the repository at this point in the history
  • Loading branch information
olifloof committed Jul 18, 2024
1 parent d75d580 commit 06559b2
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions modules/home-manager/mpv.nix
Original file line number Diff line number Diff line change
@@ -1,18 +1,35 @@
{ config, lib, ... }:
{
config,
lib,
pkgs,
...
}:
let
inherit (config.catppuccin) sources;
inherit (lib)
ctp
mkEnableOption
mkIf
mkMerge
;
cfg = config.programs.mpv.catppuccin;
enable = cfg.enable && config.programs.mpv.enable;
themeDir = sources.mpv + "/themes/${cfg.flavor}/${cfg.accent}";
uoscDir = sources.mpv + "/uosc/themes/${cfg.flavor}/${cfg.accent}";
in
{
options.programs.mpv.catppuccin = lib.ctp.mkCatppuccinOpt { name = "mpv"; } // {
accent = lib.ctp.mkAccentOpt "mpv";
options.programs.mpv.catppuccin = ctp.mkCatppuccinOpt { name = "mpv"; } // {
accent = ctp.mkAccentOpt "mpv";
uosc = mkEnableOption "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");
config.programs.mpv = mkIf enable {
config = ctp.fromINI (themeDir + "/mpv.conf");
scriptOpts = {
stats = ctp.fromINI (themeDir + "/script-opts/stats.conf");
uosc = mkIf cfg.uosc.enable ctp.fromINI (uoscDir + "/script-opts/uosc.conf");
};
scripts = mkIf cfg.uosc.enable mkMerge [ pkgs.mpvScripts.uosc ];
};
}

0 comments on commit 06559b2

Please sign in to comment.