mpv: use mkTarget (#1334)

Link: https://github.com/nix-community/stylix/pull/1334

Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
This commit is contained in:
awwpotato 2025-05-21 11:57:36 -07:00 committed by GitHub
parent 4ce349da56
commit c32026eab2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,50 +1,61 @@
{ lib, config, ... }:
{
options.stylix.targets.mpv.enable = config.lib.stylix.mkEnableTarget "mpv" true;
config = lib.mkIf (config.stylix.enable && config.stylix.targets.mpv.enable) {
programs.mpv = {
config = with config.lib.stylix.colors.withHashtag; {
osd-font = config.stylix.fonts.sansSerif.name;
sub-font = config.stylix.fonts.sansSerif.name;
background-color = "#000000";
osd-back-color = base01;
osd-border-color = base01;
osd-color = base05;
osd-shadow-color = base00;
};
scriptOpts = {
uosc.color =
with config.lib.stylix.colors;
lib.concatMapAttrsStringSep "," (name: value: "${name}=${value}") {
background = base00;
background_text = base05;
foreground = base05;
foreground_text = base00;
success = base0B;
error = base08;
{ mkTarget, lib, ... }:
mkTarget {
name = "mpv";
humanName = "mpv";
configElements = [
(
{ fonts }:
{
programs.mpv.config = {
osd-font = fonts.sansSerif.name;
sub-font = fonts.sansSerif.name;
};
}
)
(
{ colors }:
{
programs.mpv = {
config = with colors.withHashtag; {
background-color = "#000000";
osd-back-color = base01;
osd-border-color = base01;
osd-color = base05;
osd-shadow-color = base00;
};
modernz = with config.lib.stylix.colors.withHashtag; {
seekbarfg_color = base0D;
seekbarbg_color = base03;
seekbar_cache_color = base03;
window_title_color = base03;
window_controls_color = base03;
scriptOpts = {
uosc.color =
with colors;
lib.concatMapAttrsStringSep "," (name: value: "${name}=${value}") {
background = base00;
background_text = base05;
foreground = base05;
foreground_text = base00;
success = base0B;
error = base08;
};
title_color = base05;
time_color = base05;
chapter_title_color = base05;
cache_info_color = base05;
modernz = with colors.withHashtag; {
seekbarfg_color = base0D;
seekbarbg_color = base03;
seekbar_cache_color = base03;
window_title_color = base03;
window_controls_color = base03;
middle_buttons_color = base0D;
side_buttons_color = base03;
playpause_color = base0D;
hover_effect_color = base0E;
title_color = base05;
time_color = base05;
chapter_title_color = base05;
cache_info_color = base05;
middle_buttons_color = base0D;
side_buttons_color = base03;
playpause_color = base0D;
hover_effect_color = base0E;
};
};
};
};
};
};
}
)
];
}